From 5959f83de3d248a705b7e832c0059772f084c68b Mon Sep 17 00:00:00 2001 From: Daniel Meltzer Date: Tue, 16 Aug 2016 20:47:53 -0500 Subject: [PATCH] Rename parseCurrencyString to formatCurrencyOutput to clarify what it does better. --- app/Helpers/Helper.php | 2 +- app/Http/Controllers/AccessoriesController.php | 2 +- app/Http/Controllers/AssetsController.php | 4 ++-- app/Http/Controllers/ComponentsController.php | 2 +- app/Http/Controllers/ConsumablesController.php | 2 +- app/Http/Controllers/LicensesController.php | 2 +- app/Http/Controllers/ReportsController.php | 18 +++++++++--------- resources/views/accessories/edit.blade.php | 2 +- .../views/asset_maintenances/edit.blade.php | 2 +- resources/views/components/edit.blade.php | 2 +- resources/views/components/view.blade.php | 2 +- resources/views/consumables/edit.blade.php | 2 +- resources/views/consumables/view.blade.php | 2 +- resources/views/hardware/edit.blade.php | 2 +- resources/views/hardware/view.blade.php | 2 +- resources/views/licenses/edit.blade.php | 2 +- resources/views/licenses/view.blade.php | 2 +- resources/views/reports/asset.blade.php | 2 +- resources/views/reports/depreciation.blade.php | 6 +++--- resources/views/reports/index.blade.php | 2 +- 20 files changed, 31 insertions(+), 31 deletions(-) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 7ddab75325..b0fc905511 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -43,7 +43,7 @@ class Helper return array_walk($emails_array, 'trim_value'); } - public static function parseCurrencyString($cost) + public static function formatCurrencyOutput($cost) { // The importer has formatted number strings since v3, so the value might be a string, or an integer. // If it's a number, format it as a string diff --git a/app/Http/Controllers/AccessoriesController.php b/app/Http/Controllers/AccessoriesController.php index 5f943a48f7..4aab46efb4 100755 --- a/app/Http/Controllers/AccessoriesController.php +++ b/app/Http/Controllers/AccessoriesController.php @@ -617,7 +617,7 @@ class AccessoriesController extends Controller 'min_amt' => e($accessory->min_amt), 'location' => ($accessory->location) ? e($accessory->location->name): '', 'purchase_date' => e($accessory->purchase_date), - 'purchase_cost' => Helper::parseCurrencyString($accessory->purchase_cost), + 'purchase_cost' => Helper::formatCurrencyOutput($accessory->purchase_cost), 'numRemaining' => $accessory->numRemaining(), 'actions' => $actions, 'companyName' => is_null($company) ? '' : e($company->name) diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index 92aaa8f607..92f4997d52 100755 --- a/app/Http/Controllers/AssetsController.php +++ b/app/Http/Controllers/AssetsController.php @@ -354,7 +354,7 @@ class AssetsController extends Controller } if ($request->has('purchase_cost')) { - $asset->purchase_cost = e(Helper::parseCurrencyString($request->input('purchase_cost'))); + $asset->purchase_cost = e(Helper::formatCurrencyOutput($request->input('purchase_cost'))); } else { $asset->purchase_cost = null; } @@ -1741,7 +1741,7 @@ class AssetsController extends Controller } } - $purchase_cost = Helper::parseCurrencyString($asset->purchase_cost); + $purchase_cost = Helper::formatCurrencyOutput($asset->purchase_cost); $row = array( 'checkbox' =>'
', diff --git a/app/Http/Controllers/ComponentsController.php b/app/Http/Controllers/ComponentsController.php index 57ba37eb7c..e3e754383a 100644 --- a/app/Http/Controllers/ComponentsController.php +++ b/app/Http/Controllers/ComponentsController.php @@ -484,7 +484,7 @@ class ComponentsController extends Controller 'category' => ($component->category) ? e($component->category->name) : 'Missing category', 'order_number' => e($component->order_number), 'purchase_date' => e($component->purchase_date), - 'purchase_cost' => Helper::parseCurrencyString($component->purchase_cost), + 'purchase_cost' => Helper::formatCurrencyOutput($component->purchase_cost), 'numRemaining' => $component->numRemaining(), 'actions' => $actions, 'companyName' => is_null($company) ? '' : e($company->name), diff --git a/app/Http/Controllers/ConsumablesController.php b/app/Http/Controllers/ConsumablesController.php index 096889a801..f4f8be380e 100644 --- a/app/Http/Controllers/ConsumablesController.php +++ b/app/Http/Controllers/ConsumablesController.php @@ -476,7 +476,7 @@ class ConsumablesController extends Controller 'category' => ($consumable->category) ? e($consumable->category->name) : 'Missing category', 'order_number' => e($consumable->order_number), 'purchase_date' => e($consumable->purchase_date), - 'purchase_cost' => Helper::parseCurrencyString($consumable->purchase_cost), + 'purchase_cost' => Helper::formatCurrencyOutput($consumable->purchase_cost), 'numRemaining' => $consumable->numRemaining(), 'actions' => $actions, 'companyName' => is_null($company) ? '' : e($company->name), diff --git a/app/Http/Controllers/LicensesController.php b/app/Http/Controllers/LicensesController.php index 5606675dad..fe668c7601 100755 --- a/app/Http/Controllers/LicensesController.php +++ b/app/Http/Controllers/LicensesController.php @@ -1015,7 +1015,7 @@ class LicensesController extends Controller 'license_email' => e($license->license_email), 'purchase_date' => ($license->purchase_date) ? $license->purchase_date : '', 'expiration_date' => ($license->expiration_date) ? $license->expiration_date : '', - 'purchase_cost' => Helper::parseCurrencyString($license->purchase_cost), + 'purchase_cost' => Helper::formatCurrencyOutput($license->purchase_cost), 'purchase_order' => ($license->purchase_order) ? e($license->purchase_order) : '', 'order_number' => ($license->order_number) ? e($license->order_number) : '', 'notes' => ($license->notes) ? e($license->notes) : '', diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 9e0c6ef6da..f7dc09168f 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -309,9 +309,9 @@ class ReportsController extends Controller } $row[] = $asset->purchase_date; - $row[] = $currency . Helper::parseCurrencyString($asset->purchase_cost); - $row[] = $currency . Helper::parseCurrencyString($asset->getDepreciatedValue()); - $row[] = $currency . Helper::parseCurrencyString(( $asset->purchase_cost - $asset->getDepreciatedValue() )); + $row[] = $currency . Helper::formatCurrencyOutput($asset->purchase_cost); + $row[] = $currency . Helper::formatCurrencyOutput($asset->getDepreciatedValue()); + $row[] = $currency . Helper::formatCurrencyOutput(( $asset->purchase_cost - $asset->getDepreciatedValue() )); $csv->insertOne($row); } @@ -393,7 +393,7 @@ class ReportsController extends Controller $row[] = $license->remaincount(); $row[] = $license->expiration_date; $row[] = $license->purchase_date; - $row[] = '"' . Helper::parseCurrencyString($license->purchase_cost) . '"'; + $row[] = '"' . Helper::formatCurrencyOutput($license->purchase_cost) . '"'; $rows[] = implode($row, ','); } @@ -529,7 +529,7 @@ class ReportsController extends Controller $row[] = e($asset->purchase_date); } if (e(Input::get('purchase_cost')) == '1' && ( e(Input::get('depreciation')) != '1' )) { - $row[] = '"' . Helper::parseCurrencyString($asset->purchase_cost) . '"'; + $row[] = '"' . Helper::formatCurrencyOutput($asset->purchase_cost) . '"'; } if (e(Input::get('order')) == '1') { if ($asset->order_number) { @@ -606,9 +606,9 @@ class ReportsController extends Controller } if (e(Input::get('depreciation')) == '1') { $depreciation = $asset->getDepreciatedValue(); - $row[] = '"' . Helper::parseCurrencyString($asset->purchase_cost) . '"'; - $row[] = '"' . Helper::parseCurrencyString($depreciation) . '"'; - $row[] = '"' . Helper::parseCurrencyString($asset->purchase_cost) . '"'; + $row[] = '"' . Helper::formatCurrencyOutput($asset->purchase_cost) . '"'; + $row[] = '"' . Helper::formatCurrencyOutput($depreciation) . '"'; + $row[] = '"' . Helper::formatCurrencyOutput($asset->purchase_cost) . '"'; } foreach ($customfields as $customfield) { @@ -699,7 +699,7 @@ class ReportsController extends Controller $improvementTime = intval($assetMaintenance->asset_maintenance_time); } $row[] = $improvementTime; - $row[] = trans('general.currency') . Helper::parseCurrencyString($assetMaintenance->cost); + $row[] = trans('general.currency') . Helper::formatCurrencyOutput($assetMaintenance->cost); $rows[] = implode($row, ','); } diff --git a/resources/views/accessories/edit.blade.php b/resources/views/accessories/edit.blade.php index 361fa4cced..c1b21ceb0c 100755 --- a/resources/views/accessories/edit.blade.php +++ b/resources/views/accessories/edit.blade.php @@ -132,7 +132,7 @@ {{ \App\Models\Setting::first()->default_currency }} - + {!! $errors->first('purchase_cost', ' :message') !!} diff --git a/resources/views/asset_maintenances/edit.blade.php b/resources/views/asset_maintenances/edit.blade.php index d13b01bba8..ea7b5a1ac7 100644 --- a/resources/views/asset_maintenances/edit.blade.php +++ b/resources/views/asset_maintenances/edit.blade.php @@ -122,7 +122,7 @@
{{ \App\Models\Setting::first()->default_currency }} - + {!! $errors->first('cost', ' :message') !!}
diff --git a/resources/views/components/edit.blade.php b/resources/views/components/edit.blade.php index 7cab993f0b..9e20716f51 100644 --- a/resources/views/components/edit.blade.php +++ b/resources/views/components/edit.blade.php @@ -156,7 +156,7 @@ {{ \App\Models\Setting::first()->default_currency }} - + {!! $errors->first('purchase_cost', ' :message') !!} diff --git a/resources/views/components/view.blade.php b/resources/views/components/view.blade.php index 74feb7898f..e84fb34f32 100644 --- a/resources/views/components/view.blade.php +++ b/resources/views/components/view.blade.php @@ -83,7 +83,7 @@
{{ trans('admin/components/general.cost') }}: {{ \App\Models\Setting::first()->default_currency }} - {{ \App\Helpers\Helper::parseCurrencyString($component->purchase_cost) }}
+ {{ \App\Helpers\Helper::formatCurrencyOutput($component->purchase_cost) }} @endif @if ($component->order_number) diff --git a/resources/views/consumables/edit.blade.php b/resources/views/consumables/edit.blade.php index 2080e122ee..2cf1ec654a 100644 --- a/resources/views/consumables/edit.blade.php +++ b/resources/views/consumables/edit.blade.php @@ -159,7 +159,7 @@ {{ \App\Models\Setting::first()->default_currency }} - + {!! $errors->first('purchase_cost', ' :message') !!} diff --git a/resources/views/consumables/view.blade.php b/resources/views/consumables/view.blade.php index 368f84be26..afc2a3feaf 100644 --- a/resources/views/consumables/view.blade.php +++ b/resources/views/consumables/view.blade.php @@ -72,7 +72,7 @@
{{ trans('admin/consumables/general.cost') }}: {{ \App\Models\Setting::first()->default_currency }} - {{ \App\Helpers\Helper::parseCurrencyString($consumable->purchase_cost) }}
+ {{ \App\Helpers\Helper::formatCurrencyOutput($consumable->purchase_cost) }} @endif @if ($consumable->item_no) diff --git a/resources/views/hardware/edit.blade.php b/resources/views/hardware/edit.blade.php index 357372c083..53a469ecea 100755 --- a/resources/views/hardware/edit.blade.php +++ b/resources/views/hardware/edit.blade.php @@ -215,7 +215,7 @@ - + {!! $errors->first('purchase_cost', ' :message') !!} diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 6442cfa9c2..d4e0b32a32 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -154,7 +154,7 @@ @else {{ \App\Models\Setting::first()->default_currency }} @endif - {{ \App\Helpers\Helper::parseCurrencyString($asset->purchase_cost)}} + {{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost)}} @if ($asset->order_number) (Order #{{ $asset->order_number }}) diff --git a/resources/views/licenses/edit.blade.php b/resources/views/licenses/edit.blade.php index 47306e5c23..bd86990e7e 100755 --- a/resources/views/licenses/edit.blade.php +++ b/resources/views/licenses/edit.blade.php @@ -139,7 +139,7 @@
{{ \App\Models\Setting::first()->default_currency }} - + {!! $errors->first('purchase_cost', ' :message') !!}
diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php index b19aa47eab..b0d2d4e653 100755 --- a/resources/views/licenses/view.blade.php +++ b/resources/views/licenses/view.blade.php @@ -246,7 +246,7 @@ {{ \App\Models\Setting::first()->default_currency }} - {{ \App\Helpers\Helper::parseCurrencyString($license->purchase_cost) }} + {{ \App\Helpers\Helper::formatCurrencyOutput($license->purchase_cost) }} @endif diff --git a/resources/views/reports/asset.blade.php b/resources/views/reports/asset.blade.php index 5acef07f5b..97c31cb5b7 100644 --- a/resources/views/reports/asset.blade.php +++ b/resources/views/reports/asset.blade.php @@ -77,7 +77,7 @@ {{ $asset->purchase_date }} {{ $settings->default_currency }} - {{ \App\Helpers\Helper::parseCurrencyString($asset->purchase_cost) }} + {{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost) }} @if ($asset->order_number) diff --git a/resources/views/reports/depreciation.blade.php b/resources/views/reports/depreciation.blade.php index 657706eda5..36cf1fd6f3 100644 --- a/resources/views/reports/depreciation.blade.php +++ b/resources/views/reports/depreciation.blade.php @@ -111,7 +111,7 @@ @else {{ \App\Models\Setting::first()->default_currency }} @endif - {{ \App\Helpers\Helper::parseCurrencyString($asset->purchase_cost) }} + {{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost) }} @if ($asset->assetloc ) {{ $asset->assetloc->currency }} @@ -119,7 +119,7 @@ {{ \App\Models\Setting::first()->default_currency }} @endif - {{ \App\Helpers\Helper::parseCurrencyString($asset->getDepreciatedValue()) }} + {{ \App\Helpers\Helper::formatCurrencyOutput($asset->getDepreciatedValue()) }} @if ($asset->assetloc) {{ $asset->assetloc->currency }} @@ -127,7 +127,7 @@ {{ \App\Models\Setting::first()->default_currency }} @endif - -{{ \App\Helpers\Helper::parseCurrencyString(($asset->purchase_cost - $asset->getDepreciatedValue())) }} + -{{ \App\Helpers\Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue())) }} @else diff --git a/resources/views/reports/index.blade.php b/resources/views/reports/index.blade.php index e6616d1cda..c84da3e1c0 100755 --- a/resources/views/reports/index.blade.php +++ b/resources/views/reports/index.blade.php @@ -74,7 +74,7 @@ @if ($asset->purchase_cost > 0) {{ \App\Models\Setting::first()->default_currency }} - {{ \App\Helpers\Helper::parseCurrencyString($asset->purchase_cost) }} + {{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost) }} {{ \App\Models\Setting::first()->default_currency }}