Skip to content
Snippets Groups Projects
Commit 9c7df627 authored by mattwire's avatar mattwire
Browse files

js cleanup

parent 910de8d3
No related branches found
No related tags found
1 merge request!90.9
......@@ -18,21 +18,21 @@
this.debugging(this.scriptName, 'Calculated amount using internal calculateTaxAmount()');
}
else if (typeof calculateTotalFee == 'function') {
// This is ONLY triggered in the following circumstances on a CiviCRM contribution page:
// - With a priceset that allows a 0 amount to be selected.
// - When Stripe is the ONLY payment processor configured on the page.
totalFee = parseFloat(calculateTotalFee());
}
else if (this.getIsDrupalWebform()) {
// This is how webform civicrm calculates the amount in webform_civicrm_payment.js
$('.line-item:visible', '#wf-crm-billing-items').each(function() {
totalFee += parseFloat($(this).data('amount'));
});
}
else if (document.getElementById('total_amount')) {
// The input#total_amount field exists on backend contribution forms
totalFee = parseFloat(document.getElementById('total_amount').value);
}
// This is ONLY triggered in the following circumstances on a CiviCRM contribution page:
// - With a priceset that allows a 0 amount to be selected.
// - When Stripe is the ONLY payment processor configured on the page.
totalFee = parseFloat(calculateTotalFee());
}
else if (this.getIsDrupalWebform()) {
// This is how webform civicrm calculates the amount in webform_civicrm_payment.js
$('.line-item:visible', '#wf-crm-billing-items').each(function() {
totalFee += parseFloat($(this).data('amount'));
});
}
else if (document.getElementById('total_amount')) {
// The input#total_amount field exists on backend contribution forms
totalFee = parseFloat(document.getElementById('total_amount').value);
}
this.debugging(this.scriptName, 'getTotalAmount: ' + totalFee);
return totalFee;
},
......@@ -117,8 +117,8 @@
isRecur = Boolean(document.getElementById('is_recur').checked);
}
}
// Auto-renew memberships
// This gets messy quickly!
// Auto-renew memberships
// This gets messy quickly!
// 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) {
if ($('input[name="auto_renew"]').prop('checked')) {
......@@ -138,8 +138,7 @@
return isRecur;
},
/**
/**
* Output debug information
* @param {string} scriptName
* @param {string} errorCode
......@@ -149,7 +148,7 @@
if ((typeof(CRM.vars.stripe) === 'undefined') || (Boolean(CRM.vars.stripe.jsDebug) === true)) {
console.log(new Date().toISOString() + ' ' + scriptName + ': ' + errorCode);
}
},
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment