Skip to content

Commit

Permalink
Merge pull request #21475 from eileenmcnaughton/case_replace
Browse files Browse the repository at this point in the history
dev/core#2817 remove call to getTokenDetails
  • Loading branch information
eileenmcnaughton authored Sep 14, 2021
2 parents 8761e15 + 2721ebc commit e117f4a
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions CRM/Contact/Form/Task/PDFLetterCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ public static function processMessageTemplate($formValues) {
public static function postProcess(&$form): void {
$formValues = $form->controller->exportValues($form->getName());
[$formValues, $categories, $html_message, $messageToken, $returnProperties] = self::processMessageTemplate($formValues);
$skipOnHold = $form->skipOnHold ?? FALSE;
$skipDeceased = $form->skipDeceased ?? TRUE;
$html = $activityIds = [];

// CRM-16725 Skip creation of activities if user is previewing their PDF letter(s)
Expand All @@ -131,32 +129,14 @@ public static function postProcess(&$form): void {
}

foreach ($form->_contactIds as $item => $contactId) {
$caseId = NULL;
$params = ['contact_id' => $contactId];

$caseId = $form->getVar('_caseId');
if (empty($caseId) && !empty($form->_caseIds[$item])) {
$caseId = $form->_caseIds[$item];
}

[$contact] = CRM_Utils_Token::getTokenDetails($params,
$returnProperties,
$skipOnHold,
$skipDeceased,
NULL,
$messageToken,
'CRM_Contact_Form_Task_PDFLetterCommon'
);

if (civicrm_error($contact)) {
$notSent[] = $contactId;
continue;
}

$tokenHtml = CRM_Core_BAO_MessageTemplate::renderTemplate([
'contactId' => $contactId,
'messageTemplate' => ['msg_html' => $html_message],
'tplParams' => ['contact' => $contact],
'tokenContext' => $caseId ? ['caseId' => $caseId] : [],
'disableSmarty' => (!defined('CIVICRM_MAIL_SMARTY') || !CIVICRM_MAIL_SMARTY),
])['html'];
Expand Down

0 comments on commit e117f4a

Please sign in to comment.