Commit 5cbb6625 authored by Francis (Agileware)'s avatar Francis (Agileware)
Browse files

Parse through thousands separators in calculateTaxAmount. Refs #7

parent 8be89671
...@@ -58,7 +58,15 @@ ...@@ -58,7 +58,15 @@
} }
else { else {
// Otherwise totalTaxAmount div contains a textual amount including currency symbol // Otherwise totalTaxAmount div contains a textual amount including currency symbol
totalTaxAmount = document.getElementById('totalTaxAmount').textContent.split(' ').pop();
// Use the "separator" variable declared in Contribution.tpl or default to . for decimal point
var dPoint = (typeof separator !== 'undefined') && separator || '.';
// Regular expression to comb for numeric parts of the totalTaxAmount div.
var matcher = new RegExp('\\d{1,3}(' + dPoint.replace(/\W/g, '\\$&') + '\\d{0,2})?', 'g');
// Join all parts and ensure the decimal point is per javascript format.
totalTaxAmount = document.getElementById('totalTaxAmount').textContent.match(matcher).join('').replace(dPoint, '.');
} }
return totalTaxAmount; return totalTaxAmount;
}, },
......
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