Results 1 to 1 of 1

Thread: Subpanels - Data field population

  1. #1
    rustinp77 is offline Sugar Community Member
    Join Date
    May 2007
    Location
    Mid-Atlantic, US
    Posts
    178

    Default Subpanels - Data field population

    I'm creating the "Cases" subpanel under the Project Task module. This has been setup for a one-to-many relationship using an additional field labeled "project_task_id" in the cases table.

    When clicking the Create button within the Cases subpanel, it does not record the id from project task into the cases table. How can this be accomplished?

    If I manually record the project task id into the database table, it does display when viewing the detail page. The only missing action/item is recording the project task id into the cases table field => project_task_id; which i created within the cases vardef.php file.

    /modules/Cases/vardef.php
    PHP Code:
    'project_task_id'=>
          array(
          
    'name'=>'project_task_id',
          
    'type' => 'id',
          
    'reportable'=>false,
          
    'vname'=>'LBL_PROJECT_TASK_ID',
          
    'audited'=>false,
          
    'comment' => 'The project task to which the case is associated'
          
    ), 
    /modules/ProjectTask/layout_defs.php
    PHP Code:
    'cases' => array(
                
    'order' => 70,
                
    'sort_order' => 'desc',
                
    'sort_by' => 'case_number',
                
    'module' => 'Cases',
                
    'subpanel_name' => 'default',
                
    'get_subpanel_data' => 'cases',
                
    'add_subpanel_data' => 'case_id',
                
    'title_key' => 'LBL_CASES_SUBPANEL_TITLE',
                
    'top_buttons' => array(
                    array(
    'widget_class' => 'SubPanelTopButtonQuickCreate'),
                    array(
    'widget_class' => 'SubPanelTopSelectButton''mode'=>'MultiSelect')
                ),
            ), 
    /modules/ProjectTask/vardefs.php
    PHP Code:
    'cases' => array (
               
    'name' => 'cases',
               
    'type' => 'link',
               
    'relationship' => 'project_task_cases'//relationship table
               
    'module'=>'Cases',
               
    'bean_name'=>'Case',
               
    'source'=>'non-db',
               
    'vname'=>'LBL_CASES',
             ), 
    PHP Code:
    ,'project_task_cases' => array(
           
    'lhs_module'=> 'ProjectTask',
           
    'lhs_table'=> 'project_task',
           
    'lhs_key' => 'id',
           
    'rhs_module'=> 'Cases',
           
    'rhs_table'=> 'cases',
           
    'rhs_key' => 'project_task_id',
           
    'relationship_type'=>'one-to-many'
         

    I'm not sure if this should automatically record the project task id in the cases table for the field I created or if I manually need to get the project task id and record the id into the cases table.

    If I need to manually record the project task id into the cases table for the field I created, where does this need to be taken place?

    Any help would be appreciated, I'm getting frustrated for such a simple task...

    Regards,

    Rustin


    * FIXED

    /modules/Cases/Case.php
    PHP Code:
    var $relationship_fields = Array('project_task_id' => 'projecttask''account_id'=>'account''bug_id' => 'bugs',
                                        
    'task_id'=>'tasks''note_id'=>'notes',
                                        
    'meeting_id'=>'meetings''call_id'=>'calls''email_id'=>'emails',                                    
                                        ); 
    /modules/Cases/Save.php
    PHP Code:
    $focus = new aCase();

    $focus populateFromPost(''$focus);

    $focus->project_task_id $_POST['return_id'];

    $focus->save($GLOBALS['check_notify']);
    $return_id $focus->id
    Last edited by rustinp77; 2007-06-08 at 02:08 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Custom field data not being saved
    By smueller72 in forum Help
    Replies: 5
    Last Post: 2006-12-21, 04:14 AM
  2. Custom Field data not saving
    By erick.wolfe in forum Help
    Replies: 0
    Last Post: 2006-09-21, 07:04 PM
  3. How to make a field read only based on data
    By prismainc in forum Help
    Replies: 0
    Last Post: 2006-06-11, 01:07 PM
  4. Replies: 2
    Last Post: 2005-09-12, 08:10 PM
  5. Replies: 0
    Last Post: 2005-07-19, 08:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •