Skip to content

Commit 605022a

Browse files
authored
Merge pull request #17795 from grokability/#17791-larger-currency-field
Fixed #17791 - increase size of purchase cost field
2 parents 739980a + b06c58f commit 605022a

File tree

8 files changed

+14
-13
lines changed

8 files changed

+14
-13
lines changed

app/Models/Accessory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Accessory extends SnipeModel
6666
'company_id' => 'integer|nullable',
6767
'location_id' => 'exists:locations,id|nullable|fmcs_location',
6868
'min_amt' => 'integer|min:0|nullable',
69-
'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999',
69+
'purchase_cost' => 'numeric|nullable|gte:0|max:99999999999999999.99',
7070
'purchase_date' => 'date_format:Y-m-d|nullable',
7171
];
7272

app/Models/Asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function declinedCheckout(User $declinedBy, $signature)
114114
'rtd_location_id' => ['nullable', 'exists:locations,id', 'fmcs_location'],
115115
'purchase_date' => ['nullable', 'date', 'date_format:Y-m-d'],
116116
'serial' => ['nullable', 'string', 'unique_undeleted:assets,serial'],
117-
'purchase_cost' => ['nullable', 'numeric', 'gte:0', 'max:9999999999999'],
117+
'purchase_cost' => ['nullable', 'numeric', 'gte:0', 'max:99999999999999999.99'],
118118
'supplier_id' => ['nullable', 'exists:suppliers,id'],
119119
'asset_eol_date' => ['nullable', 'date'],
120120
'eol_explicit' => ['nullable', 'boolean'],

app/Models/Component.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Component extends SnipeModel
4343
'location_id' => 'exists:locations,id|nullable|fmcs_location',
4444
'min_amt' => 'integer|min:0|nullable',
4545
'purchase_date' => 'date_format:Y-m-d|nullable',
46-
'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999',
46+
'purchase_cost' => 'numeric|nullable|gte:0|max:99999999999999999.99',
4747
'manufacturer_id' => 'integer|exists:manufacturers,id|nullable',
4848
];
4949

app/Models/Consumable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Consumable extends SnipeModel
4747
'company_id' => 'integer|nullable',
4848
'location_id' => 'exists:locations,id|nullable|fmcs_location',
4949
'min_amt' => 'integer|min:0|max:99999|nullable',
50-
'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999',
50+
'purchase_cost' => 'numeric|nullable|gte:0|max:99999999999999999.99',
5151
'purchase_date' => 'date_format:Y-m-d|nullable',
5252
];
5353

app/Models/License.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class License extends Depreciable
5151
'notes' => 'string|nullable',
5252
'category_id' => 'required|exists:categories,id',
5353
'company_id' => 'integer|nullable',
54-
'purchase_cost'=> 'numeric|nullable|gte:0',
54+
'purchase_cost' => 'numeric|nullable|gte:0|max:99999999999999999.99',
5555
'purchase_date' => 'date_format:Y-m-d|nullable|max:10|required_with:depreciation_id',
5656
'expiration_date' => 'date_format:Y-m-d|nullable|max:10',
5757
'termination_date' => 'date_format:Y-m-d|nullable|max:10',

app/Models/Maintenance.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ class Maintenance extends SnipeModel implements ICompanyableChild
3232
'asset_id' => 'required|integer',
3333
'supplier_id' => 'nullable|integer',
3434
'asset_maintenance_type' => 'required',
35-
'name' => 'required|max:100',
35+
'name' => 'required|max:100',
3636
'is_warranty' => 'boolean',
3737
'start_date' => 'required|date_format:Y-m-d',
3838
'completion_date' => 'date_format:Y-m-d|nullable|after_or_equal:start_date',
3939
'notes' => 'string|nullable',
40-
'cost' => 'numeric|nullable',
40+
'cost' => 'numeric|nullable|gte:0|max:99999999999999999.99',
4141
];
4242

4343

resources/views/maintenances/edit.blade.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@
105105

106106

107107
@include ('partials.forms.edit.maintenance_type')
108-
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
109-
110108

111109
<!-- Start Date -->
112110
<div class="form-group {{ $errors->has('start_date') ? ' has-error' : '' }}">
@@ -142,6 +140,9 @@
142140
</div>
143141
</div>
144142

143+
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
144+
145+
145146
<!-- Warranty -->
146147
<div class="form-group">
147148
<div class="col-sm-offset-3 col-sm-9">
@@ -155,7 +156,7 @@
155156
<!-- Asset Maintenance Cost -->
156157
<div class="form-group {{ $errors->has('cost') ? ' has-error' : '' }}">
157158
<label for="cost" class="col-md-3 control-label">{{ trans('admin/maintenances/form.cost') }}</label>
158-
<div class="col-md-2">
159+
<div class="col-md-3">
159160
<div class="input-group">
160161
<span class="input-group-addon">
161162
@if (($item->asset) && ($item->asset->location) && ($item->asset->location->currency!=''))
@@ -164,7 +165,7 @@
164165
{{ $snipeSettings->default_currency }}
165166
@endif
166167
</span>
167-
<input class="col-md-2 form-control" type="text" name="cost" id="cost" value="{{ old('cost', Helper::formatCurrencyOutput($item->cost)) }}" />
168+
<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" />
168169
{!! $errors->first('cost', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
169170
</div>
170171
</div>

resources/views/partials/forms/edit/purchase_cost.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<div class="form-group {{ $errors->has('purchase_cost') ? ' has-error' : '' }}">
33
<label for="purchase_cost" class="col-md-3 control-label">{{ trans('general.purchase_cost') }}</label>
44
<div class="col-md-9">
5-
<div class="input-group col-md-4" style="padding-left: 0px;">
6-
<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" />
5+
<div class="input-group col-md-5" style="padding-left: 0px;">
6+
<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" />
77
<span class="input-group-addon">
88
@if (isset($currency_type))
99
{{ $currency_type }}

0 commit comments

Comments
 (0)