[REF] Fix some more calls to getTokens to make it clear only the first return value...
authoreileen <emcnaughton@wikimedia.org>
Thu, 1 Oct 2020 05:37:13 +0000 (18:37 +1300)
committereileen <emcnaughton@wikimedia.org>
Thu, 1 Oct 2020 05:37:13 +0000 (18:37 +1300)
CRM/Mailing/Page/Preview.php
CRM/Pledge/BAO/Pledge.php

index 4d7981481d4032ffd36b89b1ef16fde5afd0616a..565388b0231c3aa2f118b9b09503ca697f57ae32 100644 (file)
@@ -60,15 +60,15 @@ class CRM_Mailing_Page_Preview extends CRM_Core_Page {
     $returnProperties = $mailing->getReturnProperties();
     $params = ['contact_id' => $session->get('userID')];
 
-    $details = CRM_Utils_Token::getTokenDetails($params,
+    [$details] = CRM_Utils_Token::getTokenDetails($params,
       $returnProperties,
       TRUE, TRUE, NULL,
       $mailing->getFlattenedTokens(),
       get_class($this)
     );
-    // $details[0] is an array of [ contactID => contactDetails ]
+    // $details is an array of [ contactID => contactDetails ]
     $mime = &$mailing->compose(NULL, NULL, NULL, $session->get('userID'), $fromEmail, $fromEmail,
-      TRUE, $details[0][$session->get('userID')], $attachments
+      TRUE, $details[$session->get('userID')], $attachments
     );
 
     if ($type == 'html') {
index 31f8fbc3c4003ea78f2136fe9423f1e6ed1b8f9f..9bc13cda3129ec13397964d09e3972e705a993f5 100644 (file)
@@ -587,13 +587,13 @@ GROUP BY  currency
     foreach ($fields as $key => $val) {
       $returnProperties[$val] = TRUE;
     }
-    $details = CRM_Utils_Token::getTokenDetails($ids,
+    [$details] = CRM_Utils_Token::getTokenDetails($ids,
       $returnProperties,
       TRUE, TRUE, NULL,
       $tokens,
       get_class($form)
     );
-    $form->assign('contact', $details[0][$params['contact_id']]);
+    $form->assign('contact', $details[$params['contact_id']]);
 
     // handle custom data.
     if (!empty($params['hidden_custom'])) {