Fixed recipe consume stock fulfillment checking (frontend and API) (fixes #1781)

This commit is contained in:
Bernd Bestel
2022-02-12 22:08:10 +01:00
parent 8e3a9d6c04
commit 1344e84534
4 changed files with 79 additions and 8 deletions

View File

@@ -74,6 +74,12 @@ class RecipesService extends BaseService
throw new \Exception('Recipe does not exist');
}
$recipeResolved = $this->getDatabase()->recipes_resolved()->where('recipe_id', $recipeId)->fetch();
if ($recipeResolved->need_fulfilled == 0)
{
throw new \Exception('Recipe need is not fulfilled, consuming not possible');
}
$transactionId = uniqid();
$recipePositions = $this->getDatabase()->recipes_pos_resolved()->where('recipe_id', $recipeId)->fetchAll();