X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FToken.php;h=dd81e288723afc3513440e0d6b94c18edf0920a2;hb=e0c4f234b9eab061bade28bd91a39f8912f9e2be;hp=12e21758e27056f244eb86d934f8d5b72117b5e7;hpb=d10b2c65fedfc3bac77085a1639acc2188de2926;p=civicrm-core.git diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index 12e21758e2..dd81e28872 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)) { @@ -1720,7 +1722,12 @@ class CRM_Utils_Token { // Group by entity else { $split = explode('.', trim($k, '{}')); - $entity = isset($split[1]) ? ucfirst($split[0]) : 'Contact'; + if (isset($split[1])) { + $entity = array_key_exists($split[1], CRM_Core_DAO_Address::export()) ? 'Address' : ucfirst($split[0]); + } + else { + $entity = 'Contact'; + } $sorted[ts($entity)][] = array('id' => $k, 'text' => $v); } }