mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Return a proper API response when booking amount for consume/open is > current stock amount (references #170)
This commit is contained in:
parent
75241fc61f
commit
61f582554f
@ -1185,7 +1185,7 @@
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "The operation was not successful (possible errors are: Not existing product, invalid transaction type)",
|
||||
"description": "The operation was not successful (possible errors are: Not existing product, invalid transaction type, given amount > current stock amount)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
@ -1311,7 +1311,7 @@
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "The operation was not successful (possible errors are: Not existing product)",
|
||||
"description": "The operation was not successful (possible errors are: Not existing product, given amount > current unopened stock amount)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
|
@ -221,7 +221,7 @@ class StockService extends BaseService
|
||||
|
||||
if ($amount > $productStockAmount)
|
||||
{
|
||||
return false;
|
||||
throw new \Exception('Amount to be consumed cannot be > current stock amount');
|
||||
}
|
||||
|
||||
if ($specificStockEntryId !== 'default')
|
||||
@ -347,7 +347,7 @@ class StockService extends BaseService
|
||||
|
||||
if ($amount > $productStockAmountUnopened)
|
||||
{
|
||||
return false;
|
||||
throw new \Exception('Amount to be opened cannot be > current unopened stock amount');
|
||||
}
|
||||
|
||||
if ($specificStockEntryId !== 'default')
|
||||
|
Loading…
x
Reference in New Issue
Block a user