Commit d52fd9c0 authored by mattwire's avatar mattwire
Browse files

Replace core calculateTotalFee() with our own (https://github.com/civicrm/civicrm-core/pull/22759)

parent 0c0494c4
......@@ -12,25 +12,27 @@
*/
getTotalAmount: function() {
var totalAmount = 0.0;
if (CRM.payment.isEventAdditionalParticipants()) {
if (this.isEventAdditionalParticipants()) {
// We MUST return null because 0.0 is treated as a non-processor submit.
// In this case the amount is not 0, we just don't know what it is yet.
totalAmount = null;
}
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() {
totalAmount += parseFloat($(this).data('amount'));
});
}
else if (document.getElementById('totalTaxAmount') !== null) {
totalAmount = parseFloat(this.calculateTaxAmount());
this.debugging(this.name, 'Calculated amount using internal calculateTaxAmount()');
}
else if (typeof calculateTotalFee == 'function') {
else if ($("#priceset [price]").length > 0) {
// 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 we are the ONLY payment processor configured on the page.
totalAmount = 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() {
totalAmount += parseFloat($(this).data('amount'));
$("#priceset [price]").each(function () {
totalAmount = totalAmount + $(this).data('line_raw_total');
});
}
else if (document.getElementById('total_amount')) {
......
Supports Markdown
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