From 405c3efad14b2ef254a3e7ec91e2eed32a70b04c Mon Sep 17 00:00:00 2001 From: Kurt Riddlesperger Date: Wed, 29 Jan 2020 22:55:49 -0600 Subject: [PATCH] Limit mealplan products dropdown based on include_in_mealplan product variable --- controllers/RecipesController.php | 2 +- migrations/0097.sql | 3 +++ views/productform.blade.php | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/controllers/RecipesController.php b/controllers/RecipesController.php index 5d63454a..8b319e15 100644 --- a/controllers/RecipesController.php +++ b/controllers/RecipesController.php @@ -169,7 +169,7 @@ class RecipesController extends BaseController 'recipes' => $recipes, 'internalRecipes' => $this->Database->recipes()->whereNot('type', RecipesService::RECIPE_TYPE_NORMAL)->fetchAll(), 'recipesResolved' => $this->RecipesService->GetRecipesResolved(), - 'products' => $this->Database->products()->orderBy('name'), + 'products' => $this->Database->products()->where('include_in_mealplan', '1')->orderBy('name'), 'quantityUnits' => $this->Database->quantity_units()->orderBy('name'), 'quantityUnitConversionsResolved' => $this->Database->quantity_unit_conversions_resolved() ]); diff --git a/migrations/0097.sql b/migrations/0097.sql index 269911ef..f3010f54 100644 --- a/migrations/0097.sql +++ b/migrations/0097.sql @@ -1,3 +1,6 @@ +ALTER TABLE products +ADD include_in_mealplan TINYINT NOT NULL DEFAULT 0; + ALTER TABLE products ADD default_best_before_days_after_freezing INTEGER NOT NULL DEFAULT 0; diff --git a/views/productform.blade.php b/views/productform.blade.php index 8b74dd29..c757609e 100644 --- a/views/productform.blade.php +++ b/views/productform.blade.php @@ -252,6 +252,16 @@ @endif +
+
+ + include_in_mealplan == 1) checked @endif class="form-check-input" type="checkbox" id="include_in_mealplan" name="include_in_mealplan" value="1"> + +
+
+