fix for socal::search to read alarms of recuring events

This commit is contained in:
Ralf Becker 2006-03-07 19:03:42 +00:00
parent d342357b4c
commit 04dc015e0e

View File

@ -422,15 +422,23 @@ class socal
// alarms, atm. we read all alarms in the system, as this can be done in a single query // alarms, atm. we read all alarms in the system, as this can be done in a single query
foreach((array)$this->async->read('cal'.(is_array($ids) ? '' : ':'.(int)$ids).':%') as $id => $job) foreach((array)$this->async->read('cal'.(is_array($ids) ? '' : ':'.(int)$ids).':%') as $id => $job)
{ {
list(,$cal_id) = explode(':',$cal_id); list(,$cal_id) = explode(':',$id);
if (!isset($events[$cal_id])) continue; // not needed
$alarm = $job['data']; // text, enabled $alarm = $job['data']; // text, enabled
$alarm['id'] = $id; $alarm['id'] = $id;
$alarm['time'] = $job['next']; $alarm['time'] = $job['next'];
$event_start = $alarm['time'] + $alarm['offset'];
if (isset($events[$cal_id])) // none recuring event
{
$events[$cal_id]['alarm'][$id] = $alarm; $events[$cal_id]['alarm'][$id] = $alarm;
} }
elseif (isset($events[$cal_id.'-'.$event_start])) // recuring event
{
$events[$cal_id.'-'.$event_start]['alarm'][$id] = $alarm;
}
}
} }
//echo "<p>socal::search\n"; _debug_array($events); //echo "<p>socal::search\n"; _debug_array($events);
return $events; return $events;