Allow checkout to non-user objects even if the object requires checkout

This commit is contained in:
snipe 2018-05-21 17:35:04 -07:00
parent 76d0562716
commit 15916e6668
2 changed files with 2 additions and 18 deletions

View file

@ -189,13 +189,7 @@ class Asset extends Depreciable
$this->location_id = $target->location->id;
}
}
if ($this->requireAcceptance()) {
if(get_class($target) != User::class) {
throw new CheckoutNotAllowed;
}
$this->accepted="pending";
}
if ($this->save()) {
$this->logCheckout($note, $target);

View file

@ -47,23 +47,13 @@
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true'])
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'fieldname' => 'assigned_user', 'required'=>'true'])
@if ($asset->requireAcceptance())
<div class="form-group">
<div class="col-md-8 col-md-offset-3">
<p class="help-block">
Because this asset category requires acceptance,
it cannot be checked out to another asset or to a location.
</p>
</div>
</div>
@else
<!-- We have to pass unselect here so that we don't default to the asset that's being checked out. We want that asset to be pre-selected everywhere else. -->
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.asset'), 'fieldname' => 'assigned_asset', 'unselect' => 'true', 'style' => 'display:none;', 'required'=>'true'])
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'assigned_location', 'style' => 'display:none;', 'required'=>'true'])
@endif
<!-- Checkout/Checkin Date -->
<div class="form-group {{ $errors->has('checkout_at') ? 'error' : '' }}">