Allow checkout to non-user objects even if the object requires checkout
This commit is contained in:
parent
76d0562716
commit
15916e6668
2 changed files with 2 additions and 18 deletions
|
@ -190,12 +190,6 @@ class Asset extends Depreciable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->requireAcceptance()) {
|
|
||||||
if(get_class($target) != User::class) {
|
|
||||||
throw new CheckoutNotAllowed;
|
|
||||||
}
|
|
||||||
$this->accepted="pending";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->save()) {
|
if ($this->save()) {
|
||||||
$this->logCheckout($note, $target);
|
$this->logCheckout($note, $target);
|
||||||
|
|
|
@ -47,23 +47,13 @@
|
||||||
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true'])
|
@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'])
|
@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. -->
|
<!-- 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.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'])
|
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'assigned_location', 'style' => 'display:none;', 'required'=>'true'])
|
||||||
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<!-- Checkout/Checkin Date -->
|
<!-- Checkout/Checkin Date -->
|
||||||
<div class="form-group {{ $errors->has('checkout_at') ? 'error' : '' }}">
|
<div class="form-group {{ $errors->has('checkout_at') ? 'error' : '' }}">
|
||||||
|
|
Loading…
Add table
Reference in a new issue