From 6d8b2718417f73e03a1fcf662ce071c2ca314660 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 19 Jun 2023 12:10:59 +1200 Subject: [PATCH] Do not generate unshared variable in shared processMessagedTemplate --- CRM/Contact/Form/Task/PDFTrait.php | 12 +----------- CRM/Member/Form/Task/PDFLetter.php | 4 ++-- .../CRM/Contact/Form/Task/PrintDocumentTest.php | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/CRM/Contact/Form/Task/PDFTrait.php b/CRM/Contact/Form/Task/PDFTrait.php index e19cdac942..521e02664f 100644 --- a/CRM/Contact/Form/Task/PDFTrait.php +++ b/CRM/Contact/Form/Task/PDFTrait.php @@ -473,17 +473,7 @@ trait CRM_Contact_Form_Task_PDFTrait { //time being hack to strip ' ' //from particular letter line, CRM-6798 $this->formatMessage($html_message); - - $messageToken = CRM_Utils_Token::getTokens($html_message); - - $returnProperties = []; - if (isset($messageToken['contact'])) { - foreach ($messageToken['contact'] as $key => $value) { - $returnProperties[$value] = 1; - } - } - - return [$formValues, $html_message, $messageToken, $returnProperties]; + return [$formValues, $html_message]; } /** diff --git a/CRM/Member/Form/Task/PDFLetter.php b/CRM/Member/Form/Task/PDFLetter.php index d0c1696d03..2d1b680ef4 100644 --- a/CRM/Member/Form/Task/PDFLetter.php +++ b/CRM/Member/Form/Task/PDFLetter.php @@ -86,8 +86,8 @@ class CRM_Member_Form_Task_PDFLetter extends CRM_Member_Form_Task { public function postProcessMembers($membershipIDs, $contactIDs) { $form = $this; $formValues = $form->controller->exportValues($form->getName()); - [$formValues, $html_message, $messageToken] = $this->processMessageTemplate($formValues); - + [$formValues, $html_message] = $this->processMessageTemplate($formValues); + $messageToken = CRM_Utils_Token::getTokens($html_message); $html = $this->generateHTML( $membershipIDs, diff --git a/tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php b/tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php index 0058747ba3..7908867533 100644 --- a/tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php +++ b/tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php @@ -56,7 +56,7 @@ class CRM_Contact_Form_Task_PrintDocumentTest extends CiviUnitTestCase { 'radio_ts' => 'ts_sel', 'task' => CRM_Member_Task::PDF_LETTER, ]); - list($formValues, $html_message, $messageToken, $returnProperties) = $form->processMessageTemplate($formValues); + list($formValues) = $form->processMessageTemplate($formValues); list($html_message, $zip) = CRM_Utils_PDF_Document::unzipDoc($formValues['document_file_path'], $formValues['document_type']); foreach ($this->_contactIds as $item => $contactId) { -- 2.25.1