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
foreach((array)$this->async->read('cal'.(is_array($ids) ? '' : ':'.(int)$ids).':%') as $id => $job)
{
list(,$cal_id) = explode(':',$cal_id);
if (!isset($events[$cal_id])) continue; // not needed
list(,$cal_id) = explode(':',$id);
$alarm = $job['data']; // text, enabled
$alarm['id'] = $id;
$alarm['time'] = $job['next'];
$event_start = $alarm['time'] + $alarm['offset'];
if (isset($events[$cal_id])) // none recuring event
{
$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);
return $events;