Merge pull request #6082 from netchampfaris/int-control-fix

fix(Int control): Skip evaluating numbers with commas
This commit is contained in:
Faris Ansari 2018-09-12 10:57:20 +05:30 committed by GitHub
commit 9136df623e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,11 @@ frappe.ui.form.ControlInt = frappe.ui.form.ControlData.extend({
});
},
eval_expression: function(value) {
if (typeof value==='string' && value.match(/^[0-9+-/* ]+$/)) {
if (typeof value==='string'
&& value.match(/^[0-9+-/* ]+$/)
// strings with commas are evaluated incorrectly
// for e.g 47,186.00 -> 186
&& !value.includes(',')) {
try {
return eval(value);
} catch (e) {