Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2021-08-18 14:31:53 -07:00
commit 24af2ab67a
4 changed files with 24 additions and 7 deletions

View file

@ -67,7 +67,7 @@ class Helper
{
$colors = [
"#008941",
"#FF4A46",
"#FF851B",
"#006FA6",
"#A30059",
"#1CE6FF",

View file

@ -176,7 +176,6 @@ class StatuslabelsController extends Controller
foreach ($statuslabels as $statuslabel) {
if ($statuslabel->assets_count > 0) {
$labels[]=$statuslabel->name. ' ('.number_format($statuslabel->assets_count).')';
$points[]=$statuslabel->assets_count;
@ -184,8 +183,8 @@ class StatuslabelsController extends Controller
$colors_array[] = $statuslabel->color;
} else {
$colors_array[] = Helper::defaultChartColors($default_color_count);
$default_color_count++;
}
$default_color_count++;
}
}

View file

@ -282,9 +282,15 @@ class UsersController extends Controller
$user = User::findOrFail($id);
// This is a janky hack to prevent people from changing admin demo user data on the public demo.
// The $ids 1 and 2 are special since they are seeded as superadmins in the demo seeder.
// Thanks, jerks. You are why we can't have nice things. - snipe
/**
* This is a janky hack to prevent people from changing admin demo user data on the public demo.
*
* The $ids 1 and 2 are special since they are seeded as superadmins in the demo seeder.
*
* Thanks, jerks. You are why we can't have nice things. - snipe
*
*/
if ((($id == 1) || ($id == 2)) && (config('app.lock_passwords'))) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'Permission denied. You cannot update user information via API on the demo.'));

View file

@ -595,11 +595,23 @@
}
}
function cleanFloat(number) {
if ("{{$snipeSettings->digit_separator}}" == "1.234,56") {
// yank periods, change commas to periods
periodless = number.toString().replace("\.","");
decimalfixed = periodless.replace(",",".");
} else {
// yank commas, that's it.
decimalfixed = number.toString().replace(",","");
}
return parseFloat(decimalfixed);
}
function sumFormatter(data) {
if (Array.isArray(data)) {
var field = this.field;
var total_sum = data.reduce(function(sum, row) {
return (sum) + (parseFloat(row[field]) || 0);
return (sum) + (cleanFloat(row[field]) || 0);
}, 0);
return numberWithCommas(total_sum.toFixed(2));
}