Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #168 Contact Email Address not showing in Subpanels #417

Open
wants to merge 1 commit into
base: hotfix
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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