From 60f3d900e806dad1be0978f2839c14cacecb5feb Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Tue, 1 Sep 2020 19:32:28 +0200 Subject: [PATCH] Display "Track date only"-chores as all-day also in iCal API endpoint (references #941) --- changelog/60_UNRELEASED_2020-xx-xx.md | 1 + controllers/CalendarApiController.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/changelog/60_UNRELEASED_2020-xx-xx.md b/changelog/60_UNRELEASED_2020-xx-xx.md index 013b4827..eb788756 100644 --- a/changelog/60_UNRELEASED_2020-xx-xx.md +++ b/changelog/60_UNRELEASED_2020-xx-xx.md @@ -74,6 +74,7 @@ - Fixed that the endpoint `/objects/{entity}/{objectId}` always returned successfully, even when the given object not exists (now returns `404` when the object is not found) (thanks @fipwmaqzufheoxq92ebc) - Fixed that the endpoint `/stock/volatile` didn't include products which expire today (thanks @fipwmaqzufheoxq92ebc) - Fixed that the endpoint `/objects/{entity}` did not include Userfields for Userentities (so the effective endpoint `/objects/userobjects`) +- Endpoint `/calendar/ical`: Fixed that "Track date only"-chores were always set to happen at 12am (are treated as all-day events now) - Fixed (again) that CORS was broken ### General & other improvements/fixes diff --git a/controllers/CalendarApiController.php b/controllers/CalendarApiController.php index f60023d4..e25eb702 100644 --- a/controllers/CalendarApiController.php +++ b/controllers/CalendarApiController.php @@ -22,12 +22,18 @@ class CalendarApiController extends BaseApiController $date->setTime(23, 59, 59); } + $description = ''; + if (isset($event['description'])) + { + $description = $event['description']; + } + $vEvent = new \Eluceo\iCal\Component\Event(); $vEvent->setDtStart($date) ->setDtEnd($date) ->setSummary($event['title']) - ->setDescription($event['description']) - ->setNoTime($event['date_format'] === 'date') + ->setDescription($description) + ->setNoTime($event['date_format'] === 'date' || (isset($event['allDay']) && $event['allDay'])) ->setUseTimezone(true); $vCalendar->addComponent($vEvent);