Hi everyone, I plan to change the list for my subpanel with a sql query with AS statement. But I not sure how to display the content to the list. Please help.
Below was example of my code.
customFindLeadDuplicate.php
<?php
function get_mobile_duplicate($params) {
$args = func_get_args();
$LeadsId = $args[0]['id'];
$LeadsMobile = $args[0]['phone_mobile'];
$LeadsEmail = $args[0]['email'];
$LeadsNRIC = $args[0]['nric'];
$return_array['select'] = " select Leads.*, CASE WHEN leads.phone_mobile='$LeadsMobile' THEN 'Mobile Duplicate' ELSE '' END AS duplicate_list ";
$return_array['from'] = " FROM Leads ";
$return_array['where'] = " WHERE leads.id != '$LeadsId' AND leads.phone_mobile='$LeadsMobile''";
$return_array['join'] = "";
$return_array['join_tables'] = '';
return $return_array;
}
?>
leadsubpanel.php
<?php
$layout_defs['Leads']['subpanel_setup']['get_mobile_duplicate'] =
array('order' => 40,
'module' => 'Leads',
'subpanel_name' => 'Lead_subpanel_get_mobile_duplicate',
'get_subpanel_data' => 'function:get_mobile_duplicate',
'generate_select' => true,
'title_key' => 'List Duplicate',
'top_buttons' => array(),
'function_parameters' => array(
'import_function_file' => 'custom/modules/Leads/customFindLeadsDuplicate.php',
'id' => $this->_focus->id,
'phone_mobile' => $this->_focus->phone_mobile,
'return_as_array' => 'true'
),
);
?>
I hope to display the duplicate_list but i not sure how to set in the $subpanel_layout[‘list_fields’].
Thank everyone.