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

CRM-20475 - Add missing phone info to case api #10438

Merged
merged 1 commit into from
May 30, 2017
Merged
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
6 changes: 5 additions & 1 deletion CRM/Case/BAO/Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ public static function getRelatedContacts($caseID, $includeDetails = TRUE) {
}
$values = array();
$query = '
SELECT cc.display_name as name, cc.sort_name as sort_name, cc.id, cr.relationship_type_id, crt.label_b_a as role, crt.name_b_a, ce.email
SELECT cc.display_name as name, cc.sort_name as sort_name, cc.id, cr.relationship_type_id, crt.label_b_a as role, crt.name_b_a, ce.email, cp.phone
FROM civicrm_relationship cr
LEFT JOIN civicrm_relationship_type crt
ON crt.id = cr.relationship_type_id
Expand All @@ -1223,6 +1223,9 @@ public static function getRelatedContacts($caseID, $includeDetails = TRUE) {
LEFT JOIN civicrm_email ce
ON ce.contact_id = cc.id
AND ce.is_primary= 1
LEFT JOIN civicrm_phone cp
ON cp.contact_id = cc.id
AND cp.is_primary= 1
WHERE cr.case_id = %1 AND cr.is_active AND cc.is_deleted <> 1';

$params = array(1 => array($caseID, 'Integer'));
Expand All @@ -1240,6 +1243,7 @@ public static function getRelatedContacts($caseID, $includeDetails = TRUE) {
'relationship_type_id' => $dao->relationship_type_id,
'role' => $dao->role,
'email' => $dao->email,
'phone' => $dao->phone,
);
// Add more info about the role (creator, manager)
$role = CRM_Utils_Array::value($dao->name_b_a, $caseRoles);
Expand Down