* Extra params.
* @param array $tokens
* The list of tokens we've extracted from the content.
- * @param null $className
- * @param int $jobID
+ * @param string|null $className
+ * @param int|null $jobID
* The mailing list jobID - this is a legacy param.
*
- * @return array
+ * @return array - e.g [[1 => ['first_name' => 'bob'...], 34 => ['first_name' => 'fred'...]]]
*/
public static function getTokenDetails(
$contactIDs,
}
}
- $details = CRM_Contact_BAO_Query::apiQuery($params, $returnProperties, NULL, NULL, 0, count($contactIDs), TRUE, FALSE, TRUE, CRM_Contact_BAO_Query::MODE_CONTACTS, NULL, TRUE);
- $contactDetails = &$details[0];
+ [$contactDetails] = CRM_Contact_BAO_Query::apiQuery($params, $returnProperties, NULL, NULL, 0, count($contactIDs), TRUE, FALSE, TRUE, CRM_Contact_BAO_Query::MODE_CONTACTS, NULL, TRUE);
foreach ($contactIDs as $contactID) {
if (array_key_exists($contactID, $contactDetails)) {
$tokens,
$className
);
- return $details;
+ return [$contactDetails];
}
/**
case 'net_amount':
case 'fee_amount':
case 'non_deductible_amount':
- $value = CRM_Utils_Money::format(CRM_Utils_Array::retrieveValueRecursive($contribution, $token));
+ // FIXME: Is this ever a multi-dimensional array? Why use retrieveValueRecursive()?
+ $amount = CRM_Utils_Array::retrieveValueRecursive($contribution, $token);
+ $currency = CRM_Utils_Array::retrieveValueRecursive($contribution, 'currency');
+ $value = CRM_Utils_Money::format($amount, $currency);
break;
case 'receive_date':
+ case 'receipt_date':
$value = CRM_Utils_Array::retrieveValueRecursive($contribution, $token);
- $value = CRM_Utils_Date::customFormat($value, NULL, ['j', 'm', 'Y']);
+ $config = CRM_Core_Config::singleton();
+ $value = CRM_Utils_Date::customFormat($value, $config->dateformatDatetime);
break;
default: