max_user_modified for recurring events has to include all recurrences, otherwise we get a "412 Precondition Failed" in CalDAV, as it is part of the ETag

This commit is contained in:
Ralf Becker 2011-11-09 17:53:42 +00:00
parent c3abca67db
commit cf1eee2818
2 changed files with 20 additions and 3 deletions

View File

@ -803,11 +803,11 @@ class calendar_bo
$time->setTime(23, 59, 59);
$event['recur_enddate'] = egw_time::to($time, $date_format);
}
$timestamps = array('modified','created');
$timestamps = array('modified','created','max_user_modified');
}
else
{
$timestamps = array('start','end','modified','created','recur_enddate','recurrence');
$timestamps = array('start','end','modified','created','recur_enddate','recurrence','max_user_modified');
}
// we convert here from the server-time timestamps to user-time and (optional) to a different date-format!
foreach ($timestamps as $ts)

View File

@ -228,6 +228,7 @@ class calendar_so
}
}
$need_max_user_modified = array();
// participants, if a recur_date give, we read that recurance, plus the one users from the default entry with recur_date=0
// sorting by cal_recur_date ASC makes sure recurence status always overwrites series status
foreach($this->db->select($this->user_table,'*',array(
@ -242,11 +243,23 @@ class calendar_so
$events[$row['cal_id']]['participants'][$uid] = $status;
$events[$row['cal_id']]['participant_types'][$row['cal_user_type']][$row['cal_user_id']] = $status;
if (($modified = $this->db->from_timestamp($row['cal_user_modified'])) > $events[$row['cal_id']]['max_user_modified'])
if ($events[$row['cal_id']]['recur_type'])
{
$need_max_user_modified[$row['cal_id']] = $row['cal_id'];
}
elseif (($modified = $this->db->from_timestamp($row['cal_user_modified'])) > $events[$row['cal_id']]['max_user_modified'])
{
$events[$row['cal_id']]['max_user_modified'] = $modified;
}
}
// max_user_modified for recurring events has to include all recurrences, above code only querys $recur_date!
if ($need_max_user_modified)
{
foreach($this->max_user_modified($need_max_user_modified) as $id => $modified)
{
$events[$id]['max_user_modified'] = $modified;
}
}
// custom fields
foreach($this->db->select($this->extra_table,'*',array('cal_id'=>$ids),__LINE__,__FILE__,false,'','calendar') as $row)
@ -1582,6 +1595,10 @@ ORDER BY cal_user_type, cal_usre_id
'cal_start' => $start,
),__LINE__,__FILE__,'calendar');
if (!is_array($participants))
{
error_log(__METHOD__."($cal_id, $start, $end, ".array2string($participants).") participants is NO array! ".function_backtrace());
}
foreach($participants as $uid => $status)
{
if ($status == 'G') continue; // dont save group-invitations