Commit 3ca31b76 authored by mattwire's avatar mattwire
Browse files

Add supportsRecur() function to CRM.payment

parent a444f2e3
......@@ -170,6 +170,33 @@
return isRecur;
},
/**
* Does the form support recurring contributions?
* @returns {boolean}
*/
supportsRecur: function() {
var supportsRecur = false;
// Auto-renew contributions for CiviCRM Webforms.
if (this.getIsDrupalWebform()) {
if (($('input[data-civicrm-field-key$="contribution_installments"]').length !== 0) ||
($('input[data-civicrm-field-key$="contribution_frequency_interval"]').length !== 0)
) {
supportsRecur = true;
}
}
// Auto-renew contributions
if (document.getElementById('is_recur') !== null) {
supportsRecur = true;
}
// Auto-renew memberships
// input[name="auto_renew"] : set to 1 when there is a force-renew membership with no priceset.
else if ($('input[name="auto_renew"]').length !== 0) {
supportsRecur = true;
}
this.debugging(this.scriptName, 'supportsRecur is ' + supportsRecur);
return supportsRecur;
},
/**
* Try and get the billing email(s) from the form
* @returns {string} separated by ;
......@@ -196,13 +223,13 @@
*/
getPaymentProcessorSelectorValue: function() {
// Frontend radio selector
var paymentProcessorSelected = form.querySelector('input[name="payment_processor_id"]:checked');
var paymentProcessorSelected = this.form.querySelector('input[name="payment_processor_id"]:checked');
if (paymentProcessorSelected !== null) {
return parseInt(paymentProcessorSelected.value);
}
else {
// Backend select dropdown
paymentProcessorSelected = form.querySelector('select[name="payment_processor_id"]');
paymentProcessorSelected = this.form.querySelector('select[name="payment_processor_id"]');
if (paymentProcessorSelected !== null) {
return parseInt(paymentProcessorSelected.value);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment