From d1d3b84f779c6d2874c1c33ed8ce67c286c2a489 Mon Sep 17 00:00:00 2001 From: Andrew Roth Date: Mon, 6 Dec 2021 10:27:58 -0500 Subject: [PATCH] Fixed #10365: Snipe-IT has a wrong total purchase cost when reaches million. Fixed to remove multiple commas in +1M per item. --- resources/views/partials/bootstrap-table.blade.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 6e69b9cc5..e304c8ce0 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -637,7 +637,7 @@ decimalfixed = periodless.replace(/,/g,"."); } else { // yank commas, that's it. - decimalfixed = number.toString().replace(",",""); + decimalfixed = number.toString().replace(/\,/g,""); } return parseFloat(decimalfixed); } @@ -646,8 +646,10 @@ if (Array.isArray(data)) { var field = this.field; var total_sum = data.reduce(function(sum, row) { + return (sum) + (cleanFloat(row[field]) || 0); }, 0); + return numberWithCommas(total_sum.toFixed(2)); } return 'not an array'; @@ -679,6 +681,7 @@ } function numberWithCommas(value) { + if ((value) && ("{{$snipeSettings->digit_separator}}" == "1.234,56")){ var parts = value.toString().split("."); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");