From 21b9c1a8aaf3c0a6d7e2de7a8be28afab36f1bff Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 12 Oct 2019 10:22:17 +0200 Subject: [PATCH] Always use the proper URL for meal plan links in iCal calendar export (references #417) --- services/CalendarService.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/CalendarService.php b/services/CalendarService.php index 0af223d1..e951cb91 100644 --- a/services/CalendarService.php +++ b/services/CalendarService.php @@ -7,6 +7,7 @@ use \Grocy\Services\TasksService; use \Grocy\Services\ChoresService; use \Grocy\Services\BatteriesService; use \Grocy\Services\UsersService; +use \Grocy\Helpers\UrlManager; class CalendarService extends BaseService { @@ -17,12 +18,14 @@ class CalendarService extends BaseService $this->TasksService = new TasksService(); $this->ChoresService = new ChoresService(); $this->BatteriesService = new BatteriesService(); + $this->UrlManager = new UrlManager(GROCY_BASE_URL); } protected $StockService; protected $TasksService; protected $ChoresService; protected $BatteriesService; + protected $UrlManager; public function GetEvents() { @@ -100,7 +103,7 @@ class CalendarService extends BaseService 'title' => $titlePrefix . FindObjectInArrayByPropertyValue($recipes, 'id', $recipeOfCurrentDay->includes_recipe_id)->name, 'start' => FindObjectInArrayByPropertyValue($recipes, 'id', $recipeOfCurrentDay->recipe_id)->name, 'date_format' => 'date', - 'description' => GROCY_BASE_URL . '/mealplan' . '?week=' . FindObjectInArrayByPropertyValue($recipes, 'id', $recipeOfCurrentDay->recipe_id)->name + 'description' => $this->UrlManager->ConstructUrl('/mealplan' . '?week=' . FindObjectInArrayByPropertyValue($recipes, 'id', $recipeOfCurrentDay->recipe_id)->name) ); } }