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

Core/8 - Fix errors on Print/Merge Document for Cases #11926

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions CRM/Case/Form/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,13 @@ class CRM_Case_Form_Task extends CRM_Core_Form_Task {
// Must be set to entity shortname (eg. event)
static $entityShortname = 'case';

/**
* @inheritDoc
*/
public function setContactIDs() {
$this->_contactIds = CRM_Core_DAO::getContactIDsFromComponent($this->_entityIds,
'civicrm_case_contact', 'case_id'
);
}

}
2 changes: 1 addition & 1 deletion CRM/Case/Form/Task/PDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function postProcess() {
*/
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);
}
Expand Down
6 changes: 3 additions & 3 deletions CRM/Core/DAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -1662,10 +1662,10 @@ public static function cascadeUpdate($daoName, $fromId, $toId, $newData = array(
*
* @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)) {
Expand All @@ -1676,7 +1676,7 @@ public static function &getContactIDsFromComponent(&$componentIDs, $tableName) {
$query = "
SELECT contact_id
FROM $tableName
WHERE id IN ( $IDs )
WHERE $idField IN ( $IDs )
";

$dao = CRM_Core_DAO::executeQuery($query);
Expand Down