Fixed API response for /api/stock/products/{productId}/inventory when the new amount equals the current stock amount (references #224)

This commit is contained in:
Bernd Bestel
2019-05-03 18:37:02 +02:00
parent 618ff5609f
commit 7fc4992b3a

View File

@@ -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)