From 7cc2faa561b2adabd853e7de5d7495ccdf28616f Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 22 Sep 2023 12:23:02 +1200 Subject: [PATCH] Stop assigning isPrimary at form layer Despite the comments we are actually leaning into isPrimary in the templates. However, the assigning of it is handlied in the Event_WorkflowMessage_ParticipantTrait - which looks up the value from the record. Note that there is some test cover of emails for mulitple participants --- CRM/Event/Form/Participant.php | 5 ----- CRM/Event/Form/ParticipantFeeSelection.php | 6 +----- CRM/Event/Form/Registration.php | 4 ---- CRM/Event/Form/Registration/Confirm.php | 4 ---- 4 files changed, 1 insertion(+), 18 deletions(-) diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 2881e299b4..6b58dfb24e 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -2096,11 +2096,6 @@ INNER JOIN civicrm_price_field_value value ON ( value.id = lineItem.price_field_ $notSent = []; $this->assign('module', 'Event Registration'); $this->assignEventDetailsToTpl($params['event_id'], CRM_Utils_Array::value('role_id', $params), CRM_Utils_Array::value('receipt_text', $params)); - // @todo - this is no longer in core templates as of 5.63 - // we should remove once we have done a 'push upgrade' on addresses - ie advised - // people to upgrade their templates in an upgrade message, as - // opposed to just updating unmodified templates. - $this->assign('isPrimary', (int) $this->_isPaidEvent); if ($this->_isPaidEvent) { $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument(); if (!$this->_mode) { diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php index 1bfe38dee8..5cb4dcb6a9 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -365,11 +365,7 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { $this->assign('totalAmount', $this->contributionAmt); $this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params)); } - // @todo isPrimary no longer used from 5.63 in core templates, remove - // once users have been 'pushed' to update their templates (via - // upgrade message - which we don't always do whenever we change - // a minor variable. - $this->assign('isPrimary', $this->_isPaidEvent); + $this->assign('register_date', $params['register_date']); // Retrieve the name and email of the contact - this will be the TO for receipt email diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 84f61d77b5..b34ed7dc8b 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -1636,9 +1636,6 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { foreach ($additionalIDs as $participantID => $contactId) { if ($participantID == $registerByID) { - //set as Primary Participant - $this->assign('isPrimary', 1); - $customProfile = CRM_Event_BAO_Event::buildCustomProfile($participantID, $this->_values, NULL, $isTest); if (count($customProfile)) { @@ -1647,7 +1644,6 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { } } else { - $this->assign('isPrimary', 0); $this->assign('customProfile', NULL); } diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 30161be569..7eec185f85 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -866,8 +866,6 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { foreach ($additionalIDs as $participantID => $contactId) { $participantNum = 0; if ($participantID == $registerByID) { - //set as Primary Participant - $this->assign('isPrimary', 1); //build an array of custom profile and assigning it to template. $customProfile = CRM_Event_BAO_Event::buildCustomProfile($participantID, $this->_values, NULL, $isTest); @@ -887,8 +885,6 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $participantParams = ['id' => $participantID]; CRM_Event_BAO_Participant::getValues($participantParams, $participantValues, $ids); $this->_values['participant'] = $participantValues[$participantID]; - - $this->assign('isPrimary', 0); $this->assign('customProfile', NULL); //Additional Participant should get only it's payment information if (!empty($this->_amount)) { -- 2.25.1