mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
adds unavailable message to overcheckout
This commit is contained in:
parent
ead5293ee0
commit
b038fe8f2e
|
@ -77,6 +77,14 @@ class AccessoryCheckoutController extends Controller
|
|||
'note' => $request->input('note'),
|
||||
]);
|
||||
|
||||
$checkedout=DB::table('accessories_users')->where('accessory_id', '=', $accessory->id)->count();
|
||||
$available=DB::table('accessories')->where('id', '=', $accessory->id)->first('qty');
|
||||
|
||||
if($checkedout >= $available->qty){
|
||||
|
||||
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.checkout.unavailable'));
|
||||
}
|
||||
|
||||
DB::table('accessories_users')->where('assigned_to', '=', $accessory->assigned_to)->where('accessory_id', '=', $accessory->id)->first();
|
||||
|
||||
event(new CheckoutableCheckedOut($accessory, $user, Auth::user(), $request->input('note')));
|
||||
|
|
|
@ -24,6 +24,7 @@ return array(
|
|||
'checkout' => array(
|
||||
'error' => 'Accessory was not checked out, please try again',
|
||||
'success' => 'Accessory checked out successfully.',
|
||||
'unavailable' => 'Accessory is not available for checkout. Check quantity available',
|
||||
'user_does_not_exist' => 'That user is invalid. Please try again.'
|
||||
),
|
||||
|
||||
|
|
Loading…
Reference in a new issue