// (i.e., the amount NOT associated with the membership). Temporarily
// cache the is_recur values so we can process the additional gift as a
// one-off payment.
- if ($form->_membershipBlock['is_separate_payment']) {
+ if ($form->_membershipBlock['is_separate_payment'] && !empty($form->_params['auto_renew'])) {
$cachedFormValue = CRM_Utils_Array::value('is_recur', $form->_values);
- unset($form->_values['is_recur']);
$cachedParamValue = CRM_Utils_Array::value('is_recur', $paymentParams);
+ unset($form->_values['is_recur']);
unset($paymentParams['is_recur']);
}
);
// restore cached values (part of fix for CRM-14354)
- if ($form->_membershipBlock['is_separate_payment']) {
+ if (!empty($cachedFormValue)) {
$form->_values['is_recur'] = $cachedFormValue;
$paymentParams['is_recur'] = $cachedParamValue;
}
if ($membershipBlock->is_separate_payment && empty($fields['amount_block_is_active'])) {
$errors['amount_block_is_active'] = ts('To disable Contribution Amounts section you need to first disable Separate Membership Payment option from Membership Settings.');
}
+
+ //CRM-16165, Don't allow reccuring contribution if membership block contain any renewable membership option
+ $membershipTypes = unserialize($membershipBlock->membership_types);
+ if (!empty($fields['is_recur']) && !empty($membershipTypes) && count(array_filter($membershipTypes)) != 0) {
+ $errors['is_recur'] = ts('You cannot enable both Recurring Contributions and Auto-renew memberships on the same online contribution page.');
+ }
}
//check for the amount label (mandatory)
if ($isProcessSeparateMembershipTransaction) {
try {
$lineItems = $form->_lineItem = $membershipLineItems;
+ if (empty($form->_params['auto_renew']) && !empty($membershipParams['is_recur'])) {
+ unset($membershipParams['is_recur']);
+ }
$membershipContribution = self::processSecondaryFinancialTransaction($contactID, $form, $membershipParams, $isTest, $membershipLineItems, CRM_Utils_Array::value('minimum_fee', $membershipDetails, 0), CRM_Utils_Array::value('financial_type_id', $membershipDetails));
}
catch (CRM_Core_Exception $e) {