0

Taking a sub panel in sugarcrm and making it into two, one that displays entries depending if a checkbox is checked, the other non checked entries.

I have a module called mod_loaninvestor, and its sub panel is whole_subpanel_mod_loaninvestor_contacts

Now I know vardefs is where you create the duplicate and rename it like this

        <?php 
 //WARNING: The contents of this file are auto-generated


 // created: 2014-01-24 13:12:28
$layout_defs["Contacts"]["subpanel_setup"]['mod_loaninvestor_contacts'] = array (
  'order' => 100,
  'module' => 'mod_LoanInvestor',
  'subpanel_name' => 'default',
  'sort_order' => 'asc',
  'sort_by' => 'id',
  // 'where' => "(mod_LoanInvestor.active_investment == "1")",   
  'title_key' => 'LBL_MOD_LOANINVESTOR_CONTACTS_FROM_MOD_LOANINVESTOR_TITLE',
  'get_subpanel_data' => 'mod_loaninvestor_contacts',
  'top_buttons' => 
  array (
    /*
    0 => 
    array (
      'widget_class' => 'SubPanelTopButtonQuickCreate',
    ),
    1 => 
    array (
      'widget_class' => 'SubPanelTopSelectButton',
      'mode' => 'MultiSelect',
    ),
    */
  ),
);

 // created: 2014-01-24 13:12:28
$layout_defs["Contacts"]["subpanel_setup"]['mod_loaninvestor_contacts1'] = array (
  'order' => 100,
  'module' => 'mod_LoanInvestor',
  'subpanel_name' => 'default',
  'sort_order' => 'asc',
  'sort_by' => 'id',
  'title_key' => 'LBL_MOD_LOANINVESTOR_CONTACTS_FROM_MOD_LOANINVESTOR_TITLE',
  'get_subpanel_data' => 'mod_loaninvestor_contacts',
  'top_buttons' => 
  array (
    /*
    0 => 
    array (
      'widget_class' => 'SubPanelTopButtonQuickCreate',
    ),
    1 => 
    array (
      'widget_class' => 'SubPanelTopSelectButton',
      'mode' => 'MultiSelect',
    ),
    */
  ),

);

?>

How would I make it so the first one would only show entries with the following checked

and the other display only entries with that field unchecked?

Thanks for your help!

1 Answers1

1

You're halfway there. On top of defining new layoutdefs, you need to create a new subpanel definition.

Dig into mod_LoanInvestor and the metadata/subpanels/default.php and copy it to default2.php or whatever you'd like to call it. You'll want to use a WHERE clause to separate the two.

https://gist.github.com/matthewpoer/8871568

Here's a gist where I'm doing this with transactions records to seperate scheduled (future) transactions from past (posted payments).

Matthew Poer
  • 1,682
  • 10
  • 17