Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Francis (Agileware)
mjwshared
Commits
5cbb6625
Commit
5cbb6625
authored
Mar 03, 2021
by
Francis (Agileware)
Browse files
Parse through thousands separators in calculateTaxAmount. Refs #7
parent
8be89671
Changes
1
Hide whitespace changes
Inline
Side-by-side
js/crm.payment.js
View file @
5cbb6625
...
...
@@ -58,7 +58,15 @@
}
else
{
// 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
;
},
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment