From 8ecee4f7600886ed0c0cfdea3c27c62c5930c72b Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 14 Aug 2023 12:13:41 +1200 Subject: [PATCH] Move form-specific early return to form --- CRM/Event/Form/Participant.php | 9 ++++++++- CRM/Event/Form/Registration/Register.php | 7 ------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 8829f46e6a..31cc39e066 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1429,7 +1429,14 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment //retrieve custom information $form->_values = []; CRM_Event_Form_Registration::initEventFee($form, $event['id'], FALSE, $form->getDiscountID()); - CRM_Event_Form_Registration_Register::buildAmount($form, TRUE, $form->getDiscountID()); + //if payment done, no need to build the fee block. + if (!empty($form->_paymentId)) { + //fix to display line item in update mode. + $form->assign('priceSet', $form->_priceSet ?? NULL); + } + else { + CRM_Event_Form_Registration_Register::buildAmount($form, TRUE, $form->getDiscountID()); + } $lineItem = []; $totalTaxAmount = 0; if (!CRM_Utils_System::isNull($form->_values['line_items'] ?? NULL)) { diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 98e12e1f13..58ec80251e 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -546,13 +546,6 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { * @throws \CRM_Core_Exception */ public static function buildAmount(&$form, $required = TRUE, $discountId = NULL) { - //if payment done, no need to build the fee block. - if (!empty($form->_paymentId)) { - //fix to display line item in update mode. - $form->assign('priceSet', $form->_priceSet ?? NULL); - return; - } - $feeFields = $form->_values['fee'] ?? NULL; if (is_array($feeFields)) { -- 2.25.1