* InfoLog/CalDAV: fixed wrong timezone used for iCal generation

times where read in server-time, but infolog_ical was told it is user-time, now set to server-time in infolog_groupdav::get_handler()
This commit is contained in:
Ralf Becker 2012-03-08 16:23:43 +00:00
parent df06f6657c
commit 1b345bbf36
2 changed files with 6 additions and 3 deletions

View File

@ -605,6 +605,7 @@ class infolog_groupdav extends groupdav_handler
private function _get_handler() private function _get_handler()
{ {
$handler = new infolog_ical(); $handler = new infolog_ical();
$handler->tzid = false; // as we read server-time timestamps (!= null=user-time), exports UTC times
$handler->setSupportedFields('GroupDAV',$this->agent); $handler->setSupportedFields('GroupDAV',$this->agent);
return $handler; return $handler;

View File

@ -173,7 +173,6 @@ class infolog_ical extends infolog_bo
if ($_method) $vcal->setAttribute('METHOD',$_method); if ($_method) $vcal->setAttribute('METHOD',$_method);
$tzid = $this->tzid; $tzid = $this->tzid;
if ($tzid && $tzid != 'UTC') if ($tzid && $tzid != 'UTC')
{ {
// check if we have vtimezone component data for tzid of event, if not default to user timezone (default to server tz) // check if we have vtimezone component data for tzid of event, if not default to user timezone (default to server tz)
@ -298,7 +297,7 @@ class infolog_ical extends infolog_bo
} }
if ($taskData['info_enddate']) if ($taskData['info_enddate'])
{ {
self::setDateOrTime($vevent, 'DUE', $taskData['info_enddate'], false); // export always as date self::setDateOrTime($vevent, 'DUE', $taskData['info_enddate'], $tzid);
} }
if ($taskData['info_datecompleted']) if ($taskData['info_datecompleted'])
{ {
@ -380,6 +379,7 @@ class infolog_ical extends infolog_bo
static function setDateOrTime(&$vevent, $attr, $time, $tzid) static function setDateOrTime(&$vevent, $attr, $time, $tzid)
{ {
$params = array(); $params = array();
$time_in = $time;
if ($tzid) if ($tzid)
{ {
@ -410,7 +410,8 @@ class infolog_ical extends infolog_bo
$value = array( $value = array(
'year' => $arr['year'], 'year' => $arr['year'],
'month' => $arr['month'], 'month' => $arr['month'],
'mday' => $arr['day']); 'mday' => $arr['day'],
);
$params['VALUE'] = 'DATE'; $params['VALUE'] = 'DATE';
} }
else else
@ -429,6 +430,7 @@ class infolog_ical extends infolog_bo
$value = egw_time::to($time, 'ts'); $value = egw_time::to($time, 'ts');
} }
} }
//error_log(__METHOD__."(, '$attr', ".array2string($time_in).', '.array2string($tzid).') tz='.$tz->getName().', value='.array2string($value).(is_int($value)?date('Y-m-d H:i:s',$value):''));
$vevent->setAttribute($attr, $value, $params); $vevent->setAttribute($attr, $value, $params);
} }