Optimze alarm handling

This commit is contained in:
Jörg Lehrke 2010-06-18 13:44:50 +00:00
parent ae1807c571
commit b94e897717

View File

@ -1369,7 +1369,7 @@ class calendar_ical extends calendar_boupdate
{ {
$alarm['offset'] = $event['start'] - $alarm['time']; $alarm['offset'] = $event['start'] - $alarm['time'];
} }
if (!isset($alarm['time']) && isset($alarm['offset'])) elseif (!isset($alarm['time']) && isset($alarm['offset']))
{ {
$alarm['time'] = $event['start'] - $alarm['offset']; $alarm['time'] = $event['start'] - $alarm['offset'];
} }
@ -1381,12 +1381,12 @@ class calendar_ical extends calendar_boupdate
{ {
foreach ($event_info['stored_event']['alarm'] as $alarm_id => $alarm_data) foreach ($event_info['stored_event']['alarm'] as $alarm_id => $alarm_data)
{ {
if ($alarm['time'] == $alarm_data['time'] && if ($alarm['offset'] == $alarm_data['offset'] &&
($alarm_data['all'] || $alarm_data['owner'] == $this->user)) ($alarm_data['all'] || $alarm_data['owner'] == $this->user))
{ {
unset($event['alarm'][$newid]); unset($event['alarm'][$newid]);
unset($event_info['stored_event']['alarm'][$alarm_id]); unset($event_info['stored_event']['alarm'][$alarm_id]);
continue; continue 2;
} }
} }
} }