From 7fc4992b3ace309aab285beaf2df7fd535700888 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Fri, 3 May 2019 18:37:02 +0200 Subject: [PATCH] Fixed API response for /api/stock/products/{productId}/inventory when the new amount equals the current stock amount (references #224) --- services/StockService.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/StockService.php b/services/StockService.php index aeab8142..399cac11 100644 --- a/services/StockService.php +++ b/services/StockService.php @@ -321,7 +321,11 @@ class StockService extends BaseService $containerWeight = $productDetails->product->tare_weight; } - if ($newAmount > $productDetails->stock_amount + $containerWeight) + if ($newAmount == $productDetails->stock_amount + $containerWeight) + { + throw new \Exception('The new amount cannot equal the current stock amount'); + } + else if ($newAmount > $productDetails->stock_amount + $containerWeight) { $bookingAmount = $newAmount - $productDetails->stock_amount; if ($productDetails->product->enable_tare_weight_handling == 1)