From 68783143612bfee0c6ca3f7d4c5266d08c1ff11a Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Fri, 29 Aug 2014 12:10:47 -0400 Subject: [PATCH] CRM-15201 fix case get related contacts query --- CRM/Case/BAO/Case.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index 48956c3763..35069f3e75 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -1375,13 +1375,18 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c */ static function getRelatedContacts($caseID, $skipDetails = FALSE) { $values = array(); - $query = 'SELECT cc.display_name as name, cc.sort_name as sort_name, cc.id, crt.label_b_a as role, ce.email - FROM civicrm_relationship cr - LEFT JOIN civicrm_relationship_type crt ON crt.id = cr.relationship_type_id - LEFT JOIN civicrm_contact cc ON cc.id = cr.contact_id_b - LEFT JOIN civicrm_email ce ON ce.contact_id = cc.id - WHERE cr.case_id = %1 AND ce.is_primary= 1 - GROUP BY cc.id'; + $query = ' + SELECT cc.display_name as name, cc.sort_name as sort_name, cc.id, crt.label_b_a as role, ce.email + FROM civicrm_relationship cr + LEFT JOIN civicrm_relationship_type crt + ON crt.id = cr.relationship_type_id + LEFT JOIN civicrm_contact cc + ON cc.id = cr.contact_id_b + LEFT JOIN civicrm_email ce + ON ce.contact_id = cc.id + AND ce.is_primary= 1 + WHERE cr.case_id = %1 + GROUP BY cc.id'; $params = array(1 => array($caseID, 'Integer')); $dao = CRM_Core_DAO::executeQuery($query, $params); -- 2.25.1