mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Rename parseCurrencyString to formatCurrencyOutput to clarify what it does better.
This commit is contained in:
parent
0c912bcf49
commit
5959f83de3
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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' =>'<div class="text-center"><input type="checkbox" name="edit_asset['.$asset->id.']" class="one_required"></div>',
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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) : '',
|
||||
|
|
|
@ -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, ',');
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
<span class="input-group-addon">
|
||||
{{ \App\Models\Setting::first()->default_currency }}
|
||||
</span>
|
||||
<input class="col-md-3 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', \App\Helpers\Helper::parseCurrencyString($accessory->purchase_cost)) }}" />
|
||||
<input class="col-md-3 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', \App\Helpers\Helper::formatCurrencyOutput($accessory->purchase_cost)) }}" />
|
||||
{!! $errors->first('purchase_cost', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
<div class="col-md-2">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{{ \App\Models\Setting::first()->default_currency }}</span>
|
||||
<input class="col-md-2 form-control" type="text" name="cost" id="cost" value="{{ Input::old('cost', \App\Helpers\Helper::parseCurrencyString($assetMaintenance->cost)) }}" />
|
||||
<input class="col-md-2 form-control" type="text" name="cost" id="cost" value="{{ Input::old('cost', \App\Helpers\Helper::formatCurrencyOutput($assetMaintenance->cost)) }}" />
|
||||
{!! $errors->first('cost', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -156,7 +156,7 @@
|
|||
<span class="input-group-addon">
|
||||
{{ \App\Models\Setting::first()->default_currency }}
|
||||
</span>
|
||||
<input class="col-md-2 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', \App\Helpers\Helper::parseCurrencyString($component->purchase_cost)) }}" />
|
||||
<input class="col-md-2 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', \App\Helpers\Helper::formatCurrencyOutput($component->purchase_cost)) }}" />
|
||||
{!! $errors->first('purchase_cost', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<div class="col-md-12" style="padding-bottom: 5px;"><strong>{{ trans('admin/components/general.cost') }}:</strong>
|
||||
{{ \App\Models\Setting::first()->default_currency }}
|
||||
|
||||
{{ \App\Helpers\Helper::parseCurrencyString($component->purchase_cost) }} </div>
|
||||
{{ \App\Helpers\Helper::formatCurrencyOutput($component->purchase_cost) }} </div>
|
||||
@endif
|
||||
|
||||
@if ($component->order_number)
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
<span class="input-group-addon">
|
||||
{{ \App\Models\Setting::first()->default_currency }}
|
||||
</span>
|
||||
<input class="col-md-2 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', \App\Helpers\Helper::parseCurrencyString($consumable->purchase_cost)) }}" />
|
||||
<input class="col-md-2 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', \App\Helpers\Helper::formatCurrencyOutput($consumable->purchase_cost)) }}" />
|
||||
{!! $errors->first('purchase_cost', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
<div class="col-md-12" style="padding-bottom: 5px;"><strong>{{ trans('admin/consumables/general.cost') }}:</strong>
|
||||
{{ \App\Models\Setting::first()->default_currency }}
|
||||
|
||||
{{ \App\Helpers\Helper::parseCurrencyString($consumable->purchase_cost) }} </div>
|
||||
{{ \App\Helpers\Helper::formatCurrencyOutput($consumable->purchase_cost) }} </div>
|
||||
@endif
|
||||
|
||||
@if ($consumable->item_no)
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
|
||||
|
||||
</span>
|
||||
<input class="col-md-2 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', \App\Helpers\Helper::parseCurrencyString($asset->purchase_cost)) }}" />
|
||||
<input class="col-md-2 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost)) }}" />
|
||||
{!! $errors->first('purchase_cost', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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 }})
|
||||
|
|
|
@ -139,7 +139,7 @@
|
|||
<div class="col-md-3">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{{ \App\Models\Setting::first()->default_currency }}</span>
|
||||
<input class="col-md-3 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', \App\Helpers\Helper::parseCurrencyString($license->purchase_cost)) }}" />
|
||||
<input class="col-md-3 form-control" type="text" name="purchase_cost" id="purchase_cost" value="{{ Input::old('purchase_cost', \App\Helpers\Helper::formatCurrencyOutput($license->purchase_cost)) }}" />
|
||||
{!! $errors->first('purchase_cost', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -246,7 +246,7 @@
|
|||
</td>
|
||||
<td>
|
||||
{{ \App\Models\Setting::first()->default_currency }}
|
||||
{{ \App\Helpers\Helper::parseCurrencyString($license->purchase_cost) }}
|
||||
{{ \App\Helpers\Helper::formatCurrencyOutput($license->purchase_cost) }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
</td>
|
||||
<td>{{ $asset->purchase_date }}</td>
|
||||
<td class="align-right">{{ $settings->default_currency }}
|
||||
{{ \App\Helpers\Helper::parseCurrencyString($asset->purchase_cost) }}
|
||||
{{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost) }}
|
||||
</td>
|
||||
<td>
|
||||
@if ($asset->order_number)
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
@else
|
||||
{{ \App\Models\Setting::first()->default_currency }}
|
||||
@endif
|
||||
{{ \App\Helpers\Helper::parseCurrencyString($asset->purchase_cost) }}</td>
|
||||
{{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost) }}</td>
|
||||
<td class="align-right">
|
||||
@if ($asset->assetloc )
|
||||
{{ $asset->assetloc->currency }}
|
||||
|
@ -119,7 +119,7 @@
|
|||
{{ \App\Models\Setting::first()->default_currency }}
|
||||
@endif
|
||||
|
||||
{{ \App\Helpers\Helper::parseCurrencyString($asset->getDepreciatedValue()) }}</td>
|
||||
{{ \App\Helpers\Helper::formatCurrencyOutput($asset->getDepreciatedValue()) }}</td>
|
||||
<td class="align-right">
|
||||
@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())) }}</td>
|
||||
-{{ \App\Helpers\Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue())) }}</td>
|
||||
@else
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
@if ($asset->purchase_cost > 0)
|
||||
<td class="align-right">
|
||||
{{ \App\Models\Setting::first()->default_currency }}
|
||||
{{ \App\Helpers\Helper::parseCurrencyString($asset->purchase_cost) }}
|
||||
{{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost) }}
|
||||
</td>
|
||||
<td class="align-right">
|
||||
{{ \App\Models\Setting::first()->default_currency }}
|
||||
|
|
Loading…
Reference in a new issue