From ed90204fdd852073c9edc4b5cbd2a9cdbc2377de Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 23 Sep 2023 09:32:25 +1200 Subject: [PATCH] Stop sharing EventFee::preProcess from Registration form Most of what this function does is silly. In particular it sets the undeclared & not relevant _fromEmails property. This also adds our standardised function to the online event forms. All event-related forms should wind up with this public supported function (along with an approprite mix of getParticipantID, getPriceSetID, getDiscountID Fix undefined property on fromEmails for Participant fee --- CRM/Event/Form/Registration/Register.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index faec4b6131..8694361327 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -189,7 +189,26 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { // get the participant values from EventFees.php, CRM-4320 if ($this->_allowConfirmation) { - CRM_Event_Form_EventFees::preProcess($this); + $this->eventFeeWrangling($this); + } + } + + /** + * This is previously shared code which is probably of little value. + * + * @param CRM_Core_Form $form + * + * @throws \CRM_Core_Exception + */ + private function eventFeeWrangling($form) { + $form->_pId = CRM_Utils_Request::retrieve('participantId', 'Positive', $form); + $form->_discountId = CRM_Utils_Request::retrieve('discountId', 'Positive', $form); + + //CRM-6907 set event specific currency. + if ($this->getEventID() && + ($currency = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $form->_eventId, 'currency')) + ) { + CRM_Core_Config::singleton()->defaultCurrency = $currency; } } -- 2.25.1