Merge pull request #12756 from dboth/develop

Fixed #8208, #8896, #8985 and #9789:  Currency issues when using non-english locales (resubmission)
This commit is contained in:
snipe 2023-04-25 22:32:13 -07:00 committed by GitHub
commit 22d73f503a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 20 additions and 20 deletions

View file

@ -77,7 +77,7 @@ class AccessoriesController extends Controller
$accessory->manufacturer_id = request('manufacturer_id'); $accessory->manufacturer_id = request('manufacturer_id');
$accessory->model_number = request('model_number'); $accessory->model_number = request('model_number');
$accessory->purchase_date = request('purchase_date'); $accessory->purchase_date = request('purchase_date');
$accessory->purchase_cost = Helper::ParseCurrency(request('purchase_cost')); $accessory->purchase_cost = request('purchase_cost');
$accessory->qty = request('qty'); $accessory->qty = request('qty');
$accessory->user_id = Auth::user()->id; $accessory->user_id = Auth::user()->id;
$accessory->supplier_id = request('supplier_id'); $accessory->supplier_id = request('supplier_id');
@ -180,7 +180,7 @@ class AccessoriesController extends Controller
$accessory->order_number = request('order_number'); $accessory->order_number = request('order_number');
$accessory->model_number = request('model_number'); $accessory->model_number = request('model_number');
$accessory->purchase_date = request('purchase_date'); $accessory->purchase_date = request('purchase_date');
$accessory->purchase_cost = Helper::ParseCurrency(request('purchase_cost')); $accessory->purchase_cost = request('purchase_cost');
$accessory->qty = request('qty'); $accessory->qty = request('qty');
$accessory->supplier_id = request('supplier_id'); $accessory->supplier_id = request('supplier_id');
$accessory->notes = request('notes'); $accessory->notes = request('notes');

View file

@ -118,7 +118,7 @@ class AssetMaintenancesController extends Controller
$assetMaintenance = new AssetMaintenance(); $assetMaintenance = new AssetMaintenance();
$assetMaintenance->supplier_id = $request->input('supplier_id'); $assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty'); $assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = Helper::ParseCurrency($request->input('cost')); $assetMaintenance->cost = $request->input('cost');
$assetMaintenance->notes = e($request->input('notes')); $assetMaintenance->notes = e($request->input('notes'));
$asset = Asset::find(e($request->input('asset_id'))); $asset = Asset::find(e($request->input('asset_id')));
@ -175,7 +175,7 @@ class AssetMaintenancesController extends Controller
$assetMaintenance->supplier_id = e($request->input('supplier_id')); $assetMaintenance->supplier_id = e($request->input('supplier_id'));
$assetMaintenance->is_warranty = e($request->input('is_warranty')); $assetMaintenance->is_warranty = e($request->input('is_warranty'));
$assetMaintenance->cost = Helper::ParseCurrency($request->input('cost')); $assetMaintenance->cost = $request->input('cost');
$assetMaintenance->notes = e($request->input('notes')); $assetMaintenance->notes = e($request->input('notes'));
$asset = Asset::find(request('asset_id')); $asset = Asset::find(request('asset_id'));

View file

@ -550,7 +550,7 @@ class AssetsController extends Controller
$asset->depreciate = '0'; $asset->depreciate = '0';
$asset->status_id = $request->get('status_id', 0); $asset->status_id = $request->get('status_id', 0);
$asset->warranty_months = $request->get('warranty_months', null); $asset->warranty_months = $request->get('warranty_months', null);
$asset->purchase_cost = Helper::ParseCurrency($request->get('purchase_cost')); // this is the API's store method, so I don't know that I want to do this? Confusing. FIXME (or not?!) $asset->purchase_cost = $request->get('purchase_cost'); // this is the API's store method, so I don't know that I want to do this? Confusing. FIXME (or not?!)
$asset->purchase_date = $request->get('purchase_date', null); $asset->purchase_date = $request->get('purchase_date', null);
$asset->assigned_to = $request->get('assigned_to', null); $asset->assigned_to = $request->get('assigned_to', null);
$asset->supplier_id = $request->get('supplier_id'); $asset->supplier_id = $request->get('supplier_id');

