mirror of
https://github.com/grocy/grocy.git
synced 2025-04-28 17:23:56 +00:00
Fixed StockService->ConsumeProduct $productStockAmount check (fixes #1949)
This commit is contained in:
parent
e64df711e2
commit
0b532f7624
@ -10,6 +10,7 @@
|
||||
|
||||
- Fixed that the average shelf life of a product (on the productcard) was wrong when the corresponding stock entry was edited
|
||||
- Fixed that when the stock setting "Decimal places allowed for amounts" was set to `0`, unit conversion (if any) failed when adding the corresponding product to stock
|
||||
- Fixed that consuming a parent product which is not in stock itself (so essentially using any of the child products) may failed when unit conversions were involved (the current stock amount check was wrong in that case)
|
||||
|
||||
### Shopping list
|
||||
|
||||
|
@ -406,7 +406,7 @@ class StockService extends BaseService
|
||||
$potentialStockEntries = FindAllObjectsInArrayByPropertyValue($potentialStockEntries, 'stock_id', $specificStockEntryId);
|
||||
}
|
||||
|
||||
$productStockAmount = SumArrayValue($potentialStockEntries, 'amount');
|
||||
$productStockAmount = floatval($productDetails->stock_amount_aggregated);
|
||||
if ($amount > $productStockAmount)
|
||||
{
|
||||
throw new \Exception('Amount to be consumed cannot be > current stock amount (if supplied, at the desired location)');
|
||||
|
Loading…
x
Reference in New Issue
Block a user