Skip to content

A free open source IT asset/license management system

Fixed #17791 - increase size of purchase cost field

snipef5c8b3eb04a7
diff --git a/app/Models/Accessory.php b/app/Models/Accessory.php
index 2138824196..debd9d680d 100755
--- a/app/Models/Accessory.php
+++ b/app/Models/Accessory.php
@@ -66,7 +66,7 @@ class Accessory extends SnipeModel
'company_id' => 'integer|nullable',
'location_id' => 'exists:locations,id|nullable|fmcs_location',
'min_amt' => 'integer|min:0|nullable',
- 'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999',
+ 'purchase_cost' => ['nullable', 'numeric', 'gte:0', 'max:99999999999999999.99'],
'purchase_date' => 'date_format:Y-m-d|nullable',
];
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index 3b303b758d..d5b640e40a 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -114,7 +114,7 @@ class Asset extends Depreciable
'rtd_location_id' => ['nullable', 'exists:locations,id', 'fmcs_location'],
'purchase_date' => ['nullable', 'date', 'date_format:Y-m-d'],
'serial' => ['nullable', 'string', 'unique_undeleted:assets,serial'],
- 'purchase_cost' => ['nullable', 'numeric', 'gte:0', 'max:9999999999999'],
+ 'purchase_cost' => ['nullable', 'numeric', 'gte:0', 'max:99999999999999999.99'],
'supplier_id' => ['nullable', 'exists:suppliers,id'],
'asset_eol_date' => ['nullable', 'date'],
'eol_explicit' => ['nullable', 'boolean'],
diff --git a/app/Models/Component.php b/app/Models/Component.php
index 5dfa031282..aabb4c9ccc 100644
--- a/app/Models/Component.php
+++ b/app/Models/Component.php
@@ -43,7 +43,7 @@ class Component extends SnipeModel
'location_id' => 'exists:locations,id|nullable|fmcs_location',
'min_amt' => 'integer|min:0|nullable',
'purchase_date' => 'date_format:Y-m-d|nullable',
- 'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999',
+ 'purchase_cost' => ['nullable', 'numeric', 'gte:0', 'max:99999999999999999.99'],
'manufacturer_id' => 'integer|exists:manufacturers,id|nullable',
];
diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php
index 5ac659cca0..386e1e05d2 100644
--- a/app/Models/Consumable.php
+++ b/app/Models/Consumable.php
@@ -47,7 +47,7 @@ class Consumable extends SnipeModel
'company_id' => 'integer|nullable',
'location_id' => 'exists:locations,id|nullable|fmcs_location',
'min_amt' => 'integer|min:0|max:99999|nullable',
- 'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999',
+ 'purchase_cost' => ['nullable', 'numeric', 'gte:0', 'max:99999999999999999.99'],
'purchase_date' => 'date_format:Y-m-d|nullable',
];
diff --git a/app/Models/License.php b/app/Models/License.php
index 519736842c..7aa33ac63d 100755
--- a/app/Models/License.php
+++ b/app/Models/License.php
@@ -51,7 +51,7 @@ class License extends Depreciable
'notes' => 'string|nullable',
'category_id' => 'required|exists:categories,id',
'company_id' => 'integer|nullable',
- 'purchase_cost'=> 'numeric|nullable|gte:0',
+ 'purchase_cost' => ['nullable', 'numeric', 'gte:0', 'max:99999999999999999.99'],
'purchase_date' => 'date_format:Y-m-d|nullable|max:10|required_with:depreciation_id',
'expiration_date' => 'date_format:Y-m-d|nullable|max:10',
'termination_date' => 'date_format:Y-m-d|nullable|max:10',
diff --git a/app/Models/Maintenance.php b/app/Models/Maintenance.php
index 3a53b3c41b..c5f975c07f 100644
--- a/app/Models/Maintenance.php
+++ b/app/Models/Maintenance.php
@@ -32,12 +32,12 @@ class Maintenance extends SnipeModel implements ICompanyableChild
'asset_id' => 'required|integer',
'supplier_id' => 'nullable|integer',
'asset_maintenance_type' => 'required',
- 'name' => 'required|max:100',
+ 'name' => 'required|max:100',
'is_warranty' => 'boolean',
'start_date' => 'required|date_format:Y-m-d',
'completion_date' => 'date_format:Y-m-d|nullable|after_or_equal:start_date',
'notes' => 'string|nullable',
- 'cost' => 'numeric|nullable',
+ 'cost' => ['nullable', 'numeric', 'gte:0', 'max:99999999999999999.99'],
];
diff --git a/resources/views/maintenances/edit.blade.php b/resources/views/maintenances/edit.blade.php
index 38d290b4dc..436b1c6575 100644
--- a/resources/views/maintenances/edit.blade.php
+++ b/resources/views/maintenances/edit.blade.php
@@ -105,8 +105,6 @@
@include ('partials.forms.edit.maintenance_type')
- @include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
-
<!-- Start Date -->
<div class="form-group {{ $errors->has('start_date') ? ' has-error' : '' }}">
@@ -142,6 +140,9 @@
</div>
</div>
+ @include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
+
+
<!-- Warranty -->
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
@@ -155,7 +156,7 @@
<!-- Asset Maintenance Cost -->
<div class="form-group {{ $errors->has('cost') ? ' has-error' : '' }}">
<label for="cost" class="col-md-3 control-label">{{ trans('admin/maintenances/form.cost') }}</label>
- <div class="col-md-2">
+ <div class="col-md-3">
<div class="input-group">
<span class="input-group-addon">
@if (($item->asset) && ($item->asset->location) && ($item->asset->location->currency!=''))
@@ -164,7 +165,7 @@
{{ $snipeSettings->default_currency }}
@endif
</span>
- <input class="col-md-2 form-control" type="text" name="cost" id="cost" value="{{ old('cost', Helper::formatCurrencyOutput($item->cost)) }}" />
+ <input class="form-control" type="number" name="cost" min="0.00" max="99999999999999999.000" step="0.001" aria-label="cost" id="cost" value="{{ old('cost', $item->cost) }}" maxlength="25" />
{!! $errors->first('cost', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
diff --git a/resources/views/partials/forms/edit/purchase_cost.blade.php b/resources/views/partials/forms/edit/purchase_cost.blade.php
index be47108a33..8256bc11ad 100644
--- a/resources/views/partials/forms/edit/purchase_cost.blade.php
+++ b/resources/views/partials/forms/edit/purchase_cost.blade.php
@@ -2,8 +2,8 @@
<div class="form-group {{ $errors->has('purchase_cost') ? ' has-error' : '' }}">
<label for="purchase_cost" class="col-md-3 control-label">{{ trans('general.purchase_cost') }}</label>
<div class="col-md-9">
- <div class="input-group col-md-4" style="padding-left: 0px;">
- <input class="form-control" type="number" name="purchase_cost" min="0.00" max="10000000.000" step="0.001" aria-label="purchase_cost" id="purchase_cost" value="{{ old('purchase_cost', $item->purchase_cost) }}" maxlength="24" />
+ <div class="input-group col-md-5" style="padding-left: 0px;">
+ <input class="form-control" type="number" name="purchase_cost" min="0.00" max="99999999999999999.000" step="0.001" aria-label="purchase_cost" id="purchase_cost" value="{{ old('purchase_cost', $item->purchase_cost) }}" maxlength="25" />
<span class="input-group-addon">
@if (isset($currency_type))
{{ $currency_type }}