From 8b05b0b16b321d940412f64c8f1b54fd4a60c139 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 14 Dec 2023 16:33:51 +1300 Subject: [PATCH] Fully remove interaction with _params from participant form This removes the last places _params was accessed & adds a __get for any external access to it Note this also removes the expiry date from the template. I can't find the discussion we had about this (maybe on chat) but it was generally agreed that since we hadn't added a column for this in the DB it made sense to exclude from the template (as the template should be the same however it is sent). There was some difference of opinion about whether it should have stored in the DB though --- CRM/Event/Form/Participant.php | 23 ++++++++----------- .../event_offline_receipt_html.tpl | 1 - 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 6c7dd7c9a9..642dcfdff7 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -820,10 +820,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment * Process the form submission. */ public function postProcess() { - // get the submitted form values. - $params = $this->controller->exportValues($this->_name); - - $statusMsg = $this->submit($params); + $statusMsg = $this->submit($this->getSubmittedValues()); CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success'); $session = CRM_Core_Session::singleton(); $buttonName = $this->controller->getButtonName(); @@ -862,7 +859,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment * @return string * @throws \CRM_Core_Exception */ - public function submit($params) { + public function submit(array $params) { if ($this->_mode && !$this->_isPaidEvent) { CRM_Core_Error::statusBounce(ts('Selected Event is not Paid Event ')); } @@ -876,16 +873,16 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $params['id'] = $this->_id; } - $config = CRM_Core_Config::singleton(); - if (isset($params['total_amount'])) { - $params['total_amount'] = CRM_Utils_Rule::cleanMoney($params['total_amount']); - } if ($this->_isPaidEvent) { [$lineItem, $params] = $this->preparePaidEventProcessing($params); } - + // @todo - params is unused - remove in favour of __get + // but there is another parameter we need to fix first. $this->_params = $params; - parent::beginPostProcess(); + // @todo - stop assigning these - pass financial_trxnId in token context + // and swap template to use tokens. + $this->assign('credit_card_type', $this->getSubmittedValue('credit_card_type')); + $this->assign('credit_card_number', CRM_Utils_System::mungeCreditCard($this->getSubmittedValue('credit_card_number'))); $amountOwed = NULL; if (isset($params['amount'])) { $amountOwed = $params['amount']; @@ -1079,8 +1076,8 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment } } - if (!empty($this->_params['tax_amount'])) { - $contributionParams['tax_amount'] = $this->_params['tax_amount']; + if (!empty($params['tax_amount'])) { + $contributionParams['tax_amount'] = $params['tax_amount']; } if ($this->_single) { diff --git a/xml/templates/message_templates/event_offline_receipt_html.tpl b/xml/templates/message_templates/event_offline_receipt_html.tpl index 7b14fdd5b7..e2f07e2bdb 100644 --- a/xml/templates/message_templates/event_offline_receipt_html.tpl +++ b/xml/templates/message_templates/event_offline_receipt_html.tpl @@ -404,7 +404,6 @@ {$credit_card_type}
{$credit_card_number}
- {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate} {/if} -- 2.25.1