Always use the proper URL for meal plan links in iCal calendar export (references #417)

This commit is contained in:
Bernd Bestel
2019-10-12 10:22:17 +02:00
parent c6ae8cc348
commit 21b9c1a8aa

View File

@@ -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)
);
}
}