Skip to content

Commit

Permalink
Fix #168 Contact Email Address not showing in Subpanels
Browse files Browse the repository at this point in the history
The entire Emails column of the Contacts subpanel in the Accounts module was empty.  It should have email addresses of the related Contacts.
  • Loading branch information
chris001 authored Dec 30, 2023
1 parent bd5cd81 commit e8ed40f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion public/legacy/data/SugarBean.php
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,24 @@ public static function get_union_related_list_query_params(
email_addr_bean_rel.bean_id = $relatedBeanTable.id AND
email_addr_bean_rel.bean_module = '$relatedBeanModule') as $order_by";
}

// Changed to fix https://github.com/salesagility/SuiteCRM-Core/issues/168#issuecomment-1309063873
// Bug: No emails shown in Email column, Contact subpabel, Accounts module.
elseif (isset($subpanel_def->panel_definition['list_fields']['email1']['widget_class']) &&
$subpanel_def->panel_definition['list_fields']['email1']['widget_class'] === 'SubPanelEmailLink' &&
!array_key_exists('email1', $subquery['query_fields'])) {
$relatedBeanTable = $subpanel_def->table_name;
$relatedBeanModule = $subpanel_def->get_module_name();
$subquery['select'] .= ",
(SELECT email_addresses.email_address
FROM email_addr_bean_rel
JOIN email_addresses ON email_addresses.id = email_addr_bean_rel.email_address_id
WHERE
email_addr_bean_rel.primary_address = 1 AND
email_addr_bean_rel.deleted = 0 AND
email_addr_bean_rel.bean_id = $relatedBeanTable.id AND
email_addr_bean_rel.bean_module = '$relatedBeanModule') as email1";
}

//Put the query into the final_query
$query = $subquery['select'] . " " . $subquery['from'] . " " . $subquery['where'];
if (!$first) {
Expand Down

0 comments on commit e8ed40f

Please sign in to comment.