mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-04 20:40:14 +01:00
Fix all-day recurring event timezone issue
This commit is contained in:
parent
df6e3195e4
commit
d22a9aa537
@ -696,13 +696,24 @@ class calendar_bo
|
||||
//error_log('set_recurrences: days=' . array2string($days) );
|
||||
foreach($events as $event)
|
||||
{
|
||||
$start_servertime = $this->date2ts($event['start'],true);
|
||||
if (in_array($start_servertime, (array)$days))
|
||||
$start = $this->date2ts($event['start'],true);
|
||||
if (in_array($start, (array)$days))
|
||||
{
|
||||
// we don't change the stati of recurrence exceptions
|
||||
$event['participants'] = array();
|
||||
}
|
||||
$this->so->recurrence($event['id'],$start_servertime,$this->date2ts($event['end'],true),$event['participants']);
|
||||
if ($event['whole_day'])
|
||||
{
|
||||
$time = new egw_time($event['end'], egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$time->setTime(23, 59, 59);
|
||||
$end = $this->date2ts($time,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$end = $this->date2ts($event['end'],true);
|
||||
}
|
||||
$this->so->recurrence($event['id'],$start,$end,$event['participants']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -879,7 +890,7 @@ class calendar_bo
|
||||
$event['recur_enddate'] = $end;
|
||||
}
|
||||
// loop over all recurrences and insert them, if they are after $start
|
||||
$rrule = calendar_rrule::event2rrule($event,true); // true = we operate in usertime, like the rest of calendar_bo
|
||||
$rrule = calendar_rrule::event2rrule($event, true); // true = we operate in usertime, like the rest of calendar_bo
|
||||
foreach($rrule as $time)
|
||||
{
|
||||
$time->setUser(); // $time is in timezone of event, convert it to usertime used here
|
||||
|
@ -851,25 +851,34 @@ class calendar_boupdate extends calendar_bo
|
||||
$old_event = null;
|
||||
}
|
||||
|
||||
$save_event = $event;
|
||||
if (!isset($event['whole_day'])) $event['whole_day'] = $this->isWholeDay($event);
|
||||
$save_event = $event;
|
||||
if ($event['whole_day'])
|
||||
{
|
||||
$time = new egw_time($event['start'], egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$event['start'] = egw_time::to($time, 'ts');
|
||||
$save_event['start'] = $time;
|
||||
$time = new egw_time($event['end'], egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$time->setTime(23, 59, 59);
|
||||
$event['end'] = egw_time::to($time, 'ts');
|
||||
$time = new egw_time($event['recurrence'], egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$event['recurrence'] = egw_time::to($time, 'ts');
|
||||
$time = new egw_time($event['recur_enddate'], egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$time->setTime(23, 59, 59);
|
||||
$event['recur_enddate'] = egw_time::to($time, 'ts');
|
||||
if (!empty($event['recurrence']))
|
||||
{
|
||||
$time = new egw_time($event['recurrence'], egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$event['recurrence'] = egw_time::to($time, 'ts');
|
||||
}
|
||||
if (!empty($event['recur_enddate']))
|
||||
{
|
||||
$time = new egw_time($event['recur_enddate'], egw_time::$user_timezone);
|
||||
$time =& $this->so->startOfDay($time);
|
||||
$event['recur_enddate'] = egw_time::to($time, 'ts');
|
||||
$save_event['recur_enddate'] = $event['recur_enddate'];
|
||||
}
|
||||
$timestamps = array('modified','created');
|
||||
// all-day events are handled in server time
|
||||
$event['tzid'] = $save_event['tzid'] = egw_time::$server_timezone->getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user