From: Dave Greenberg Date: Mon, 20 Oct 2014 19:19:28 +0000 (-0700) Subject: CRM-15418 - Prevent non-contact tokens from being lost in replaceGreetingTokens function. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=562cf4d73cc403d502eaa84af455b9757be9ab3c;p=civicrm-core.git CRM-15418 - Prevent non-contact tokens from being lost in replaceGreetingTokens function. ---------------------------------------- * CRM-15418: https://issues.civicrm.org/jira/browse/CRM-15418 --- diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index 0e58f6e12d..10d5d8937f 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -1364,12 +1364,14 @@ class CRM_Utils_Token { $escapeSmarty ); } + // check if there are still any unevaluated tokens - $greetingTokens = self::getTokens($tokenString); + $remainingTokens = self::getTokens($tokenString); - // $greetingTokens not empty, there are hook tokens to replace - if (!empty($greetingTokens) ) { + // contact related $greetingTokens not empty, there are customized or hook tokens to replace + if (!empty($remainingTokens['contact']) ) { // Fill the return properties array + $greetingTokens = $remainingTokens['contact']; reset($greetingTokens); $greetingsReturnProperties = array(); while(list($key) = each($greetingTokens)) {