Fix undefined status issue

This commit is contained in:
Jörg Lehrke 2010-04-14 14:44:21 +00:00
parent f802fdd315
commit d3ad7cae78

View File

@ -1110,6 +1110,29 @@ class calendar_ical extends calendar_boupdate
{ {
$event['id'] = $event_info['stored_event']['id']; // CalDAV does only provide UIDs $event['id'] = $event_info['stored_event']['id']; // CalDAV does only provide UIDs
} }
if (is_array($event['participants']))
{
// if the client does not return a status, we restore the original one
foreach ($event['participants'] as $uid => $status)
{
if ($status[0] == 'X')
{
if (isset($event_info['stored_event']['participants'][$uid]))
{
if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
"() Restore status for $uid\n",3,$this->logfile);
}
$event['participants'][$uid] = $event_info['stored_event']['participants'][$uid];
}
else
{
$event['participants'][$uid] = calendar_so::combine_status('U');
}
}
}
}
if ($merge) if ($merge)
{ {
if ($this->log) if ($this->log)
@ -1117,7 +1140,6 @@ class calendar_ical extends calendar_boupdate
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
"()[MERGE]\n",3,$this->logfile); "()[MERGE]\n",3,$this->logfile);
} }
// overwrite with server data for merge // overwrite with server data for merge
foreach ($event_info['stored_event'] as $key => $value) foreach ($event_info['stored_event'] as $key => $value)
{ {
@ -1167,27 +1189,6 @@ class calendar_ical extends calendar_boupdate
} }
else else
{ {
// if the client does not return a status, we restore the original one
foreach ($event['participants'] as $uid => $status)
{
// Is it a resource and no longer present in the event?
if ($status[0] == 'X')
{
if (isset($event_info['stored_event']['participants'][$uid]))
{
if ($this->log)
{
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
"() Restore status for $uid\n",3,$this->logfile);
}
$event['participants'][$uid] = $event_info['stored_event']['participants'][$uid];
}
else
{
$event['participants'][$uid] = calendar_so::combine_status('U');
}
}
}
foreach ($event_info['stored_event']['participants'] as $uid => $status) foreach ($event_info['stored_event']['participants'] as $uid => $status)
{ {
// Is it a resource and no longer present in the event? // Is it a resource and no longer present in the event?
@ -1284,11 +1285,11 @@ class calendar_ical extends calendar_boupdate
{ {
if ($uid == $event['owner']) if ($uid == $event['owner'])
{ {
$event['participants']['uid'] = calendar_so::combine_status('A', 1, 'CHAIR'); $event['participants'][$uid] = calendar_so::combine_status('A', 1, 'CHAIR');
} }
else else
{ {
$event['participants']['uid'] = calendar_so::combine_status('U'); $event['participants'][$uid] = calendar_so::combine_status('U');
} }
} }
} }