From: Matthew Wire Date: Sun, 6 May 2018 17:10:02 +0000 (+0100) Subject: Preliminary cleanup for Custom data support for MembershipType form X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=54afd8a6d1f663483f2909e303afbcef42ae9384;p=civicrm-core.git Preliminary cleanup for Custom data support for MembershipType form --- diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index a4192ac9fd..202e3fe729 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -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. * diff --git a/CRM/Financial/BAO/PaymentProcessor.php b/CRM/Financial/BAO/PaymentProcessor.php index 86addccd3e..3054bb4649 100644 --- a/CRM/Financial/BAO/PaymentProcessor.php +++ b/CRM/Financial/BAO/PaymentProcessor.php @@ -422,6 +422,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces * - supportsBackOffice * - supportsLiveMode * - supportsFutureRecurDate + * - supportsRecurring * - supportsCancelRecurring * - supportsRecurContributionsForPledges * diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php index 2de58a9c4c..a325e3df0f 100644 --- a/CRM/Member/Form/MembershipType.php +++ b/CRM/Member/Form/MembershipType.php @@ -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(); }