Skip to content

Commit

Permalink
Remove call to getTokenDetails
Browse files Browse the repository at this point in the history
This is tested vi CRM_Event_Form_Task_BatchTest::testSubmitCancel
  • Loading branch information
eileenmcnaughton committed Nov 4, 2021
1 parent c158e60 commit 943c6d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
14 changes: 3 additions & 11 deletions CRM/Event/BAO/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -1236,15 +1236,7 @@ public static function transitionParticipants(

//get all required contacts detail.
if (!empty($contactIds)) {
// get the contact details.
list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL,
FALSE, FALSE, NULL,
[],
'CRM_Event_BAO_Participant'
);
foreach ($currentContactDetails as $contactId => $contactValues) {
$contactDetails[$contactId] = $contactValues;
}
$contactDetails = civicrm_api3('Contact', 'get', ['id' => ['IN' => $contactIds, 'return' => 'display_name']])['values'];
}

//get all required events detail.
Expand Down Expand Up @@ -1312,7 +1304,7 @@ public static function transitionParticipants(
$mail = self::sendTransitionParticipantMail($additionalId,
$participantDetails[$additionalId],
$eventDetails[$participantDetails[$additionalId]['event_id']],
$contactDetails[$participantDetails[$additionalId]['contact_id']],
NULL,
$emailType
);

Expand All @@ -1331,7 +1323,7 @@ public static function transitionParticipants(
$mail = self::sendTransitionParticipantMail($participantId,
$participantValues,
$eventDetails[$participantValues['event_id']],
$contactDetails[$participantValues['contact_id']],
NULL,
$emailType
);

Expand Down
5 changes: 4 additions & 1 deletion CRM/Utils/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,8 @@ public static function getReturnProperties(&$string) {
}

/**
* Do not use this function.
*
* Gives required details of contacts in an indexed array format so we
* can iterate in a nice loop and do token evaluation
*
Expand All @@ -1152,6 +1154,8 @@ public static function getReturnProperties(&$string) {
* @param int|null $jobID
* The mailing list jobID - this is a legacy param.
*
* @deprecated
*
* @return array - e.g [[1 => ['first_name' => 'bob'...], 34 => ['first_name' => 'fred'...]]]
*/
public static function getTokenDetails(
Expand All @@ -1164,7 +1168,6 @@ public static function getTokenDetails(
$className = NULL,
$jobID = NULL
) {

$params = [];
foreach ($contactIDs as $contactID) {
$params[] = [
Expand Down

0 comments on commit 943c6d0

Please sign in to comment.