From 2b13b73b60a34eb7f412e75aa0558f77fee8739e Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 27 Sep 2010 18:03:46 +0000 Subject: [PATCH] When deleting but keeping events, hold on to links as well so they can be restored if event is restored --- calendar/inc/class.calendar_boupdate.inc.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index ec67567ea4..9b4cc320c9 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -352,6 +352,11 @@ class calendar_boupdate extends calendar_bo $event = $this->read($cal_id); // we re-read the event, in case only partial information was update and we need the full info for the notifies //echo "new $cal_id="; _debug_array($event); + if($old_event['deleted'] && $event['deleted'] == null) + { + // Restored, bring back links + egw_link::restore('calendar', $cal_id); + } if ($this->log_file) { $this->log2file($event2save,$event,$old_event); @@ -1241,6 +1246,9 @@ class calendar_boupdate extends calendar_bo } elseif ($config['calendar_delete_history']) { + // mark all links to the event as deleted, but keep them + egw_link::unlink(0,'calendar',$cal_id,'','','',true); + $event['deleted'] = $this->now; $this->save($event, $ignore_acl); // Actually delete alarms