View file

@ -101,7 +101,7 @@ class AssetMaintenancesController extends Controller
$assetMaintenance = new AssetMaintenance(); $assetMaintenance = new AssetMaintenance();
$assetMaintenance->supplier_id = $request->input('supplier_id'); $assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty'); $assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = Helper::ParseCurrency($request->input('cost')); $assetMaintenance->cost = $request->input('cost');
$assetMaintenance->notes = $request->input('notes'); $assetMaintenance->notes = $request->input('notes');
$asset = Asset::find($request->input('asset_id')); $asset = Asset::find($request->input('asset_id'));
@ -211,7 +211,7 @@ class AssetMaintenancesController extends Controller
$assetMaintenance->supplier_id = $request->input('supplier_id'); $assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty'); $assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = Helper::ParseCurrency($request->input('cost')); $assetMaintenance->cost = $request->input('cost');
$assetMaintenance->notes = $request->input('notes'); $assetMaintenance->notes = $request->input('notes');
$asset = Asset::find(request('asset_id')); $asset = Asset::find(request('asset_id'));

View file

@ -140,7 +140,7 @@ class AssetsController extends Controller
$asset->depreciate = '0'; $asset->depreciate = '0';
$asset->status_id = request('status_id'); $asset->status_id = request('status_id');
$asset->warranty_months = request('warranty_months', null); $asset->warranty_months = request('warranty_months', null);
$asset->purchase_cost = Helper::ParseCurrency($request->get('purchase_cost')); $asset->purchase_cost = $request->get('purchase_cost');
$asset->purchase_date = request('purchase_date', null); $asset->purchase_date = request('purchase_date', null);
$asset->asset_eol_date = request('asset_eol_date', null); $asset->asset_eol_date = request('asset_eol_date', null);
$asset->assigned_to = request('assigned_to', null); $asset->assigned_to = request('assigned_to', null);
@ -312,7 +312,7 @@ class AssetsController extends Controller
$asset->status_id = $request->input('status_id', null); $asset->status_id = $request->input('status_id', null);
$asset->warranty_months = $request->input('warranty_months', null); $asset->warranty_months = $request->input('warranty_months', null);
$asset->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost', null)); $asset->purchase_cost = $request->input('purchase_cost', null);
$asset->asset_eol_date = request('asset_eol_date', null); $asset->asset_eol_date = request('asset_eol_date', null);
$asset->purchase_date = $request->input('purchase_date', null); $asset->purchase_date = $request->input('purchase_date', null);

View file

