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)
}
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'];