mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
Fixed #10365: Snipe-IT has a wrong total purchase cost when reaches million. Fixed to remove multiple commas in +1M per item.
This commit is contained in:
parent
cae62fd4c7
commit
d1d3b84f77
|
@ -637,7 +637,7 @@
|
||||||
decimalfixed = periodless.replace(/,/g,".");
|
decimalfixed = periodless.replace(/,/g,".");
|
||||||
} else {
|
} else {
|
||||||
// yank commas, that's it.
|
// yank commas, that's it.
|
||||||
decimalfixed = number.toString().replace(",","");
|
decimalfixed = number.toString().replace(/\,/g,"");
|
||||||
}
|
}
|
||||||
return parseFloat(decimalfixed);
|
return parseFloat(decimalfixed);
|
||||||
}
|
}
|
||||||
|
@ -646,8 +646,10 @@
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
var field = this.field;
|
var field = this.field;
|
||||||
var total_sum = data.reduce(function(sum, row) {
|
var total_sum = data.reduce(function(sum, row) {
|
||||||
|
|
||||||
return (sum) + (cleanFloat(row[field]) || 0);
|
return (sum) + (cleanFloat(row[field]) || 0);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
return numberWithCommas(total_sum.toFixed(2));
|
return numberWithCommas(total_sum.toFixed(2));
|
||||||
}
|
}
|
||||||
return 'not an array';
|
return 'not an array';
|
||||||
|
@ -679,6 +681,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function numberWithCommas(value) {
|
function numberWithCommas(value) {
|
||||||
|
|
||||||
if ((value) && ("{{$snipeSettings->digit_separator}}" == "1.234,56")){
|
if ((value) && ("{{$snipeSettings->digit_separator}}" == "1.234,56")){
|
||||||
var parts = value.toString().split(".");
|
var parts = value.toString().split(".");
|
||||||
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||||
|
|
Loading…
Reference in a new issue