@ -149,7 +149,7 @@ class BulkAssetsController extends Controller
} }
if ($request->filled('purchase_cost')) { if ($request->filled('purchase_cost')) {
$this->update_array['purchase_cost'] = Helper::ParseCurrency($request->input('purchase_cost')); $this->update_array['purchase_cost'] = $request->input('purchase_cost');
} }
if ($request->filled('company_id')) { if ($request->filled('company_id')) {

View file

@ -78,7 +78,7 @@ class ComponentsController extends Controller
$component->min_amt = $request->input('min_amt', null); $component->min_amt = $request->input('min_amt', null);
$component->serial = $request->input('serial', null); $component->serial = $request->input('serial', null);
$component->purchase_date = $request->input('purchase_date', null); $component->purchase_date = $request->input('purchase_date', null);
$component->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost', null)); $component->purchase_cost = $request->input('purchase_cost', null);
$component->qty = $request->input('qty'); $component->qty = $request->input('qty');
$component->user_id = Auth::id(); $component->user_id = Auth::id();
$component->notes = $request->input('notes'); $component->notes = $request->input('notes');
@ -153,7 +153,7 @@ class ComponentsController extends Controller
$component->min_amt = $request->input('min_amt'); $component->min_amt = $request->input('min_amt');
$component->serial = $request->input('serial'); $component->serial = $request->input('serial');
$component->purchase_date = $request->input('purchase_date'); $component->purchase_date = $request->input('purchase_date');
$component->purchase_cost = Helper::ParseCurrency(request('purchase_cost')); $component->purchase_cost = request('purchase_cost');
$component->qty = $request->input('qty'); $component->qty = $request->input('qty');
$component->notes = $request->input('notes'); $component->notes = $request->input('notes');

View file

@ -77,7 +77,7 @@ class ConsumablesController extends Controller
$consumable->model_number = $request->input('model_number'); $consumable->model_number = $request->input('model_number');
$consumable->item_no = $request->input('item_no'); $consumable->item_no = $request->input('item_no');
$consumable->purchase_date = $request->input('purchase_date'); $consumable->purchase_date = $request->input('purchase_date');
$consumable->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost')); $consumable->purchase_cost = $request->input('purchase_cost');
$consumable->qty = $request->input('qty'); $consumable->qty = $request->input('qty');
$consumable->user_id = Auth::id(); $consumable->user_id = Auth::id();
$consumable->notes = $request->input('notes'); $consumable->notes = $request->input('notes');
@ -154,7 +154,7 @@ class ConsumablesController extends Controller
$consumable->model_number = $request->input('model_number'); $consumable->model_number = $request->input('model_number');
$consumable->item_no = $request->input('item_no'); $consumable->item_no = $request->input('item_no');
$consumable->purchase_date = $request->input('purchase_date'); $consumable->purchase_date = $request->input('purchase_date');
$consumable->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost')); $consumable->purchase_cost = $request->input('purchase_cost');
$consumable->qty = Helper::ParseFloat($request->input('qty')); $consumable->qty = Helper::ParseFloat($request->input('qty'));
$consumable->notes = $request->input('notes'); $consumable->notes = $request->input('notes');

View file

@ -88,7 +88,7 @@ class LicensesController extends Controller
$license->name = $request->input('name'); $license->name = $request->input('name');
$license->notes = $request->input('notes'); $license->notes = $request->input('notes');
$license->order_number = $request->input('order_number'); $license->order_number = $request->input('order_number');
$license->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost')); $license->purchase_cost = $request->input('purchase_cost');
$license->purchase_date = $request->input('purchase_date'); $license->purchase_date = $request->input('purchase_date');
$license->purchase_order = $request->input('purchase_order'); $license->purchase_order = $request->input('purchase_order');
$license->purchase_order = $request->input('purchase_order'); $license->purchase_order = $request->input('purchase_order');
@ -166,7 +166,7 @@ class LicensesController extends Controller
$license->name = $request->input('name'); $license->name = $request->input('name');
$license->notes = $request->input('notes'); $license->notes = $request->input('notes');
$license->order_number = $request->input('order_number'); $license->order_number = $request->input('order_number');
$license->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost')); $license->purchase_cost = $request->input('purchase_cost');
$license->purchase_date = $request->input('purchase_date'); $license->purchase_date = $request->input('purchase_date');
$license->purchase_order = $request->input('purchase_order'); $license->purchase_order = $request->input('purchase_order');
$license->reassignable = $request->input('reassignable', 0); $license->reassignable = $request->input('reassignable', 0);

View file

@ -95,8 +95,8 @@ class AssetMaintenance extends Model implements ICompanyableChild
*/ */
public function setCostAttribute($value) public function setCostAttribute($value)
{ {
$value = Helper::ParseFloat($value); $value = Helper::ParseCurrency($value);
if ($value == '0.0') { if ($value == 0) {
$value = null; $value = null;
} }
$this->attributes['cost'] = $value; $this->attributes['cost'] = $value;

View file

@ -21,9 +21,9 @@ class SnipeModel extends Model
*/ */
public function setPurchaseCostAttribute($value) public function setPurchaseCostAttribute($value)
{ {
$value = Helper::ParseFloat($value); $value = Helper::ParseCurrency($value);
if ($value == '0.0') { if ($value == 0) {
$value = null; $value = null;
} }
$this->attributes['purchase_cost'] = $value; $this->attributes['purchase_cost'] = $value;