Iām new using SuiteCRM Iām want to create a new sub-panel on cases, What I want to display is all the cases related to the account_name:
This is my approach:
I created a relationship with studio one-2-many to the same module and then I modify the subpanel field (cases_cases_1_Cases.php) as fallow:
$layout_defs["Cases"]["subpanel_setup"]['cases_cases_1cases_ida'] = array (
'order' => 100,
'module' => 'Cases',
'subpanel_name' => 'default',
//'sort_order' => 'asc',
//'sort_by' => 'id',
'title_key' => 'LBL_CASES_CASES_1_FROM_CASES_R_TITLE',
'generate_select' => true,
//'get_subtable_data' => 'cases_cases_1cases_ida',
'get_subpanel_data' => 'function:get_info_list',
'function_parameters' => array(
'type' => 'urgent',
'import_function_file' => 'custom/modules/cases/CasesSubpanel.php',
//'cases' => $this->_focus->id,
'return_as_array' => 'true'
),
);
then I declare my function under the path:custom/modules/cases/CasesSubpanel.php
function get_info_list($params){
$sql = array('select c.case_number as Num, c.name as Subject, a.name as "Account Name", c.status as Status, c.date_entered as "Date Created",
concat(u.first_name, " ", u.last_name) as "Assigned User"',
'from cases as c, users as u, accounts as a',
'where u.id = c.assigned_user_id as a.id = c.account_id',
'and ;) c.name = "Test Account"');
$GLOBALS['log']->debug('candy ' .print_r($sql, true));
return $sql;
}
but my criteria is not been consider on my query, it seems to be created by sugarBean subquery instead.
any Idea why or better way to do this :dry: ?