Merge pull request #12985 from snipe/fixes/increase_state_from_3_chars

Increase state from 3 chars
This commit is contained in:
snipe 2023-05-08 15:08:44 -07:00 committed by GitHub
commit 17efc78816
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 17 deletions

View file

@ -26,11 +26,12 @@ class Location extends SnipeModel
protected $table = 'locations'; protected $table = 'locations';
protected $rules = [ protected $rules = [
'name' => 'required|min:2|max:255|unique_undeleted', 'name' => 'required|min:2|max:255|unique_undeleted',
'city' => 'min:2|max:255|nullable', 'address' => 'max:191|nullable',
'country' => 'min:2|max:255|nullable', 'address2' => 'max:191|nullable',
'address' => 'max:80|nullable', 'city' => 'max:191|nullable',
'address2' => 'max:80|nullable', 'state' => 'min:2|max:191|nullable',
'zip' => 'min:3|max:12|nullable', 'country' => 'min:2|max:191|nullable',
'zip' => 'max:10|nullable',
'manager_id' => 'exists:users,id|nullable', 'manager_id' => 'exists:users,id|nullable',
'parent_id' => 'non_circular:locations,id', 'parent_id' => 'non_circular:locations,id',
]; ];

View file

@ -16,17 +16,17 @@ class Supplier extends SnipeModel
protected $table = 'suppliers'; protected $table = 'suppliers';
protected $rules = [ protected $rules = [
'name' => 'required|min:1|max:255|unique_undeleted', 'name' => 'required|min:1|max:255|unique_undeleted',
'address' => 'max:250|nullable',
'address2' => 'max:250|nullable',
'city' => 'max:255|nullable',
'state' => 'max:32|nullable',
'country' => 'max:3|nullable',
'fax' => 'min:7|max:35|nullable', 'fax' => 'min:7|max:35|nullable',
'phone' => 'min:7|max:35|nullable', 'phone' => 'min:7|max:35|nullable',
'contact' => 'max:100|nullable', 'contact' => 'max:100|nullable',
'notes' => 'max:191|nullable', // Default string length is 191 characters.. 'notes' => 'max:191|nullable', // Default string length is 191 characters..
'email' => 'email|max:150|nullable', 'email' => 'email|max:150|nullable',
'address' => 'max:250|nullable',
'address2' => 'max:250|nullable',
'city' => 'max:191|nullable',
'state' => 'min:2|max:191|nullable',
'country' => 'min:2|max:191|nullable',
'zip' => 'max:10|nullable', 'zip' => 'max:10|nullable',
'url' => 'sometimes|nullable|string|max:250', 'url' => 'sometimes|nullable|string|max:250',
]; ];

View file

@ -98,6 +98,11 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
'start_date' => 'nullable|date_format:Y-m-d', 'start_date' => 'nullable|date_format:Y-m-d',
'end_date' => 'nullable|date_format:Y-m-d|after_or_equal:start_date', 'end_date' => 'nullable|date_format:Y-m-d|after_or_equal:start_date',
'autoassign_licenses' => 'boolean', 'autoassign_licenses' => 'boolean',
'address' => 'max:191|nullable',
'city' => 'max:191|nullable',
'state' => 'min:2|max:191|nullable',
'country' => 'min:2|max:191|nullable',
'zip' => 'max:10|nullable',
]; ];
/** /**

View file

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class IncreaseStateToMoreThan3 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('state', 191)->nullable()->default(null)->change();
});
Schema::table('suppliers', function (Blueprint $table) {
$table->string('state', 191)->nullable()->default(null)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->string('state', 3)->nullable()->default(null)->change();
});
Schema::table('suppliers', function (Blueprint $table) {
$table->string('state', 32)->nullable()->default(null)->change();
});
}
}

View file

@ -1,7 +1,7 @@
<div class="form-group {{ $errors->has('address') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('address') ? ' has-error' : '' }}">
{{ Form::label('address', trans('general.address'), array('class' => 'col-md-3 control-label')) }} {{ Form::label('address', trans('general.address'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7"> <div class="col-md-7">
{{Form::text('address', old('address', $item->address), array('class' => 'form-control', 'aria-label'=>'address')) }} {{Form::text('address', old('address', $item->address), array('class' => 'form-control', 'aria-label'=>'address', 'maxlength'=>'191')) }}
{!! $errors->first('address', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!} {!! $errors->first('address', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div> </div>
</div> </div>
@ -9,13 +9,13 @@
<div class="form-group {{ $errors->has('address2') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('address2') ? ' has-error' : '' }}">
<label class="sr-only " for="address2">{{ trans('general.address') }}</label> <label class="sr-only " for="address2">{{ trans('general.address') }}</label>
<div class="col-md-7 col-md-offset-3"> <div class="col-md-7 col-md-offset-3">
{{Form::text('address2', old('address2', $item->address2), array('class' => 'form-control', 'aria-label'=>'address2')) }} {{Form::text('address2', old('address2', $item->address2), array('class' => 'form-control', 'aria-label'=>'address2', 'maxlength'=>'191')) }}
{!! $errors->first('address2', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!} {!! $errors->first('address2', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div> </div>
</div> </div>
<div class="form-group {{ $errors->has('city') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('city') ? ' has-error' : '' }}">
{{ Form::label('city', trans('general.city'), array('class' => 'col-md-3 control-label')) }} {{ Form::label('city', trans('general.city'), array('class' => 'col-md-3 control-label', 'maxlength'=>'191')) }}
<div class="col-md-7"> <div class="col-md-7">
{{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')) }}
{!! $errors->first('city', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!} {!! $errors->first('city', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
@ -23,7 +23,7 @@
</div> </div>
<div class="form-group {{ $errors->has('state') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('state') ? ' has-error' : '' }}">
{{ Form::label('state', trans('general.state'), array('class' => 'col-md-3 control-label')) }} {{ Form::label('state', trans('general.state'), array('class' => 'col-md-3 control-label', 'maxlength'=>'191')) }}
<div class="col-md-7"> <div class="col-md-7">
{{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')) }}
{!! $errors->first('state', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!} {!! $errors->first('state', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
@ -40,7 +40,7 @@
</div> </div>
<div class="form-group {{ $errors->has('zip') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('zip') ? ' has-error' : '' }}">
{{ Form::label('zip', trans('general.zip'), array('class' => 'col-md-3 control-label')) }} {{ Form::label('zip', trans('general.zip'), array('class' => 'col-md-3 control-label', 'maxlength'=>'10')) }}
<div class="col-md-7"> <div class="col-md-7">
{{Form::text('zip', old('zip', $item->zip), array('class' => 'form-control')) }} {{Form::text('zip', old('zip', $item->zip), array('class' => 'form-control')) }}
{!! $errors->first('zip', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!} {!! $errors->first('zip', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}

View file

@ -441,7 +441,7 @@
<div class="form-group{{ $errors->has('state') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('state') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="state">{{ trans('general.state') }}</label> <label class="col-md-3 control-label" for="state">{{ trans('general.state') }}</label>
<div class="col-md-6"> <div class="col-md-6">
<input class="form-control" type="text" name="state" id="state" value="{{ old('state', $user->state) }}" maxlength="3" /> <input class="form-control" type="text" name="state" id="state" value="{{ old('state', $user->state) }}" maxlength="191" />
{!! $errors->first('state', '<span class="alert-msg" aria-hidden="true">:message</span>') !!} {!! $errors->first('state', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div> </div>
</div> </div>