From d94a02b4f706e31ba57e8adecb4bf0c322d78365 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 3 Apr 2018 10:52:08 -0400 Subject: [PATCH] Core/8 - Fix fatal error on Print/Merge Document for cases Conflicts: CRM/Case/Form/Task.php --- CRM/Case/Form/Task.php | 12 +++++++++++- CRM/Case/Form/Task/PDF.php | 2 +- CRM/Core/DAO.php | 6 +++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CRM/Case/Form/Task.php b/CRM/Case/Form/Task.php index db089a0dc7..3a5c4f1d7f 100644 --- a/CRM/Case/Form/Task.php +++ b/CRM/Case/Form/Task.php @@ -41,9 +41,10 @@ class CRM_Case_Form_Task extends CRM_Core_Form_Task { static $entityShortname = 'case'; /** - * The array that holds all the case ids + * Deprecated copy of $_entityIds * * @var array + * @deprecated */ public $_caseIds; @@ -113,4 +114,13 @@ class CRM_Case_Form_Task extends CRM_Core_Form_Task { } } + /** + * @inheritDoc + */ + public function setContactIDs() { + $this->_contactIds = CRM_Core_DAO::getContactIDsFromComponent($this->_entityIds, + 'civicrm_case_contact', 'case_id' + ); + } + } diff --git a/CRM/Case/Form/Task/PDF.php b/CRM/Case/Form/Task/PDF.php index 443690fd77..881dcac765 100644 --- a/CRM/Case/Form/Task/PDF.php +++ b/CRM/Case/Form/Task/PDF.php @@ -86,7 +86,7 @@ class CRM_Case_Form_Task_PDF extends CRM_Case_Form_Task { */ public function listTokens() { $tokens = CRM_Core_SelectValues::contactTokens(); - foreach ($this->_caseIds as $key => $caseId) { + foreach ($this->_componentIds as $key => $caseId) { $caseTypeId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $caseId, 'case_type_id'); $tokens += CRM_Core_SelectValues::caseTokens($caseTypeId); } diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index cab82abf3c..565a84ad1a 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -1662,10 +1662,10 @@ FROM civicrm_domain * * @param $componentIDs * @param string $tableName - * + * @param string $idField * @return array */ - public static function &getContactIDsFromComponent(&$componentIDs, $tableName) { + public static function getContactIDsFromComponent($componentIDs, $tableName, $idField = 'id') { $contactIDs = array(); if (empty($componentIDs)) { @@ -1676,7 +1676,7 @@ FROM civicrm_domain $query = " SELECT contact_id FROM $tableName - WHERE id IN ( $IDs ) + WHERE $idField IN ( $IDs ) "; $dao = CRM_Core_DAO::executeQuery($query); -- 2.25.1