Do not generate unshared variable in shared processMessagedTemplate
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 19 Jun 2023 00:10:59 +0000 (12:10 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 19 Jun 2023 00:14:46 +0000 (12:14 +1200)
CRM/Contact/Form/Task/PDFTrait.php
CRM/Member/Form/Task/PDFLetter.php
tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php

index e19cdac942c884506a8cd339b78bc22b66c03585..521e02664f0897df15daf3b1fc0ee8d3a4abb2fc 100644 (file)
@@ -473,17 +473,7 @@ trait CRM_Contact_Form_Task_PDFTrait {
     //time being hack to strip '&nbsp;'
     //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];
   }
 
   /**
index d0c1696d03129a2708574eb170a63124eb194e7e..2d1b680ef497a211e37977d6ae46355778c9d333 100644 (file)
@@ -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,
index 0058747ba336a67a57cf8768de8813b285d739ab..79088675334f3e389c800977789687ba8cac9625 100644 (file)
@@ -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) {