From 22d5afb811d00d1493b03c47d226d54afe20af59 Mon Sep 17 00:00:00 2001 From: ralf Date: Thu, 4 Jul 2024 12:41:21 +0200 Subject: [PATCH] fix recurrence-id in wrong timezone and put [Add exception] button on top --- calendar/inc/class.calendar_boupdate.inc.php | 7 +++++ calendar/inc/class.calendar_ical.inc.php | 2 +- calendar/inc/class.calendar_uiforms.inc.php | 2 +- calendar/templates/default/edit.xet | 31 ++++++++++---------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index 4aaa314509..6b86c0e16d 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -1001,6 +1001,7 @@ class calendar_boupdate extends calendar_bo { return new Api\DateTime($rdate, new DateTimeZone($user_prefs['common']['tz'])); }, $event['recur_rdates']); + $recur_date = isset($event['recur_date']) ? new Api\DateTime($event['recur_date'], new DateTimeZone($user_prefs['common']['tz'])) : null; //error_log(__METHOD__."() date_default_timezone_get()=".date_default_timezone_get().", user-timezone=".Api\DateTime::$user_timezone->getName().", startdate=".$startdate->format().", enddate=".$enddate->format().", updated=".$modified->format().", olddate=".($olddate ? $olddate->format() : '')); $owner_prefs = $ics = null; @@ -1148,6 +1149,12 @@ class calendar_boupdate extends calendar_bo return $rdate->setTimezone($timezone); }, $rdates); + if (isset($recur_date)) + { + $cleared_event['recur_date'] = $recur_date->setTimezone($timezone); + $details['recur_date'] = $recur_date->format($timeformat); + } + // Current date doesn't need to go into the cleared event, just for details $date->setTimezone($timezone); $details['date'] = $date->format($timeformat); diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index 0c6c9a6e60..b073c289ff 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -364,7 +364,7 @@ class calendar_ical extends calendar_boupdate $recurrence = $days[$recurrence]; // use remote representation } // force single event - foreach (array('recur_enddate','recur_interval','recur_exception','recur_data','recur_date','id','etag') as $name) + foreach (array('recur_enddate','recur_interval','recur_exception','recur_rdates','recur_data','recur_date','id','etag') as $name) { unset($event[$name]); } diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index fcf48a03b2..2768233269 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -1904,7 +1904,7 @@ class calendar_uiforms extends calendar_ui } if (!($readonlys['button[exception]'] = !$this->bo->check_perms(Acl::EDIT,$event) || $event['recur_type'] == MCAL_RECUR_NONE || ($event['recur_enddate'] &&$event['start'] > $event['recur_enddate']))) { - $content['exception_label'] = $this->bo->long_date(max($preserved['actual_date'], $event['start'])); + $content['exception_label'] = lang('Add %1', $this->bo->long_date(max($preserved['actual_date'], $event['start']))); } $readonlys['button[delete]'] = !$event['id'] || $preserved['hide_delete'] || !$this->bo->check_perms(Acl::DELETE, $event); if($readonlys['action']) diff --git a/calendar/templates/default/edit.xet b/calendar/templates/default/edit.xet index 59a635ac7e..8f7b807100 100644 --- a/calendar/templates/default/edit.xet +++ b/calendar/templates/default/edit.xet @@ -137,27 +137,26 @@ - + + - + id="button[exception]" noLang="1" hideOnReadonly="true"> + + + + + + + + + + + + - - - - - - - - - - - - -