mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Fixed #15320 - add deployable status to bulk checkout
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
09b7db5103
commit
716f508067
|
@ -548,7 +548,7 @@ class BulkAssetsController extends Controller
|
|||
public function showCheckout() : View
|
||||
{
|
||||
$this->authorize('checkout', Asset::class);
|
||||
return view('hardware/bulk-checkout');
|
||||
return view('hardware/bulk-checkout')->with('statusLabel_list', Helper::deployableStatusLabelList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -577,6 +577,7 @@ class BulkAssetsController extends Controller
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$checkout_at = date('Y-m-d H:i:s');
|
||||
if (($request->filled('checkout_at')) && ($request->get('checkout_at') != date('Y-m-d'))) {
|
||||
$checkout_at = e($request->get('checkout_at'));
|
||||
|
@ -589,11 +590,15 @@ class BulkAssetsController extends Controller
|
|||
}
|
||||
|
||||
$errors = [];
|
||||
DB::transaction(function () use ($target, $admin, $checkout_at, $expected_checkin, &$errors, $asset_ids, $request) { //NOTE: $errors is passsed by reference!
|
||||
DB::transaction(function () use ($target, $admin, $checkout_at, $expected_checkin, &$errors, $asset_ids, $request) { //NOTE: $errors is passed by reference!
|
||||
foreach ($asset_ids as $asset_id) {
|
||||
$asset = Asset::findOrFail($asset_id);
|
||||
$this->authorize('checkout', $asset);
|
||||
|
||||
if ($request->filled('status_id')) {
|
||||
$asset->status_id = $request->input('status_id');
|
||||
}
|
||||
|
||||
$checkout_success = $asset->checkOut($target, $admin, $checkout_at, $expected_checkin, e($request->get('note')), $asset->name, null);
|
||||
|
||||
//TODO - I think this logic is duplicated in the checkOut method?
|
||||
|
|
|
@ -47,6 +47,17 @@
|
|||
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.asset'), 'asset_selector_div_id' => 'assigned_asset', 'fieldname' => 'assigned_asset', 'unselect' => 'true', 'style' => 'display:none;'])
|
||||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'assigned_location', 'style' => 'display:none;'])
|
||||
|
||||
<!-- Status -->
|
||||
<div class="form-group {{ $errors->has('status_id') ? 'error' : '' }}">
|
||||
<label for="status_id" class="col-md-3 control-label">
|
||||
{{ trans('admin/hardware/form.status') }}
|
||||
</label>
|
||||
<div class="col-md-7">
|
||||
{{ Form::select('status_id', $statusLabel_list, '', array('class'=>'select2', 'style'=>'width:100%','', 'aria-label'=>'status_id')) }}
|
||||
{!! $errors->first('status_id', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Checkout/Checkin Date -->
|
||||
<div class="form-group {{ $errors->has('checkout_at') ? 'error' : '' }}">
|
||||
<label for="checkout_at" class="col-sm-3 control-label">
|
||||
|
|
Loading…
Reference in a new issue