From 986905f5090d3f694348dac58d3fdb929a04cc77 Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 11 Nov 2015 20:43:33 -0800 Subject: [PATCH] CRM-CRM-17539, CRM-16929 make payment_method optional for /bin/bash value --- CRM/Contribute/Form/Contribution/Main.php | 4 ++-- CRM/Core/Payment/ProcessorForm.php | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 16f245cd4e..301c1cc963 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -905,8 +905,8 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu return $errors; } - if (CRM_Utils_Array::value('payment_method', $fields) == NULL) { - $errors['payment_method'] = ts('Payment Method is a required field.'); + if (CRM_Utils_Array::value('payment_processor_id', $fields) == NULL) { + $errors['payment_processor_id'] = ts('Payment Method is a required field.'); } else { CRM_Core_Payment_Form::validatePaymentInstrument( diff --git a/CRM/Core/Payment/ProcessorForm.php b/CRM/Core/Payment/ProcessorForm.php index 86706dd81b..dd493be0bc 100644 --- a/CRM/Core/Payment/ProcessorForm.php +++ b/CRM/Core/Payment/ProcessorForm.php @@ -57,6 +57,10 @@ class CRM_Core_Payment_ProcessorForm { $form->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($form->_type, $form->_mode); } + if (empty($form->_paymentProcessor)) { + // This would happen when hitting the back-button on a multi-page form with a $0 selection in play. + return; + } $form->set('paymentProcessor', $form->_paymentProcessor); $form->_paymentObject = Civi\Payment\System::singleton()->getByProcessor($form->_paymentProcessor); -- 2.25.1