From cae8aa78406c28d8b6c1cc40d79c05a42f38d988 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 1 Oct 2024 14:02:54 +0100 Subject: [PATCH] Added maxlengths to additional fields Signed-off-by: snipe --- app/Models/Accessory.php | 2 +- app/Models/Asset.php | 2 +- app/Models/Component.php | 4 ++-- app/Models/Consumable.php | 2 +- resources/views/components/checkout.blade.php | 2 +- resources/views/consumables/checkout.blade.php | 2 +- resources/views/licenses/edit.blade.php | 4 ++-- resources/views/partials/forms/edit/address.blade.php | 8 ++++---- resources/views/partials/forms/edit/email.blade.php | 2 +- resources/views/partials/forms/edit/eol_date.blade.php | 2 +- resources/views/partials/forms/edit/fax.blade.php | 2 +- resources/views/partials/forms/edit/name.blade.php | 2 +- .../views/partials/forms/edit/order_number.blade.php | 2 +- resources/views/partials/forms/edit/phone.blade.php | 2 +- .../views/partials/forms/edit/purchase_cost.blade.php | 2 +- resources/views/partials/forms/edit/serial.blade.php | 2 +- resources/views/partials/forms/edit/username.blade.php | 9 +++++++-- 17 files changed, 28 insertions(+), 23 deletions(-) diff --git a/app/Models/Accessory.php b/app/Models/Accessory.php index 3fc4c5c9c6..fc1bb36ab4 100755 --- a/app/Models/Accessory.php +++ b/app/Models/Accessory.php @@ -62,7 +62,7 @@ class Accessory extends SnipeModel 'category_id' => 'required|integer|exists:categories,id', 'company_id' => 'integer|nullable', 'min_amt' => 'integer|min:0|nullable', - 'purchase_cost' => 'numeric|nullable|gte:0', + 'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999', 'purchase_date' => 'date_format:Y-m-d|nullable', ]; diff --git a/app/Models/Asset.php b/app/Models/Asset.php index bd0578fc2e..7301065712 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -112,7 +112,7 @@ class Asset extends Depreciable 'rtd_location_id' => ['nullable', 'exists:locations,id'], 'purchase_date' => ['nullable', 'date', 'date_format:Y-m-d'], 'serial' => ['nullable', 'unique_undeleted:assets,serial'], - 'purchase_cost' => ['nullable', 'numeric', 'gte:0'], + 'purchase_cost' => ['nullable', 'numeric', 'gte:0', 'max:9999999999999'], '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 7bba37ac12..761c76f097 100644 --- a/app/Models/Component.php +++ b/app/Models/Component.php @@ -30,14 +30,14 @@ class Component extends SnipeModel * Category validation rules */ public $rules = [ - 'name' => 'required|min:3|max:255', + 'name' => 'required|min:3|max:191', 'qty' => 'required|integer|min:1', 'category_id' => 'required|integer|exists:categories,id', 'supplier_id' => 'nullable|integer|exists:suppliers,id', 'company_id' => 'integer|nullable|exists:companies,id', 'min_amt' => 'integer|min:0|nullable', 'purchase_date' => 'date_format:Y-m-d|nullable', - 'purchase_cost' => 'numeric|nullable|gte:0', + 'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999', ]; /** diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php index eb0acc8016..30161e8429 100644 --- a/app/Models/Consumable.php +++ b/app/Models/Consumable.php @@ -50,7 +50,7 @@ class Consumable extends SnipeModel 'category_id' => 'required|integer', 'company_id' => 'integer|nullable', 'min_amt' => 'integer|min:0|max:99999|nullable', - 'purchase_cost' => 'numeric|nullable|gte:0', + 'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999', 'purchase_date' => 'date_format:Y-m-d|nullable', ]; diff --git a/resources/views/components/checkout.blade.php b/resources/views/components/checkout.blade.php index 39890a1938..7b2b313ba6 100644 --- a/resources/views/components/checkout.blade.php +++ b/resources/views/components/checkout.blade.php @@ -33,7 +33,7 @@ {{ trans('general.qty') }}
- +
@if ($errors->first('assigned_qty'))
diff --git a/resources/views/consumables/checkout.blade.php b/resources/views/consumables/checkout.blade.php index bb3023290f..fd6b7ce2fc 100644 --- a/resources/views/consumables/checkout.blade.php +++ b/resources/views/consumables/checkout.blade.php @@ -91,7 +91,7 @@
- +
{!! $errors->first('qty', '
') !!} diff --git a/resources/views/licenses/edit.blade.php b/resources/views/licenses/edit.blade.php index 1bd40c6c54..4dbde2935e 100755 --- a/resources/views/licenses/edit.blade.php +++ b/resources/views/licenses/edit.blade.php @@ -20,7 +20,7 @@
-
+
@@ -112,7 +112,7 @@
- + {!! $errors->first('purchase_order', '') !!}
diff --git a/resources/views/partials/forms/edit/address.blade.php b/resources/views/partials/forms/edit/address.blade.php index 893bd01339..0412287a92 100644 --- a/resources/views/partials/forms/edit/address.blade.php +++ b/resources/views/partials/forms/edit/address.blade.php @@ -15,17 +15,17 @@
- {{ Form::label('city', trans('general.city'), array('class' => 'col-md-3 control-label', 'maxlength'=>'191')) }} + {{ Form::label('city', trans('general.city'), array('class' => 'col-md-3 control-label')) }}
- {{Form::text('city', old('city', $item->city), array('class' => 'form-control', 'aria-label'=>'city')) }} + {{Form::text('city', old('city', $item->city), array('class' => 'form-control', 'aria-label'=>'city', 'maxlength'=>'191')) }} {!! $errors->first('city', '') !!}
- {{ Form::label('state', trans('general.state'), array('class' => 'col-md-3 control-label', 'maxlength'=>'191')) }} + {{ Form::label('state', trans('general.state'), array('class' => 'col-md-3 control-label')) }}
- {{Form::text('state', old('state', $item->state), array('class' => 'form-control', 'aria-label'=>'state')) }} + {{Form::text('state', old('state', $item->state), array('class' => 'form-control', 'aria-label'=>'state', 'maxlength'=>'191')) }} {!! $errors->first('state', '') !!}
diff --git a/resources/views/partials/forms/edit/email.blade.php b/resources/views/partials/forms/edit/email.blade.php index dc8a4d8d2c..171367a830 100644 --- a/resources/views/partials/forms/edit/email.blade.php +++ b/resources/views/partials/forms/edit/email.blade.php @@ -1,7 +1,7 @@
- + {!! $errors->first('email', '') !!}
\ No newline at end of file diff --git a/resources/views/partials/forms/edit/eol_date.blade.php b/resources/views/partials/forms/edit/eol_date.blade.php index c6764a3f7c..5efba06a85 100644 --- a/resources/views/partials/forms/edit/eol_date.blade.php +++ b/resources/views/partials/forms/edit/eol_date.blade.php @@ -3,7 +3,7 @@
- +
{!! $errors->first('asset_eol_date', '') !!} diff --git a/resources/views/partials/forms/edit/fax.blade.php b/resources/views/partials/forms/edit/fax.blade.php index 6e8a1d7fd4..7ed4d3070d 100644 --- a/resources/views/partials/forms/edit/fax.blade.php +++ b/resources/views/partials/forms/edit/fax.blade.php @@ -1,7 +1,7 @@
{{ Form::label('fax', trans('admin/suppliers/table.fax'), array('class' => 'col-md-3 control-label')) }}
- {{Form::text('fax', old('fax', $item->fax), array('class' => 'form-control')) }} + {!! $errors->first('fax', '') !!}
\ No newline at end of file diff --git a/resources/views/partials/forms/edit/name.blade.php b/resources/views/partials/forms/edit/name.blade.php index 0a549cc8bf..e192d7d511 100644 --- a/resources/views/partials/forms/edit/name.blade.php +++ b/resources/views/partials/forms/edit/name.blade.php @@ -2,7 +2,7 @@
- + {!! $errors->first('name', '') !!}
diff --git a/resources/views/partials/forms/edit/order_number.blade.php b/resources/views/partials/forms/edit/order_number.blade.php index 1f61aa68ed..86bea1fdb5 100644 --- a/resources/views/partials/forms/edit/order_number.blade.php +++ b/resources/views/partials/forms/edit/order_number.blade.php @@ -2,7 +2,7 @@
- + {!! $errors->first('order_number', '') !!}
diff --git a/resources/views/partials/forms/edit/phone.blade.php b/resources/views/partials/forms/edit/phone.blade.php index 0a21450f31..1a9d407a15 100644 --- a/resources/views/partials/forms/edit/phone.blade.php +++ b/resources/views/partials/forms/edit/phone.blade.php @@ -1,7 +1,7 @@
{{ Form::label('phone', trans('admin/suppliers/table.phone'), array('class' => 'col-md-3 control-label')) }}
- {{Form::text('phone', old('phone', $item->phone), array('class' => 'form-control', 'aria-label'=>'phone')) }} + {{Form::text('phone', old('phone', $item->phone), array('class' => 'form-control', 'aria-label'=>'phone', 'maxlength'=>'191')) }} {!! $errors->first('phone', '') !!}
diff --git a/resources/views/partials/forms/edit/purchase_cost.blade.php b/resources/views/partials/forms/edit/purchase_cost.blade.php index 59be15f061..a99f96d585 100644 --- a/resources/views/partials/forms/edit/purchase_cost.blade.php +++ b/resources/views/partials/forms/edit/purchase_cost.blade.php @@ -3,7 +3,7 @@
- + @if (isset($currency_type)) {{ $currency_type }} diff --git a/resources/views/partials/forms/edit/serial.blade.php b/resources/views/partials/forms/edit/serial.blade.php index ea80cb3817..636204a564 100644 --- a/resources/views/partials/forms/edit/serial.blade.php +++ b/resources/views/partials/forms/edit/serial.blade.php @@ -2,7 +2,7 @@
- + {!! $errors->first('serial', '') !!}
diff --git a/resources/views/partials/forms/edit/username.blade.php b/resources/views/partials/forms/edit/username.blade.php index 41afbd5e47..98bcf67c07 100644 --- a/resources/views/partials/forms/edit/username.blade.php +++ b/resources/views/partials/forms/edit/username.blade.php @@ -3,7 +3,12 @@ $required = $required ?? ''; @endphp
-
-
+
+ +
+
+ +
\ No newline at end of file