From 411dbabc90f00adf17404ea49d8434c311c66547 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Tue, 8 Feb 2022 19:09:17 +0100 Subject: [PATCH] Show the meal plan section for a meal plan entry types on the calendar (references #1582) --- changelog/66_UNRELEASED_xxxx-xx-xx.md | 2 +- services/CalendarService.php | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/changelog/66_UNRELEASED_xxxx-xx-xx.md b/changelog/66_UNRELEASED_xxxx-xx-xx.md index 87d53737..591b6173 100644 --- a/changelog/66_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/66_UNRELEASED_xxxx-xx-xx.md @@ -79,5 +79,5 @@ ### API - The API endpoint `/stock/shoppinglist/clear` has now a new optional request body parameter `done_only` (to only remove done items from the given shopping list, defaults to `false`) -- The API endpoint `/chores/{choreId}/execute` has now a new optional request body parameter `skipped` (to skip the next chore schedule) +- The API endpoint `/chores/{choreId}/execute` has now a new optional request body parameter `skipped` (to skip the next chore schedule, defaults to `false`) - Fixed that the barcode lookup for the "Stock by-barcode" API endpoints was case sensitive diff --git a/services/CalendarService.php b/services/CalendarService.php index 802fcb3a..265fb9d0 100644 --- a/services/CalendarService.php +++ b/services/CalendarService.php @@ -144,8 +144,15 @@ class CalendarService extends BaseService $dateFormat = 'datetime'; } + $titlePrefix2 = ''; + if (!empty($section->name)) + { + $titlePrefix2 = $section->name . ': '; + } + + $mealPlanNotesEvents[] = [ - 'title' => $titlePrefix . $mealPlanDayNote->note, + 'title' => $titlePrefix . $titlePrefix2 . $mealPlanDayNote->note, 'start' => $start, 'date_format' => $dateFormat ]; @@ -165,8 +172,14 @@ class CalendarService extends BaseService $dateFormat = 'datetime'; } + $titlePrefix2 = ''; + if (!empty($section->name)) + { + $titlePrefix2 = $section->name . ': '; + } + $mealPlanProductEvents[] = [ - 'title' => $titlePrefix . FindObjectInArrayByPropertyValue($products, 'id', $mealPlanDayProduct->product_id)->name, + 'title' => $titlePrefix . $titlePrefix2 . FindObjectInArrayByPropertyValue($products, 'id', $mealPlanDayProduct->product_id)->name, 'start' => $start, 'date_format' => $dateFormat ];