mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
Calendar - change how we're dealing with (all day) timezones, keeping the event in the assigned timezone instead of always changing it to the server timezone.
This commit is contained in:
parent
c5a1bcf1f6
commit
11f3719348
@ -1116,6 +1116,7 @@ class calendar_bo
|
|||||||
// insert at least the event itself, if it's behind the horizont
|
// insert at least the event itself, if it's behind the horizont
|
||||||
$event['recur_enddate'] = $this->date2ts($end) < $this->date2ts($event['end']) ? $event['end'] : $end;
|
$event['recur_enddate'] = $this->date2ts($end) < $this->date2ts($event['end']) ? $event['end'] : $end;
|
||||||
}
|
}
|
||||||
|
$event['recur_enddate'] = new Api\DateTime($event['recur_enddate'], calendar_timezones::DateTimeZone($event['tzid']));
|
||||||
// unset exceptions, as we need to add them as recurrence too, but marked as exception
|
// unset exceptions, as we need to add them as recurrence too, but marked as exception
|
||||||
unset($event['recur_exception']);
|
unset($event['recur_exception']);
|
||||||
// loop over all recurrences and insert them, if they are after $start
|
// loop over all recurrences and insert them, if they are after $start
|
||||||
|
@ -1203,11 +1203,14 @@ class calendar_boupdate extends calendar_bo
|
|||||||
{
|
{
|
||||||
$old_event = null;
|
$old_event = null;
|
||||||
}
|
}
|
||||||
|
if (!isset($event['whole_day'])) $event['whole_day'] = $this->isWholeDay($event);
|
||||||
|
|
||||||
// set recur-enddate/range-end to real end-date of last recurrence
|
// set recur-enddate/range-end to real end-date of last recurrence
|
||||||
if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'])
|
if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'])
|
||||||
{
|
{
|
||||||
$rrule = calendar_rrule::event2rrule($event);
|
$event['recur_enddate'] = new Api\DateTime($event['recur_enddate'], calendar_timezones::DateTimeZone($event['tzid']));
|
||||||
|
$event['recur_enddate']->setTime(23,59,59);
|
||||||
|
$rrule = calendar_rrule::event2rrule($event, true, Api\DateTime::$server_timezone->getName());
|
||||||
$rrule->rewind();
|
$rrule->rewind();
|
||||||
$enddate = $rrule->current();
|
$enddate = $rrule->current();
|
||||||
do
|
do
|
||||||
@ -1215,13 +1218,13 @@ class calendar_boupdate extends calendar_bo
|
|||||||
$rrule->next_no_exception();
|
$rrule->next_no_exception();
|
||||||
$occurrence = $rrule->current();
|
$occurrence = $rrule->current();
|
||||||
}
|
}
|
||||||
while ($rrule->valid(true) && ($enddate = $occurrence));
|
while ($rrule->valid() && ($enddate = $occurrence));
|
||||||
$enddate->modify(($event['end'] - $event['start']).' second');
|
$enddate->modify(($event['end'] - $event['start']).' second');
|
||||||
$event['recur_enddate'] = $enddate->format('ts');
|
//$enddate->setTimezone();
|
||||||
|
//$event['recur_enddate'] = $enddate->format('ts');
|
||||||
//error_log(__METHOD__."($event[title]) start=".Api\DateTime::to($event['start'],'string').', end='.Api\DateTime::to($event['end'],'string').', range_end='.Api\DateTime::to($event['recur_enddate'],'string'));
|
//error_log(__METHOD__."($event[title]) start=".Api\DateTime::to($event['start'],'string').', end='.Api\DateTime::to($event['end'],'string').', range_end='.Api\DateTime::to($event['recur_enddate'],'string'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($event['whole_day'])) $event['whole_day'] = $this->isWholeDay($event);
|
|
||||||
$save_event = $event;
|
$save_event = $event;
|
||||||
if ($event['whole_day'])
|
if ($event['whole_day'])
|
||||||
{
|
{
|
||||||
@ -1247,17 +1250,15 @@ class calendar_boupdate extends calendar_bo
|
|||||||
{
|
{
|
||||||
// all-day events are handled in server time
|
// all-day events are handled in server time
|
||||||
$time = $this->so->startOfDay(
|
$time = $this->so->startOfDay(
|
||||||
new Api\DateTime($event['recur_enddate'], Api\DateTime::$user_timezone),
|
new Api\DateTime($event['recur_enddate'], Api\DateTime::$server_timezone),
|
||||||
Api\DateTime::$server_timezone->getName()
|
Api\DateTime::$server_timezone->getName()
|
||||||
);
|
);
|
||||||
$time->modify(($event['end'] - $event['start'] + 1).' seconds');
|
$time->modify(($event['end'] - $event['start']).' seconds');
|
||||||
$event['recur_enddate'] = Api\DateTime::to($time, 'ts') - 1;
|
//$event['recur_enddate'] = $save_event['recur_enddate'] = Api\DateTime::to($time, 'ts');
|
||||||
$time->setUser();
|
|
||||||
$save_event['recur_enddate'] = Api\DateTime::to($time, 'ts') - 1;
|
|
||||||
}
|
}
|
||||||
$timestamps = array('modified','created');
|
$timestamps = array('modified','created');
|
||||||
// all-day events are handled in server time
|
// all-day events are handled in server time
|
||||||
$event['tzid'] = $save_event['tzid'] = Api\DateTime::$server_timezone->getName();
|
// $event['tzid'] = $save_event['tzid'] = Api\DateTime::$server_timezone->getName();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -760,7 +760,7 @@ class calendar_rrule implements Iterator
|
|||||||
if ($event['recur_enddate'])
|
if ($event['recur_enddate'])
|
||||||
{
|
{
|
||||||
$enddate = is_a($event['recur_enddate'],'DateTime') ? $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'],$timestamp_tz);
|
$enddate = is_a($event['recur_enddate'],'DateTime') ? $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'],$timestamp_tz);
|
||||||
$enddate->setTime(23,59,59);
|
// $enddate->setTime(23,59,59);
|
||||||
$enddate->setTimezone(self::$tz_cache[$to_tz]);
|
$enddate->setTimezone(self::$tz_cache[$to_tz]);
|
||||||
}
|
}
|
||||||
if (is_array($event['recur_exception']))
|
if (is_array($event['recur_exception']))
|
||||||
|
Loading…
Reference in New Issue
Block a user