mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 11:27:03 +00:00
Fixed meal plan did not load when a containing recipe was deleted (closes #361)
This commit is contained in:
@@ -135,12 +135,19 @@ class RecipesController extends BaseController
|
||||
$events = array();
|
||||
foreach($this->Database->meal_plan() as $mealPlanEntry)
|
||||
{
|
||||
$recipe = FindObjectInArrayByPropertyValue($recipes, 'id', $mealPlanEntry['recipe_id']);
|
||||
$title = '';
|
||||
if ($recipe !== null)
|
||||
{
|
||||
$title = $recipe->name;
|
||||
}
|
||||
|
||||
$events[] = array(
|
||||
'id' => $mealPlanEntry['id'],
|
||||
'title' => FindObjectInArrayByPropertyValue($recipes, 'id', $mealPlanEntry['recipe_id'])->name,
|
||||
'title' => $title,
|
||||
'start' => $mealPlanEntry['day'],
|
||||
'date_format' => 'date',
|
||||
'recipe' => json_encode(FindObjectInArrayByPropertyValue($recipes, 'id', $mealPlanEntry['recipe_id'])),
|
||||
'recipe' => json_encode($recipe),
|
||||
'mealPlanEntry' => json_encode($mealPlanEntry)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user