fix recurrence-id in wrong timezone and put [Add exception] button on top

This commit is contained in:
ralf 2024-07-04 12:41:21 +02:00
parent 81cbc00ae3
commit 22d5afb811
4 changed files with 24 additions and 18 deletions

View File

@ -1001,6 +1001,7 @@ class calendar_boupdate extends calendar_bo
{ {
return new Api\DateTime($rdate, new DateTimeZone($user_prefs['common']['tz'])); return new Api\DateTime($rdate, new DateTimeZone($user_prefs['common']['tz']));
}, $event['recur_rdates']); }, $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() : '')); //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; $owner_prefs = $ics = null;
@ -1148,6 +1149,12 @@ class calendar_boupdate extends calendar_bo
return $rdate->setTimezone($timezone); return $rdate->setTimezone($timezone);
}, $rdates); }, $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 // Current date doesn't need to go into the cleared event, just for details
$date->setTimezone($timezone); $date->setTimezone($timezone);
$details['date'] = $date->format($timeformat); $details['date'] = $date->format($timeformat);

View File

@ -364,7 +364,7 @@ class calendar_ical extends calendar_boupdate
$recurrence = $days[$recurrence]; // use remote representation $recurrence = $days[$recurrence]; // use remote representation
} }
// force single event // 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]); unset($event[$name]);
} }

View File

@ -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']))) 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); $readonlys['button[delete]'] = !$event['id'] || $preserved['hide_delete'] || !$this->bo->check_perms(Acl::DELETE, $event);
if($readonlys['action']) if($readonlys['action'])

View File

@ -137,27 +137,26 @@
</grid> </grid>
<et2-hbox> <et2-hbox>
<et2-date-time id="recur_rdate"></et2-date-time> <et2-date-time id="recur_rdate"></et2-date-time>
<et2-button id="button[add_rdate]" label="Add recurrence"></et2-button> <et2-button id="button[add_rdate]" label="Add" statustext="Add recurrence"></et2-button>
</et2-hbox> </et2-hbox>
</et2-vbox> </et2-vbox>
<et2-description value="Exceptions"></et2-description>
<et2-vbox> <et2-vbox>
<et2-description value="Exceptions"></et2-description>
<et2-button statustext="Create an exception for the given date" label="@exception_label" <et2-button statustext="Create an exception for the given date" label="@exception_label"
id="button[exception]" noLang="1" hideOnReadonly="true"></et2-button> id="button[exception]" noLang="1" hideOnReadonly="true"></et2-button>
<grid id="recur_exception">
<columns>
<column/>
<column/>
</columns>
<rows>
<row>
<et2-date-time id="$row" readonly="true"></et2-date-time>
<et2-button-icon statustext="Delete this exception" id="delete_exception[$row_cont]" onclick="et2_dialog.confirm(widget,'Delete this exception','Delete')" image="delete"></et2-button-icon>
</row>
</rows>
</grid>
</et2-vbox> </et2-vbox>
<grid id="recur_exception">
<columns>
<column/>
<column/>
</columns>
<rows>
<row>
<et2-date-time id="$row" readonly="true"></et2-date-time>
<et2-button-icon statustext="Delete this exception" id="delete_exception[$row_cont]" onclick="et2_dialog.confirm(widget,'Delete this exception','Delete')" image="delete"></et2-button-icon>
</row>
</rows>
</grid>
<et2-label></et2-label>
</row> </row>
</rows> </rows>
</grid> </grid>