$task
);
$contribution = $contributions[$contributionId] = $contribution[$contributionId];
+
if ($form->_includesSoftCredits) {
//@todo find out why this happens & add comments
list($contactID) = explode('-', $item);
$contactID = $contribution['contact_id'];
}
if (!isset($contacts[$contactID])) {
- list($contact) = CRM_Utils_Token::getTokenDetails(array('contact_id' => $contactID),
- $returnProperties,
- $skipOnHold,
- $skipDeceased,
- NULL,
- $messageToken,
- $task
- );
- $contacts[$contactID] = $contact[$contactID];
+ $contacts[$contactID] = array();
$contacts[$contactID]['contact_aggregate'] = 0;
$contacts[$contactID]['combined'] = $contacts[$contactID]['contribution_ids'] = array();
}
$contacts[$contactID]['aggregates'][$groupBy][$groupByID] += $contribution['total_amount'];
}
}
+ // Assign the available contributions before calling tokens so hooks parsing smarty can access it.
+ // Note that in core code you can only use smarty here if enable if for the whole site, incl
+ // CiviMail, with a big performance impact.
+ // Hooks allow more nuanced smarty usage here.
+ CRM_Core_Smarty::singleton()->assign('contributions', $contributions);
+ foreach ($contacts as $contactID => $contact) {
+ $tokenResolvedContacts = CRM_Utils_Token::getTokenDetails(array('contact_id' => $contactID),
+ $returnProperties,
+ $skipOnHold,
+ $skipDeceased,
+ NULL,
+ $messageToken,
+ $task
+ );
+ $contacts[$contactID] = array_merge($tokenResolvedContacts[0][$contactID], $contact);
+ }
return array($contributions, $contacts);
}