Move form-specific early return to form
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 14 Aug 2023 00:13:41 +0000 (12:13 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 18 Aug 2023 00:32:09 +0000 (12:32 +1200)
CRM/Event/Form/Participant.php
CRM/Event/Form/Registration/Register.php

index 8829f46e6ae53d884e027491cde0dec22243cb75..31cc39e0660e1f7e381e42d5e66a97cd514e2718 100644 (file)
@@ -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)) {
index 98e12e1f13fdac0ce19236ae04e46a96d44336ba..58ec80251edc440e9281d06cf845d2b9a64ba3b4 100644 (file)
@@ -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)) {