Preliminary cleanup for Custom data support for MembershipType form
authorMatthew Wire <devel@mrwire.co.uk>
Sun, 6 May 2018 17:10:02 +0000 (18:10 +0100)
committereileen <emcnaughton@wikimedia.org>
Mon, 14 May 2018 02:54:43 +0000 (14:54 +1200)
CRM/Core/Payment.php
CRM/Financial/BAO/PaymentProcessor.php
CRM/Member/Form/MembershipType.php

index a4192ac9fd20b49805b6d0019861e9357e4ba50d..202e3fe729d865bcfdb7dc34bf7f752ca24471cd 100644 (file)
@@ -1542,6 +1542,18 @@ INNER JOIN civicrm_contribution con ON ( con.contribution_recur_id = rec.id )
     return FALSE;
   }
 
+  /**
+   * Checks if payment processor supports recurring contributions
+   *
+   * @return bool
+   */
+  public function supportsRecurring() {
+    if (!empty($this->_paymentProcessor['is_recur'])) {
+      return TRUE;
+    }
+    return FALSE;
+  }
+
   /**
    * Should a receipt be sent out for a pending payment.
    *
index 86addccd3e950f3856a6a314d652127c7ffe46bd..3054bb464989e11fb7ce2c35a8ea0af17a533842 100644 (file)
@@ -422,6 +422,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
    *  - supportsBackOffice
    *  - supportsLiveMode
    *  - supportsFutureRecurDate
+   *  - supportsRecurring
    *  - supportsCancelRecurring
    *  - supportsRecurContributionsForPledges
    *
index 2de58a9c4cd80dbce68378ba3c43b08b4d15316c..a325e3df0fe807f9dabb15d44ab43fa1b898ae46 100644 (file)
@@ -149,11 +149,10 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form_MembershipConfig {
       CRM_Core_SelectValues::date(NULL, 'M d'), FALSE
     );
 
-    // Auto-renew Option
-    $paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1');
+    // Add Auto-renew options if we have a payment processor that supports recurring contributions
     $isAuthorize = FALSE;
     $options = array();
-    if (is_array($paymentProcessor) && !empty($paymentProcessor)) {
+    if (CRM_Financial_BAO_PaymentProcessor::hasPaymentProcessorSupporting(array('Recurring'))) {
       $isAuthorize = TRUE;
       $options = CRM_Core_SelectValues::memberAutoRenew();
     }