From: Chris Burgess Date: Tue, 10 Jan 2017 03:58:35 +0000 (+0530) Subject: fix for greeting token X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1ae599757609b1ba5a3ea882682e1eadd7f7023a;p=civicrm-core.git fix for greeting token --- diff --git a/Civi/Token/AbstractTokenSubscriber.php b/Civi/Token/AbstractTokenSubscriber.php index 6cb8609bb4..e0f712f427 100644 --- a/Civi/Token/AbstractTokenSubscriber.php +++ b/Civi/Token/AbstractTokenSubscriber.php @@ -163,12 +163,12 @@ abstract class AbstractTokenSubscriber implements EventSubscriberInterface { /** * Populate the custom field and other remaining entity token data. * - * @param TokenRow $e + * @param TokenRow $row * The record for which we want token values. * @param string $entity * The entity for which we want the token values * @param array $tokens - * The array of tokens whose data need to be fetched + * The array of tokens whose data need to be fetched */ public function evaluateExtraToken(TokenRow $row, $entity, $tokens) { if (empty($tokens)) { diff --git a/Civi/Token/TokenCompatSubscriber.php b/Civi/Token/TokenCompatSubscriber.php index b03195cd26..48d7984911 100644 --- a/Civi/Token/TokenCompatSubscriber.php +++ b/Civi/Token/TokenCompatSubscriber.php @@ -65,15 +65,15 @@ class TokenCompatSubscriber implements EventSubscriberInterface { $contactTokens = \CRM_Utils_Array::value('contact', $messageTokens); if (!empty($contactTokens)) { try { - $result = civicrm_api3('Contact', 'getsingle', array( + $result = civicrm_api3('Contact', 'getsingle', array( 'id' => $contactId, 'return' => $contactTokens, - )); - $contact = array_merge($contact, $result); - } - catch (CiviCRM_API3_Exception $e) { - //do nothing - } + )); + $contact = array_merge($contact, $result); + } + catch (CiviCRM_API3_Exception $e) { + //do nothing + } } } else { @@ -117,12 +117,12 @@ class TokenCompatSubscriber implements EventSubscriberInterface { $e->string = \CRM_Utils_Token::replaceDomainTokens($e->string, \CRM_Core_BAO_Domain::getDomain(), $isHtml, $e->message['tokens'], $useSmarty); if (!empty($e->context['contact'])) { + \CRM_Utils_Token::replaceGreetingTokens($e->string, $e->context['contact'], $e->context['contact']['contact_id'], NULL, FALSE); + $e->string = \CRM_Utils_Token::replaceContactTokens($e->string, $e->context['contact'], $isHtml, $e->message['tokens'], FALSE, $useSmarty); // FIXME: This may depend on $contact being merged with hook values. $e->string = \CRM_Utils_Token::replaceHookTokens($e->string, $e->context['contact'], $e->context['hookTokenCategories'], $isHtml, $useSmarty); - - \CRM_Utils_Token::replaceGreetingTokens($e->string, NULL, $e->context['contact']['contact_id'], NULL, $useSmarty); } if ($useSmarty) {