From 943c6d0cf5da1efccd71784ff63708cb38a88727 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 4 Nov 2021 10:27:16 +1300 Subject: [PATCH] Remove call to getTokenDetails This is tested vi CRM_Event_Form_Task_BatchTest::testSubmitCancel --- CRM/Event/BAO/Participant.php | 14 +++----------- CRM/Utils/Token.php | 5 ++++- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index d72012f5c1..618927d8c5 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -1236,15 +1236,7 @@ UPDATE civicrm_participant //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. @@ -1312,7 +1304,7 @@ UPDATE civicrm_participant $mail = self::sendTransitionParticipantMail($additionalId, $participantDetails[$additionalId], $eventDetails[$participantDetails[$additionalId]['event_id']], - $contactDetails[$participantDetails[$additionalId]['contact_id']], + NULL, $emailType ); @@ -1331,7 +1323,7 @@ UPDATE civicrm_participant $mail = self::sendTransitionParticipantMail($participantId, $participantValues, $eventDetails[$participantValues['event_id']], - $contactDetails[$participantValues['contact_id']], + NULL, $emailType ); diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index bd927721ba..1ab9cc2dbf 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -1134,6 +1134,8 @@ class CRM_Utils_Token { } /** + * 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 * @@ -1152,6 +1154,8 @@ class CRM_Utils_Token { * @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( @@ -1164,7 +1168,6 @@ class CRM_Utils_Token { $className = NULL, $jobID = NULL ) { - $params = []; foreach ($contactIDs as $contactID) { $params[] = [ -- 2.25.1