Allow recipe ingredients to be ignored when putting them on the shopping list (closes #125)

This commit is contained in:
Bernd Bestel
2019-03-03 14:49:46 +01:00
parent 89ad25c904
commit e9ef7ea6d8
6 changed files with 71 additions and 6 deletions

View File

@@ -26,14 +26,14 @@ class RecipesService extends BaseService
return $this->DatabaseService->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ);
}
public function AddNotFulfilledProductsToShoppingList($recipeId)
public function AddNotFulfilledProductsToShoppingList($recipeId, $excludedProductIds = null)
{
$recipe = $this->Database->recipes($recipeId);
$recipePositions = $this->GetRecipesFulfillment();
foreach ($recipePositions as $recipePosition)
{
if($recipePosition->recipe_id == $recipeId)
if($recipePosition->recipe_id == $recipeId && !in_array($recipePosition->product_id, $excludedProductIds))
{
$product = $this->Database->products($recipePosition->product_id);