Fix qty requirements for Components API checkout

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-10-09 16:32:30 +01:00
parent 7a0d3f788f
commit b9dc7f88d0

View file

@ -263,7 +263,7 @@ class ComponentsController extends Controller
} }
// Make sure there is at least one available to checkout // Make sure there is at least one available to checkout
if ($component->numRemaining() <= $request->get('assigned_qty')) { if ($component->numRemaining() < $request->get('assigned_qty')) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/components/message.checkout.unavailable', ['remaining' => $component->numRemaining(), 'requested' => $request->get('assigned_qty')]))); return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/components/message.checkout.unavailable', ['remaining' => $component->numRemaining(), 'requested' => $request->get('assigned_qty')])));
} }