From f380da3f1914fd764c8c126454f14bfb25341ae0 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 28 Sep 2021 16:45:47 -0700 Subject: [PATCH] Try to ensure all currency output is formatted correctly. --- app/Http/Controllers/ReportsController.php | 2 +- config/app.php | 1 + .../views/asset_maintenances/view.blade.php | 2 +- resources/views/hardware/qr-view.blade.php | 447 ------------------ resources/views/hardware/view.blade.php | 4 +- resources/views/suppliers/view.blade.php | 4 +- resources/views/users/view.blade.php | 6 +- 7 files changed, 10 insertions(+), 456 deletions(-) delete mode 100644 resources/views/hardware/qr-view.blade.php diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index a8c38d77ab..45806435e6 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -559,7 +559,7 @@ class ReportsController extends Controller foreach ($customfields as $customfield) { - if (e($request->input($customfield->db_column_name())) == '1') { + if ($request->input($customfield->db_column_name()) == '1') { $header[] = $customfield->name; } } diff --git a/config/app.php b/config/app.php index 55184884dc..555be910cc 100755 --- a/config/app.php +++ b/config/app.php @@ -407,6 +407,7 @@ return [ 'Google2FA' => PragmaRX\Google2FALaravel\Facade::class, 'Image' => Intervention\Image\ImageServiceProvider::class, 'Carbon' => Carbon\Carbon::class, + 'Helper' => App\Helpers\Helper::class, // makes it much easier to use 'Helper::blah' in blades (which is where we usually use this) ], diff --git a/resources/views/asset_maintenances/view.blade.php b/resources/views/asset_maintenances/view.blade.php index 13506eeb4b..cea5eb2c04 100644 --- a/resources/views/asset_maintenances/view.blade.php +++ b/resources/views/asset_maintenances/view.blade.php @@ -81,7 +81,7 @@ use Carbon\Carbon;
{{ trans('admin/asset_maintenances/form.cost') }}: - {{ sprintf( trans( 'general.currency' ) . '%01.2f', $assetMaintenance->cost) }} + {{ trans( 'general.currency' ) . Helper::formatCurrencyOutput($assetMaintenance->cost) }}
{{ trans('admin/asset_maintenances/form.is_warranty') }}: diff --git a/resources/views/hardware/qr-view.blade.php b/resources/views/hardware/qr-view.blade.php deleted file mode 100644 index 7b6d3eb83b..0000000000 --- a/resources/views/hardware/qr-view.blade.php +++ /dev/null @@ -1,447 +0,0 @@ -@extends('layouts/default') - -{{-- Page title --}} -@section('title') -{{ trans('admin/hardware/general.view') }} {{ $asset->asset_tag }} -@parent -@stop - -{{-- Page content --}} -@section('content') - -
-
-

- {{ trans('admin/hardware/general.view') }} - {{ $asset->asset_tag }} - @if ($asset->name) - ({{ $asset->name }}) - @endif -

- -
- -
-
-
- - - - - - -@stop diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index c5feb06c57..7caa1ef57c 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -874,7 +874,7 @@ {{ $component->name }} {{ $component->pivot->assigned_qty }} - {{ $component->purchase_cost }} each + {{ Helper::formatCurrencyOutput($component->purchase_cost) }} each purchase_cost *$component->pivot->assigned_qty) ?> @endif @@ -885,7 +885,7 @@ - {{ $totalCost }} + {{ Helper::formatCurrencyOutput($totalCost) }} diff --git a/resources/views/suppliers/view.blade.php b/resources/views/suppliers/view.blade.php index 3a86da7c5d..2e3c91103d 100755 --- a/resources/views/suppliers/view.blade.php +++ b/resources/views/suppliers/view.blade.php @@ -191,7 +191,7 @@ {{ $improvement->start_date }} {{ $improvement->completion_date }} {{ $improvement->is_warranty ? trans('admin/asset_maintenances/message.warranty') : trans('admin/asset_maintenances/message.not_warranty') }} - {{ sprintf( $snipeSettings->default_currency. '%01.2f', $improvement->cost) }} + {{ $snipeSettings->default_currency. ' '. Helper::formatCurrencyOutput($improvement->cost) }} cost; ?> @@ -207,7 +207,7 @@ - {{sprintf($snipeSettings->default_currency . '%01.2f', $totalCost)}} + {{ $snipeSettings->default_currency . ' '.Helper::formatCurrencyOutput($totalCost) }} diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index f94ec9e004..6d0dc79939 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -460,7 +460,7 @@ @endcan - {{ $license->purchase_cost }} + {{ Helper::formatCurrencyOutput($license->purchase_cost) }} {{ $license->purchase_order }} @@ -512,7 +512,7 @@ {!!$accessory->present()->nameUrl()!!} - {!! $accessory->purchase_cost !!} + {!! Helper::formatCurrencyOutput($accessory->purchase_cost) !!} @can('checkin', $accessory) @@ -558,7 +558,7 @@ {!! $consumable->present()->nameUrl() !!} - {!! $consumable->purchase_cost !!} + {!! Helper::formatCurrencyOutput($consumable->purchase_cost) !!} {{ $consumable->created_at }}