From 60f8111ecdf5f0762f6a359f24ff99f6bde08230 Mon Sep 17 00:00:00 2001 From: Tunbola Ogunwande Date: Tue, 12 May 2020 16:09:59 +0100 Subject: [PATCH] RSE-1022: Fix Issue with API returning Case Clients As Part of Related Contacts Included in CiviCRM 5.26 PR: https://github.com/civicrm/civicrm-core/pull/16837 --- CRM/Case/BAO/Case.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index bda424a9eff9..d936c32c3bf0 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -1141,6 +1141,7 @@ public static function getRelatedContacts($caseID, $includeDetails = TRUE) { } $values = []; + $caseClientCondition = !empty($caseInfo['client_id']) ? "AND cc.id NOT IN (%2)" : ''; $query = << [$caseID, 'Integer'], - 2 => [implode(',', $caseInfo['client_id']), 'String'], ]; + + if ($caseClientCondition) { + $params[2] = [implode(',', $caseInfo['client_id']), 'CommaSeparatedIntegers']; + } $dao = CRM_Core_DAO::executeQuery($query, $params); while ($dao->fetch()) {