Move the bounce to the start of the form submit
authoreileen <emcnaughton@wikimedia.org>
Sat, 18 Jan 2020 07:30:01 +0000 (20:30 +1300)
committereileen <emcnaughton@wikimedia.org>
Sat, 18 Jan 2020 22:15:38 +0000 (11:15 +1300)
CRM/Event/Form/Participant.php

index bcd441f278d909652da1804abb68b471a4d48e81..78362d7c87dcb09cb738de6786ece295be5a5223 100644 (file)
@@ -971,6 +971,9 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
    * @throws \CiviCRM_API3_Exception
    */
   public function submit($params) {
+    if ($this->_mode && !$this->_isPaidEvent) {
+      CRM_Core_Error::statusBounce(ts('Selected Event is not Paid Event '));
+    }
     $participantStatus = CRM_Event_PseudoConstant::participantStatus();
     // set the contact, when contact is selected
     if (!empty($params['contact_id'])) {
@@ -1023,9 +1026,6 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
     $now = date('YmdHis');
 
     if ($this->_mode) {
-      if (!$this->_isPaidEvent) {
-        CRM_Core_Error::statusBounce(ts('Selected Event is not Paid Event '));
-      }
 
       $eventTitle
         = CRM_Core_DAO::getFieldValue(