fixed alarm handling: dont touch / ignore alarms being set for all users or alarms of other users since most clients do not know specific owners for alarms

This commit is contained in:
Christian Binder 2009-09-23 08:08:37 +00:00
parent e1ae046c49
commit bbe301095e

View File

@ -686,6 +686,12 @@ class calendar_ical extends calendar_boupdate
} }
foreach($event['alarm'] as $alarmID => $alarmData) foreach($event['alarm'] as $alarmID => $alarmData)
{ {
// skip alarms being set for all users or alarms owned by other users
if($alarmData['all'] == true || $alarmData['owner'] != $GLOBALS['egw_info']['user']['account_id'])
{
continue;
}
if ($version == '1.0') if ($version == '1.0')
{ {
if ($servertime) if ($servertime)
@ -1028,22 +1034,27 @@ class calendar_ical extends calendar_boupdate
} }
// update alarms depending on the given event type // update alarms depending on the given event type
if(isset($this->supportedFields['alarm'])
&& is_array($event_info['stored_event']) // alarm update requires a stored event
)
{
switch($event_info['type']) switch($event_info['type'])
{ {
case 'SINGLE': case 'SINGLE':
case 'SERIES-MASTER': case 'SERIES-MASTER':
case 'SERIES-EXCEPTION': case 'SERIES-EXCEPTION':
if(is_array($event_info['stored_event'])) // alarm update requires a stored event
{
// delete old alarms // delete old alarms
if(count($event['alarm']) > 0 if(count($event_info['stored_event']['alarm']) > 0)
|| (isset($this->supportedFields['alarms']) && count($event['alarm']) == 0))
{ {
foreach ($event_info['stored_event']['alarm'] as $alarm_id => $alarm_data) foreach ($event_info['stored_event']['alarm'] as $alarm_id => $alarm_data)
{
// only touch own alarms
if($alarm_data['all'] == false && $alarm_data['owner'] == $GLOBALS['egw_info']['user']['account_id'])
{ {
$this->delete_alarm($alarm_id); $this->delete_alarm($alarm_id);
} }
} }
}
// save given alarms // save given alarms
if(count($event['alarm']) > 0) if(count($event['alarm']) > 0)
@ -1059,17 +1070,17 @@ class calendar_ical extends calendar_boupdate
$alarm['time'] = $event['start'] - $alarm['offset']; $alarm['time'] = $event['start'] - $alarm['offset'];
} }
$alarm['owner'] = $GLOBALS['egw_info']['user']['account_id']; $alarm['owner'] = $GLOBALS['egw_info']['user']['account_id'];
$alarm['all'] = true; $alarm['all'] = false;
$this->save_alarm($event_info['stored_event']['id'], $alarm); $this->save_alarm($event_info['stored_event']['id'], $alarm);
} }
} }
}
break; break;
case 'SERIES-EXCEPTION-STATUS': case 'SERIES-EXCEPTION-STATUS':
// nothing to do here // nothing to do here
break; break;
} }
}
// choose which id to return to the client // choose which id to return to the client
switch($event_info['type']) switch($event_info['type'])