mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Merge pull request #12787 from Godmartinz/accessory_unavailable_message
Added unavailable message to prevent over-checkout of Accessories
This commit is contained in:
commit
383d48fd9c
|
@ -77,6 +77,15 @@ class AccessoryCheckoutController extends Controller
|
|||
'note' => $request->input('note'),
|
||||
]);
|
||||
|
||||
$available= new Accessory();
|
||||
|
||||
|
||||
|
||||
if($available->numRemaining()<=0){
|
||||
|
||||
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