[reviewed, pending rebase] CRM-20703 - Event Contribution Created When No Payment...
authorYashodha Chaku <yashodha@cividesk.com>
Thu, 26 Jul 2018 03:12:44 +0000 (08:42 +0530)
committerEileen McNaughton <eileen@mcnaughty.com>
Thu, 26 Jul 2018 03:12:44 +0000 (15:12 +1200)
* CRM-20703 - Event Contribution Created When No Payment Option Provided

* throw form rule when amount block is active

CRM/Contribute/Form/ContributionPage/Amount.php
CRM/Event/Form/ManageEvent/Fee.php

index fc6486c24fd91fde50f3b44ee9344c50f4f56519..ef174d9405260dbd712ee461f06617d9742ba60b 100644 (file)
@@ -372,6 +372,11 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
         $errors['pay_later_receipt'] = ts('Please enter the instructions to be sent to the contributor when they choose to \'pay later\'.');
       }
     }
+    else {
+      if ($fields['amount_block_is_active'] && empty($fields['payment_processor'])) {
+        $errors['payment_processor'] = ts('You have listed fixed contribution options or selected a price set, but no payment option has been selected. Please select at least one payment processor and/or enable the pay later option.');
+      }
+    }
 
     // don't allow price set w/ membership signup, CRM-5095
     if ($priceSetId = CRM_Utils_Array::value('price_set_id', $fields)) {
index aea1485120084e3a4a889242448bcc23a8c3e4f2..cbd038756d79dcd9f5bccdc443421785985abf7d 100644 (file)
@@ -522,6 +522,11 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
           $errors['pay_later_receipt'] = ts('Please enter the Pay Later instructions to be displayed to your users.');
         }
       }
+      else {
+        if (empty($values['payment_processor'])) {
+          $errors['payment_processor'] = ts('You have indicated that this is a paid event, but no payment option has been selected. If this is not a paid event, please select the "No" option at the top of the page. If this is a paid event, please select at least one payment processor and/or enable the pay later option.');
+        }
+      }
     }
     return empty($errors) ? TRUE : $errors;
   }