mirror of
https://github.com/snipe/snipe-it.git
synced 2026-02-05 02:15:41 +00:00
Fixes #18377 - make min value for names consistent
This commit is contained in:
@ -61,7 +61,7 @@ class Accessory extends SnipeModel
|
||||
* Accessory validation rules
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'required|min:3|max:255',
|
||||
'name' => 'required|max:255',
|
||||
'qty' => 'required|integer|min:1',
|
||||
'category_id' => 'required|integer|exists:categories,id',
|
||||
'company_id' => 'integer|nullable',
|
||||
|
||||
@ -27,10 +27,10 @@ final class Company extends SnipeModel
|
||||
|
||||
// Declare the rules for the model validation
|
||||
protected $rules = [
|
||||
'name' => 'required|min:1|max:255|unique:companies,name',
|
||||
'name' => 'required|max:255|unique:companies,name',
|
||||
'fax' => 'min:7|max:35|nullable',
|
||||
'phone' => 'min:7|max:35|nullable',
|
||||
'email' => 'email|max:150|nullable',
|
||||
'email' => 'email|max:150|nullable',
|
||||
];
|
||||
|
||||
protected $presenter = \App\Presenters\CompanyPresenter::class;
|
||||
|
||||
@ -36,7 +36,7 @@ class Component extends SnipeModel
|
||||
* Category validation rules
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'required|min:3|max:191',
|
||||
'name' => 'required|max:191',
|
||||
'qty' => 'required|integer|min:1',
|
||||
'category_id' => 'required|integer|exists:categories,id',
|
||||
'supplier_id' => 'nullable|integer|exists:suppliers,id',
|
||||
|
||||
@ -42,7 +42,7 @@ class Consumable extends SnipeModel
|
||||
* Category validation rules
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'required|min:3|max:255',
|
||||
'name' => 'required|max:255',
|
||||
'qty' => 'required|integer|min:0|max:99999',
|
||||
'category_id' => 'required|integer',
|
||||
'company_id' => 'integer|nullable',
|
||||
|
||||
@ -15,7 +15,7 @@ class Depreciation extends SnipeModel
|
||||
use Presentable;
|
||||
// Declare the rules for the form validation
|
||||
protected $rules = [
|
||||
'name' => 'required|min:3|max:255|unique:depreciations,name',
|
||||
'name' => 'required|max:255|unique:depreciations,name',
|
||||
'months' => 'required|max:3600|integer',
|
||||
];
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ class Group extends SnipeModel
|
||||
protected $table = 'permission_groups';
|
||||
|
||||
public $rules = [
|
||||
'name' => 'required|min:2|max:255|unique',
|
||||
'name' => 'required|max:255|unique',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
|
||||
@ -47,7 +47,7 @@ class License extends Depreciable
|
||||
];
|
||||
|
||||
protected $rules = [
|
||||
'name' => 'required|string|min:3|max:255',
|
||||
'name' => 'required|string|max:255',
|
||||
'seats' => 'required|min:1|integer|limit_change:10000', // limit_change is a "pseudo-rule" that translates into 'between', see prepareLimitChangeRule() below
|
||||
'license_email' => 'email|nullable|max:120',
|
||||
'license_name' => 'string|nullable|max:100',
|
||||
|
||||
@ -26,7 +26,7 @@ class Location extends SnipeModel
|
||||
|
||||
protected $table = 'locations';
|
||||
protected $rules = [
|
||||
'name' => 'required|min:2|max:255|unique_undeleted',
|
||||
'name' => 'required|max:255|unique_undeleted',
|
||||
'address' => 'max:191|nullable',
|
||||
'address2' => 'max:191|nullable',
|
||||
'city' => 'max:191|nullable',
|
||||
|
||||
@ -21,7 +21,7 @@ class Manufacturer extends SnipeModel
|
||||
|
||||
// Declare the rules for the form validation
|
||||
protected $rules = [
|
||||
'name' => 'required|min:2|max:255|unique:manufacturers,name,NULL,id,deleted_at,NULL',
|
||||
'name' => 'required|max:255|unique:manufacturers,name,NULL,id,deleted_at,NULL',
|
||||
'url' => 'nullable|starts_with:http://,https://,afp://,facetime://,file://,irc://',
|
||||
'support_email' => 'email|nullable',
|
||||
'support_url' => 'nullable|starts_with:http://,https://,afp://,facetime://,file://,irc://',
|
||||
|
||||
@ -25,7 +25,7 @@ class PredefinedKit extends SnipeModel
|
||||
* Category validation rules
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'required|min:1|max:255|unique',
|
||||
'name' => 'required|max:255|unique',
|
||||
];
|
||||
|
||||
use ValidatingTrait;
|
||||
|
||||
@ -21,7 +21,7 @@ class Statuslabel extends SnipeModel
|
||||
protected $hidden = ['user_id', 'deleted_at'];
|
||||
|
||||
protected $rules = [
|
||||
'name' => 'required|string|unique_undeleted',
|
||||
'name' => 'required|max:255|string|unique_undeleted',
|
||||
'notes' => 'string|nullable',
|
||||
'deployable' => 'required',
|
||||
'pending' => 'required',
|
||||
|
||||
@ -23,7 +23,7 @@ class Supplier extends SnipeModel
|
||||
protected $table = 'suppliers';
|
||||
|
||||
protected $rules = [
|
||||
'name' => 'required|min:1|max:255|unique_undeleted',
|
||||
'name' => 'required|max:255|unique_undeleted',
|
||||
'fax' => 'min:7|max:35|nullable',
|
||||
'phone' => 'min:7|max:35|nullable',
|
||||
'contact' => 'max:100|nullable',
|
||||
|
||||
@ -105,7 +105,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
*/
|
||||
|
||||
protected $rules = [
|
||||
'first_name' => 'required|string|min:1|max:191',
|
||||
'first_name' => 'required|string|max:191',
|
||||
'last_name' => 'nullable|string|max:191',
|
||||
'display_name' => 'nullable|string|max:191',
|
||||
'username' => 'required|string|min:1|unique_undeleted|max:191',
|
||||
|
||||
@ -206,7 +206,7 @@ return [
|
||||
'manufacturers' => 'Manufacturers',
|
||||
'markdown' => 'This field allows <a href="https://help.github.com/articles/github-flavored-markdown/">Github flavored markdown</a>.',
|
||||
'min_amt' => 'Min. QTY',
|
||||
'min_amt_help' => 'Minimum number of items that should be available before an alert gets triggered. Leave Min. QTY blank if you do not want to receive alerts for low inventory.',
|
||||
'min_amt_help' => 'Minimum number of this item that should be available for checkout before an alert gets triggered. Leave blank if you do not wish to receive alerts for low inventory.',
|
||||
'model_no' => 'Model No.',
|
||||
'months' => 'months',
|
||||
'moreinfo' => 'More Info',
|
||||
|
||||
@ -15,8 +15,10 @@
|
||||
@section('inputFields')
|
||||
|
||||
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'), 'fieldname' => 'company_id'])
|
||||
@include ('partials.forms.edit.name', ['translated_name' => trans('admin/consumables/table.title')])
|
||||
@include ('partials.forms.edit.name', ['translated_name' => trans('general.name')])
|
||||
@include ('partials.forms.edit.category-select', ['translated_name' => trans('general.category'), 'fieldname' => 'category_id', 'required' => 'true', 'category_type' => 'consumable'])
|
||||
@include ('partials.forms.edit.quantity')
|
||||
@include ('partials.forms.edit.minimum_quantity')
|
||||
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
|
||||
@include ('partials.forms.edit.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'manufacturer_id'])
|
||||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
|
||||
@ -25,8 +27,6 @@
|
||||
@include ('partials.forms.edit.order_number')
|
||||
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.purchase_date'),'fieldname' => 'purchase_date'])
|
||||
@include ('partials.forms.edit.purchase_cost', [ 'unit_cost' => trans('general.unit_cost')])
|
||||
@include ('partials.forms.edit.quantity')
|
||||
@include ('partials.forms.edit.minimum_quantity')
|
||||
@include ('partials.forms.edit.notes')
|
||||
@include ('partials.forms.edit.image-upload', ['image_path' => app('consumables_upload_path')])
|
||||
|
||||
|
||||
@ -2,17 +2,17 @@
|
||||
<div class="form-group{{ $errors->has('min_amt') ? ' has-error' : '' }}">
|
||||
<label for="min_amt" class="col-md-3 control-label">{{ trans('general.min_amt') }}</label>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-2" style="padding-left:0px">
|
||||
<input class="form-control col-md-3" maxlength="5" type="text" name="min_amt" id="min_amt"
|
||||
<div class="col-md-3" style="padding-left:0px">
|
||||
<input class="form-control col-md-3" maxlength="5" type="number" name="min_amt" id="min_amt"
|
||||
aria-label="min_amt"
|
||||
min="0"
|
||||
value="{{ old('min_amt', ($item->min_amt ?? '')) }}"
|
||||
{{ (isset($item) && (Helper::checkIfRequired($item, 'min_amt')) ? ' required' : '') }}/>
|
||||
</div>
|
||||
<div class="col-md-7" style="margin-left: -15px;">
|
||||
<x-form-tooltip>
|
||||
{{ trans('general.min_amt_help') }}
|
||||
</x-form-tooltip>
|
||||
</a>
|
||||
<div class="col-md-7" style="margin-left: -15px;">
|
||||
<x-form-tooltip>
|
||||
{{ trans('general.min_amt_help') }}
|
||||
</x-form-tooltip>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
{!! $errors->first('min_amt', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
<!-- QTY -->
|
||||
<div class="form-group {{ $errors->has('qty') ? ' has-error' : '' }}">
|
||||
<label for="qty" class="col-md-3 control-label">{{ trans('general.quantity') }}</label>
|
||||
<div class="col-md-7">
|
||||
<div class="col-md-3" style="padding-left:0px">
|
||||
<input class="form-control" maxlength="5" type="text" name="qty" aria-label="qty" id="qty" value="{{ old('qty', $item->qty) }}" {!! (Helper::checkIfRequired($item, 'qty')) ? ' required ' : '' !!}/>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-3" style="padding-left:0">
|
||||
<input class="form-control" maxlength="5" min="1" type="number" name="qty" aria-label="qty" id="qty" value="{{ old('qty', $item->qty) }}" {!! (Helper::checkIfRequired($item, 'qty')) ? ' required ' : '' !!}/>
|
||||
</div>
|
||||
<div class="col-md-12" style="padding-left:0px">
|
||||
<div class="col-md-12" style="padding-left:0">
|
||||
{!! $errors->first('qty', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user