Skip to content
Snippets Groups Projects
Commit 97a2a3e3 authored by Peter Thienel's avatar Peter Thienel Committed by Moritz Strohm
Browse files

set the correct end time of the event and calculate duration of the event...

set the correct end time of the event and calculate duration of the event considering the DST, re #3843
parent d7772008
No related branches found
No related tags found
No related merge requests found
...@@ -278,7 +278,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event ...@@ -278,7 +278,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event
$events_created[$event->calendar_date->id . '_' . $event->calendar_date->begin] = $event; $events_created[$event->calendar_date->id . '_' . $event->calendar_date->begin] = $event;
} }
} elseif ($e_expire > $cal_start) { } elseif ($e_expire > $cal_start) {
$events_created = array_merge($events_created, self::getRepetition($event, $cal_noon, true)); $events_created = array_merge($events_created, self::getRepetition($event, $cal_noon));
} }
} }
...@@ -400,7 +400,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event ...@@ -400,7 +400,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event
$time_end = $date_end->format('H:i:s'); $time_end = $date_end->format('H:i:s');
$rec_date_begin = $date_time->modify(sprintf('today %s', $time_begin)); $rec_date_begin = $date_time->modify(sprintf('today %s', $time_begin));
$rec_date_end = $rec_date_begin->add($date->getDuration())->modify(sprintf('today %s', $time_end)); $rec_date_end = $rec_date_begin->add($date->getDuration())->modify($time_end);
$rec_date->calendar_date->begin = $rec_date_begin->getTimestamp(); $rec_date->calendar_date->begin = $rec_date_begin->getTimestamp();
$rec_date->calendar_date->end = $rec_date_end->getTimestamp(); $rec_date->calendar_date->end = $rec_date_end->getTimestamp();
...@@ -503,11 +503,12 @@ class CalendarDateAssignment extends SimpleORMap implements Event ...@@ -503,11 +503,12 @@ class CalendarDateAssignment extends SimpleORMap implements Event
public function isAllDayEvent(): bool public function isAllDayEvent(): bool
{ {
$begin = $this->getBegin(); $begin = $this->getBegin();
if ($begin->format('His') != '000000') { if ($begin->format('His') !== '000000') {
return false; return false;
} }
$duration = $this->getDuration(); $end = $this->getEnd();
return $duration->h === 23 && $duration->i === 59 && $duration->s === 59; return ($end->format('Ymd') === $begin->format('Ymd')
&& $end->format('His') === '235959');
} }
public function isWritable(string $user_id): bool public function isWritable(string $user_id): bool
...@@ -620,13 +621,8 @@ class CalendarDateAssignment extends SimpleORMap implements Event ...@@ -620,13 +621,8 @@ class CalendarDateAssignment extends SimpleORMap implements Event
{ {
$begin = $this->getBegin(); $begin = $this->getBegin();
$end = $this->getEnd(); $end = $this->getEnd();
$duration = $this->getDuration();
$all_day = $begin->format('H:i:s') === '00:00:00'
&& $duration->h === 23
&& $duration->i === 59
&& $duration->s === 59;
$all_day = $this->isAllDayEvent();
$hide_confidential_data = $this->calendar_date->access === 'CONFIDENTIAL' $hide_confidential_data = $this->calendar_date->access === 'CONFIDENTIAL'
&& $user_id !== $this->calendar_date->author_id; && $user_id !== $this->calendar_date->author_id;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment