Merge pull request #13349 from snipe/fixes/check_for_valid_model

Fixed: tighter check for valid model
This commit is contained in:
snipe 2023-07-21 14:52:00 +01:00 committed by GitHub
commit 4fe6632167
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -3,7 +3,7 @@
return array( return array(
'does_not_exist' => 'Model does not exist.', 'does_not_exist' => 'Model does not exist.',
'no_association' => 'NO MODEL ASSOCIATED.', 'no_association' => 'WARNING! The asset model for this item is invalid or missing!',
'no_association_fix' => 'This will break things in weird and horrible ways. Edit this asset now to assign it a model.', 'no_association_fix' => 'This will break things in weird and horrible ways. Edit this asset now to assign it a model.',
'assoc_users' => 'This model is currently associated with one or more assets and cannot be deleted. Please delete the assets, and then try deleting again. ', 'assoc_users' => 'This model is currently associated with one or more assets and cannot be deleted. Please delete the assets, and then try deleting again. ',

View file

@ -75,8 +75,7 @@
@if (!$asset->model) @if (!$asset->model)
<div class="col-md-12"> <div class="col-md-12">
<div class="callout callout-danger"> <div class="callout callout-danger">
<h2>{{ trans('admin/models/message.no_association') }}</h2> <p><strong>{{ trans('admin/models/message.no_association') }}</strong> {{ trans('admin/models/message.no_association_fix') }}</p>
<p>{{ trans('admin/models/message.no_association_fix') }}</p>
</div> </div>
</div> </div>
@endif @endif
@ -183,7 +182,7 @@
</span> </span>
<span class="hidden-xs hidden-sm"> <span class="hidden-xs hidden-sm">
{{ trans('general.additional_files') }} {{ trans('general.additional_files') }}
{!! ($asset->model->uploads->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($asset->model->uploads->count()).'</badge>' : '' !!} {!! ($asset->model) && ($asset->model->uploads->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($asset->model->uploads->count()).'</badge>' : '' !!}
</span> </span>
</a> </a>
</li> </li>
@ -626,7 +625,7 @@
{{ $asset->warranty_months }} {{ $asset->warranty_months }}
{{ trans('admin/hardware/form.months') }} {{ trans('admin/hardware/form.months') }}
@if (($asset->model->manufacturer) && ($asset->model->manufacturer->warranty_lookup_url!='')) @if (($asset->model) && ($asset->model->manufacturer) && ($asset->model->manufacturer->warranty_lookup_url!=''))
<a href="{{ $asset->present()->dynamicWarrantyUrl() }}" target="_blank"> <a href="{{ $asset->present()->dynamicWarrantyUrl() }}" target="_blank">
<i class="fa fa-external-link" aria-hidden="true"><span class="sr-only">{{ trans('admin/hardware/general.mfg_warranty_lookup', ['manufacturer' => $asset->model->manufacturer->name]) }}</span></i> <i class="fa fa-external-link" aria-hidden="true"><span class="sr-only">{{ trans('admin/hardware/general.mfg_warranty_lookup', ['manufacturer' => $asset->model->manufacturer->name]) }}</span></i>
</a> </a>
@ -1305,7 +1304,7 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@if ($asset->model->uploads->count() > 0) @if (($asset->model) && ($asset->model->uploads->count() > 0))
<table <table
class="table table-striped snipe-table" class="table table-striped snipe-table"
id="assetModelFileHistory" id="assetModelFileHistory"