mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
Don't allow amounts <= 0 on purchase/consume
References https://github.com/grocy/grocy/issues/2156#issuecomment-2040336492
This commit is contained in:
parent
6602c76005
commit
af1f2aef96
@ -113,6 +113,12 @@ class StockService extends BaseService
|
||||
throw new \Exception('Product does not exist or is inactive');
|
||||
}
|
||||
|
||||
|
||||
if ($amount <= 0)
|
||||
{
|
||||
throw new \Exception('Amount can\'t be <= 0');
|
||||
}
|
||||
|
||||
$productDetails = (object)$this->GetProductDetails($productId);
|
||||
|
||||
// Tare weight handling
|
||||
@ -356,6 +362,11 @@ class StockService extends BaseService
|
||||
throw new \Exception('Product does not exist or is inactive');
|
||||
}
|
||||
|
||||
if ($amount <= 0)
|
||||
{
|
||||
throw new \Exception('Amount can\'t be <= 0');
|
||||
}
|
||||
|
||||
if ($locationId !== null && !$this->LocationExists($locationId))
|
||||
{
|
||||
throw new \Exception('Location does not exist');
|
||||
|
Loading…
x
Reference in New Issue
Block a user