Return a proper API response when booking amount for consume/open is > current stock amount (references #170)

This commit is contained in:
Bernd Bestel 2019-03-10 13:50:28 +01:00
parent 75241fc61f
commit 61f582554f
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 4 additions and 4 deletions

View File

@ -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": {

View File

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