Skip to content
Snippets Groups Projects
Commit ee70f332 authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

CRM-13161, fixed token evaluation

----------------------------------------
* CRM-13161: Greetings are  not evaluated correctly if it includes prefix / suffix
  http://issues.civicrm.org/jira/browse/CRM-13161
parent 4e09f9c9
Branches
Tags
No related merge requests found
......@@ -663,6 +663,11 @@ class CRM_Utils_Token {
}
else {
$value = CRM_Utils_Array::retrieveValueRecursive($contact, $token);
// note that incase of pseudoconstants we get array ( 0 => id, 1 => label )
if (is_array($value)) {
$value = $value[1];
}
}
if (!$html) {
......@@ -1185,6 +1190,10 @@ class CRM_Utils_Token {
if (!empty($greetingTokens)) {
// first use the existing contact object for token replacement
if (!empty($contactDetails)) {
// unset id's to get labels for the pseudoconstants
foreach ( array('individual_prefix', 'individual_suffix', 'gender') as $field ) {
unset($contactDetails[0][$contactId][$field]);
}
$tokenString = CRM_Utils_Token::replaceContactTokens($tokenString, $contactDetails, TRUE, $greetingTokens, TRUE);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment