mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 14:09:43 -08:00
Short circuit checkout logic to prevent iterating if we're not checking out to an asset
This commit is contained in:
parent
7a76cb08a0
commit
fe74394ae6
|
@ -206,11 +206,13 @@ class BulkAssetsController extends Controller
|
||||||
|
|
||||||
$asset_ids = array_filter($request->get('selected_assets'));
|
$asset_ids = array_filter($request->get('selected_assets'));
|
||||||
|
|
||||||
|
if(request('checkout_to_type') =='asset') {
|
||||||
foreach ($asset_ids as $asset_id) {
|
foreach ($asset_ids as $asset_id) {
|
||||||
if ($target->id == $asset_id && request('checkout_to_type') =='asset') {
|
if ($target->id == $asset_id) {
|
||||||
return redirect()->back()->with('error', 'You cannot check an asset out to itself.');
|
return redirect()->back()->with('error', 'You cannot check an asset out to itself.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$checkout_at = date("Y-m-d H:i:s");
|
$checkout_at = date("Y-m-d H:i:s");
|
||||||
if (($request->filled('checkout_at')) && ($request->get('checkout_at')!= date("Y-m-d"))) {
|
if (($request->filled('checkout_at')) && ($request->get('checkout_at')!= date("Y-m-d"))) {
|
||||||
$checkout_at = e($request->get('checkout_at'));
|
$checkout_at = e($request->get('checkout_at'));
|
||||||
|
|
Loading…
Reference in a new issue