Fixes for get_event_info() and enhancements for find_event()

This commit is contained in:
Jörg Lehrke 2010-02-03 12:24:42 +00:00
parent 8f71452859
commit b596935291

View File

@ -1423,7 +1423,6 @@ class calendar_boupdate extends calendar_bo
{ {
$matchingEvents = array(); $matchingEvents = array();
$query = array(); $query = array();
// unset($event['uid']);
if ($this->log) if ($this->log)
{ {
@ -1432,28 +1431,23 @@ class calendar_boupdate extends calendar_bo
} }
if ($filter == 'master') if ($filter == 'master')
{
$recur_date = 0;
$event['recurrence'] = 0;
}
else
{
if ($event['recur_type'] == MCAL_RECUR_NONE)
{ {
if (empty($event['uid']) || !isset($event['recurrence'])) if (empty($event['uid']) || !isset($event['recurrence']))
{ {
$event['recurrence'] = $event['start']; $recur_date = $event['start']; // without UID we ignore RECURRENCE-IDs
} }
$recur_date = $event['recurrence']; else
{
$recur_date = $event['recurrence'];
}
} }
else else
{ {
$event['recurrence'] = 0;
$recur_date = $event['start']; $recur_date = $event['start'];
} }
$recur_date = $this->date2usertime($recur_date); $recur_date = $this->date2usertime($recur_date);
}
if ($event['id']) if ($event['id'])
{ {
@ -1607,6 +1601,10 @@ class calendar_boupdate extends calendar_bo
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
'(' . $event['uid'] . ')[EventUID]'); '(' . $event['uid'] . ')[EventUID]');
} }
if ($filter != 'relax' && isset($event['recurrence']))
{
$query['cal_recurrence'] = $event['recurrence'];
}
} }
if ($this->log) if ($this->log)
@ -1867,6 +1865,7 @@ class calendar_boupdate extends calendar_bo
$master_event = false; //default $master_event = false; //default
$stored_event = false; $stored_event = false;
$recurrence_event = false; $recurrence_event = false;
$wasPseudo = false;
if ($event['recur_type'] != MCAL_RECUR_NONE) if ($event['recur_type'] != MCAL_RECUR_NONE)
{ {
@ -1887,6 +1886,7 @@ class calendar_boupdate extends calendar_bo
if (strstr($eventID, ':')) if (strstr($eventID, ':'))
{ {
$type = 'SERIES-PSEUDO-EXCEPTION'; $type = 'SERIES-PSEUDO-EXCEPTION';
$wasPseudo = true;
list($eventID, $recur_date) = explode(':', $eventID); list($eventID, $recur_date) = explode(':', $eventID);
$recur_date = $this->date2usertime($recur_date); $recur_date = $this->date2usertime($recur_date);
$stored_event = $this->read($eventID, $recur_date, false, 'server'); $stored_event = $this->read($eventID, $recur_date, false, 'server');
@ -1918,17 +1918,18 @@ class calendar_boupdate extends calendar_bo
if (isset($stored_event['id']) && $master_event['id'] != $stored_event['id']) if (isset($stored_event['id']) && $master_event['id'] != $stored_event['id'])
{ {
$type = 'SERIES-EXCEPTION'; // this is an existing exception $type = 'SERIES-EXCEPTION'; // this is an existing exception
}
elseif (in_array($event['start'], $master_event['recur_exception']))
{
$type='SERIES-PSEUDO-EXCEPTION'; // new pseudo exception?
$recurrence_event = $event;
break; break;
} }
elseif (isset($event['recurrence']) && elseif (isset($event['recurrence']) &&
in_array($event['recurrence'], $master_event['recur_exception'])) in_array($event['recurrence'], $master_event['recur_exception']))
{ {
$type = 'SERIES-EXCEPTION'; $type = 'SERIES-PSEUDO-EXCEPTION'; // could also be a real one
break;
}
elseif (in_array($event['start'], $master_event['recur_exception']))
{
$type='SERIES-PSEUDO-EXCEPTION'; // new pseudo exception?
$recurrence_event = $event;
break; break;
} }
else else
@ -1978,7 +1979,16 @@ class calendar_boupdate extends calendar_bo
{ {
if (!empty($event[$key]) && $recurrence_event[$key] != $event[$key]) if (!empty($event[$key]) && $recurrence_event[$key] != $event[$key])
{ {
if ($wasPseudo)
{
// We started with a pseudo exception
$type = 'SERIES-EXCEPTION-PROPAGATE'; $type = 'SERIES-EXCEPTION-PROPAGATE';
}
else
{
$type = 'SERIES-EXCEPTION';
}
if ($stored_event) if ($stored_event)
{ {
unset($stored_event['id']); // signal the true exception unset($stored_event['id']); // signal the true exception