aboutsummaryrefslogtreecommitdiff
path: root/lib/models
diff options
context:
space:
mode:
authorPeter Thienel <thienel@data-quest.de>2024-03-21 07:42:49 +0000
committerMoritz Strohm <strohm@data-quest.de>2024-03-21 07:43:08 +0000
commitca66100b60b417eb18bc18c3e71fe598a3e300c2 (patch)
treecbbdbcdc05ee0a743f3cd1efef54a11aa3265431 /lib/models
parent1952cd5f520a348508acee226b06441c85eb61fd (diff)
Resolve "Falsche Darstellung ganztägiger Termine an den Tagen der Sommer-/Winterzeitumstellung"
Closes #3864 Merge request studip/studip!2717 (cherry picked from commit 62cbeb6fab048eab48833854ba16da9c22822a5a) 97a2a3e3 set the correct end time of the event and calculate duration of the event...
Diffstat (limited to 'lib/models')
-rw-r--r--lib/models/calendar/CalendarDateAssignment.class.php18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/models/calendar/CalendarDateAssignment.class.php b/lib/models/calendar/CalendarDateAssignment.class.php
index 670ee22..0b274dd 100644
--- a/lib/models/calendar/CalendarDateAssignment.class.php
+++ b/lib/models/calendar/CalendarDateAssignment.class.php
@@ -278,7 +278,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event
$events_created[$event->calendar_date->id . '_' . $event->calendar_date->begin] = $event;
}
} 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
$time_end = $date_end->format('H:i:s');
$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->end = $rec_date_end->getTimestamp();
@@ -503,11 +503,12 @@ class CalendarDateAssignment extends SimpleORMap implements Event
public function isAllDayEvent(): bool
{
$begin = $this->getBegin();
- if ($begin->format('His') != '000000') {
+ if ($begin->format('His') !== '000000') {
return false;
}
- $duration = $this->getDuration();
- return $duration->h === 23 && $duration->i === 59 && $duration->s === 59;
+ $end = $this->getEnd();
+ return ($end->format('Ymd') === $begin->format('Ymd')
+ && $end->format('His') === '235959');
}
public function isWritable(string $user_id): bool
@@ -620,13 +621,8 @@ class CalendarDateAssignment extends SimpleORMap implements Event
{
$begin = $this->getBegin();
$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'
&& $user_id !== $this->calendar_date->author_id;