From 9f7e7cd2e9689890f2d7ee6c59a969aaa4950cab Mon Sep 17 00:00:00 2001 From: Alice Frumin Date: Wed, 2 Mar 2022 13:58:50 -0500 Subject: [PATCH 1/2] Add event id to template params so it can be received by altermailparams --- CRM/Event/Form/Participant.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index e99eb186dfed..2cf735ba43a1 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1517,12 +1517,23 @@ public function submit($params) { $this->assign('amount', $eventAmount); } + // Assemble event info to send to the message template + $eventDetails = []; + $eventParams = ['id' => $params['event_id']]; + CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails); + CRM_Event_BAO_Event::setOutputTimeZone($eventDetails); + + $tplParams = [ + 'event' => $eventDetails, + ]; + $sendTemplateParams = [ 'groupName' => 'msg_tpl_workflow_event', 'valueName' => 'event_offline_receipt', 'contactId' => $contactID, 'isTest' => !empty($this->_defaultValues['is_test']), 'PDFFilename' => ts('confirmation') . '.pdf', + 'tplParams' => $tplParams, ]; // try to send emails only if email id is present From 600d04bfb4fd41e5ebe461686fc8b8907b7d1e58 Mon Sep 17 00:00:00 2001 From: Alice Frumin Date: Thu, 3 Mar 2022 16:19:06 -0500 Subject: [PATCH 2/2] use tokenContext instead of tplParams --- CRM/Event/Form/Participant.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 2cf735ba43a1..4a6888bb469f 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1517,23 +1517,13 @@ public function submit($params) { $this->assign('amount', $eventAmount); } - // Assemble event info to send to the message template - $eventDetails = []; - $eventParams = ['id' => $params['event_id']]; - CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails); - CRM_Event_BAO_Event::setOutputTimeZone($eventDetails); - - $tplParams = [ - 'event' => $eventDetails, - ]; - $sendTemplateParams = [ 'groupName' => 'msg_tpl_workflow_event', 'valueName' => 'event_offline_receipt', 'contactId' => $contactID, 'isTest' => !empty($this->_defaultValues['is_test']), 'PDFFilename' => ts('confirmation') . '.pdf', - 'tplParams' => $tplParams, + 'tokenContext' => ['eventId' => $params['event_id'], 'participantId' => $this->_id], ]; // try to send emails only if email id is present