mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 01:55:47 +00:00
Fix recipes page (#638)
* My config * Add check to see if any recipe is selected * Add check to see if a recipe is actually selected Co-authored-by: Marc Runkel <marc.runkel@plusforta.de>
This commit is contained in:
parent
03566d0644
commit
03eee1329c
@ -33,6 +33,20 @@ class RecipesController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$renderArray = [
|
||||||
|
'recipes' => $recipes,
|
||||||
|
'recipesResolved' => $recipesResolved,
|
||||||
|
'recipePositionsResolved' => $this->getDatabase()->recipes_pos_resolved()->where('recipe_type', RecipesService::RECIPE_TYPE_NORMAL),
|
||||||
|
'selectedRecipe' => $selectedRecipe,
|
||||||
|
'selectedRecipePositionsResolved' => $selectedRecipePositionsResolved,
|
||||||
|
'products' => $this->getDatabase()->products(),
|
||||||
|
'quantityUnits' => $this->getDatabase()->quantity_units(),
|
||||||
|
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
|
||||||
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('recipes'),
|
||||||
|
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($selectedRecipe) {
|
||||||
$selectedRecipeSubRecipes = $this->getDatabase()->recipes()->where('id IN (SELECT includes_recipe_id FROM recipes_nestings_resolved WHERE recipe_id = :1 AND includes_recipe_id != :1)', $selectedRecipe->id)->orderBy('name')->fetchAll();
|
$selectedRecipeSubRecipes = $this->getDatabase()->recipes()->where('id IN (SELECT includes_recipe_id FROM recipes_nestings_resolved WHERE recipe_id = :1 AND includes_recipe_id != :1)', $selectedRecipe->id)->orderBy('name')->fetchAll();
|
||||||
$selectedRecipeSubRecipesPositions = $this->getDatabase()->recipes_pos_resolved()->where('recipe_id = :1', $selectedRecipe->id)->orderBy('ingredient_group', 'ASC', 'product_group', 'ASC')->fetchAll();
|
$selectedRecipeSubRecipesPositions = $this->getDatabase()->recipes_pos_resolved()->where('recipe_id = :1', $selectedRecipe->id)->orderBy('ingredient_group', 'ASC', 'product_group', 'ASC')->fetchAll();
|
||||||
|
|
||||||
@ -42,8 +56,7 @@ class RecipesController extends BaseController
|
|||||||
{
|
{
|
||||||
$includedRecipeIdsAbsolute[] = $subRecipe->id;
|
$includedRecipeIdsAbsolute[] = $subRecipe->id;
|
||||||
}
|
}
|
||||||
|
$renderArray = [
|
||||||
return $this->renderPage($response, 'recipes', [
|
|
||||||
'recipes' => $recipes,
|
'recipes' => $recipes,
|
||||||
'recipesResolved' => $recipesResolved,
|
'recipesResolved' => $recipesResolved,
|
||||||
'recipePositionsResolved' => $this->getDatabase()->recipes_pos_resolved()->where('recipe_type', RecipesService::RECIPE_TYPE_NORMAL),
|
'recipePositionsResolved' => $this->getDatabase()->recipes_pos_resolved()->where('recipe_type', RecipesService::RECIPE_TYPE_NORMAL),
|
||||||
@ -59,7 +72,12 @@ class RecipesController extends BaseController
|
|||||||
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
|
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
|
||||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('recipes'),
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('recipes'),
|
||||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved()
|
||||||
]);
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this->renderPage($response, 'recipes', $renderArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function RecipeEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function RecipeEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user