CRM-14442 - prevent presence of Direct Debit (payment_type=2) payment processors...
authorDave Greenberg <dave@civicrm.org>
Wed, 9 Apr 2014 19:05:27 +0000 (12:05 -0700)
committerDave Greenberg <dave@civicrm.org>
Wed, 9 Apr 2014 19:05:27 +0000 (12:05 -0700)
----------------------------------------
* CRM-14442:
  https://issues.civicrm.org/jira/browse/CRM-14442

CRM/Contribute/Form/AbstractEditPayment.php
CRM/Core/Payment.php

index 77592da41d23ee7d507427029174003a3004f74e..ae967c817cc2d8575f7f0575351aee02cbaa15c2 100644 (file)
@@ -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);
index 0ec1c5853242d4f27c95a2f5245dd8773cae32f7..c9e004ac2b8680fb2f100661c882afa899e4c3d0 100644 (file)
@@ -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;