Fixed #6301: Do not allow duplicate asset tags (#6324)

* Fixed #6301: Do not allow duplicate asset tags

* Display error message for single asset_tag failure
This commit is contained in:
Joe Ferguson 2018-10-11 19:15:09 -05:00 committed by snipe
parent b8f8d49927
commit 704209de9c
2 changed files with 3 additions and 2 deletions

View file

@ -171,8 +171,8 @@ class AssetsController extends Controller
} }
} }
// Was the asset created? // Validate the asset before saving
if ($asset->save()) { if ($asset->isValid() && $asset->save()) {
if (request('assigned_user')) { if (request('assigned_user')) {
$target = User::find(request('assigned_user')); $target = User::find(request('assigned_user'));

View file

@ -35,6 +35,7 @@
</div> </div>
@endif @endif
{!! $errors->first('asset_tags', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('asset_tags', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
{!! $errors->first('asset_tag', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div> </div>
@include ('partials.forms.edit.serial', ['fieldname'=> 'serials[1]', 'translated_serial' => trans('admin/hardware/form.serial')]) @include ('partials.forms.edit.serial', ['fieldname'=> 'serials[1]', 'translated_serial' => trans('admin/hardware/form.serial')])