From 1193f90602292385a32b39d62db7b9ea578813b9 Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Wed, 9 Apr 2014 12:05:27 -0700 Subject: [PATCH] CRM-14442 - prevent presence of Direct Debit (payment_type=2) payment processors from breaking the back-office Submit Credit Card Contribution form. ---------------------------------------- * CRM-14442: https://issues.civicrm.org/jira/browse/CRM-14442 --- CRM/Contribute/Form/AbstractEditPayment.php | 3 ++- CRM/Core/Payment.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php index 77592da41d..ae967c817c 100644 --- a/CRM/Contribute/Form/AbstractEditPayment.php +++ b/CRM/Contribute/Form/AbstractEditPayment.php @@ -315,7 +315,8 @@ LEFT JOIN civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co */ public function getValidProcessorsAndAssignFutureStartDate() { $validProcessors = array(); - $processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, "billing_mode IN ( 1, 3 )"); + // restrict to payment_type = 1 (credit card only) and billing mode 1 and 3 + $processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, "billing_mode IN ( 1, 3 ) AND payment_type = 1"); foreach ($processors as $ppID => $label) { $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($ppID, $this->_mode); diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index 0ec1c58532..c9e004ac2b 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -376,8 +376,9 @@ INNER JOIN civicrm_contribution con ON ( con.contribution_recur_id = rec.id ) */ static function allowBackofficeCreditCard($template = NULL, $variableName = 'newCredit') { $newCredit = FALSE; + // restrict to type=1 (credit card) payment processor payment_types and only include billing mode types 1 and 3 $processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, - "billing_mode IN ( 1, 3 )" + "billing_mode IN ( 1, 3 ) AND payment_type = 1" ); if (count($processors) > 0) { $newCredit = TRUE; -- 2.25.1