From 96aac588e45125487a5df19ca7ec0bdbbe7625bd Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 8 May 2017 13:18:04 -0600 Subject: [PATCH] * Calendar - creating an exception to a recurring event now copies the links over to the exception --- calendar/inc/class.calendar_uiforms.inc.php | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index 0259eeede5..6fc8730854 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -744,6 +744,12 @@ class calendar_uiforms extends calendar_ui unset($recur_event['alarm']); // unsetting alarms too, as they cant be updated without start! $this->bo->update($recur_event,true); // no conflict check here + // Save links + if($content['links']) + { + Link::link('calendar', $event['id'], $content['links']['to_id']); + } + if(Api\Json\Response::isJSONResponse()) { // Sending null will trigger a removal of the original @@ -1106,6 +1112,30 @@ class calendar_uiforms extends calendar_ui { unset($alarm['uid'], $alarm['id'], $alarm['time']); } + + // Copy links + if(!is_array($event['link_to'])) $event['link_to'] = array(); + $event['link_to']['to_app'] = 'calendar'; + $event['link_to']['to_id'] = 0; + + foreach(Link::get_links($event['link_to']['to_app'], $event['id']) as $link) + { + if(!$link['id']) continue; + if ($link['app'] != Link::VFS_APPNAME) + { + Link::link('calendar', $event['link_to']['to_id'], $link['app'], $link['id'], $link['remark']); + } + elseif ($link['app'] == Link::VFS_APPNAME) + { + Link::link('calendar', $event['link_to']['to_id'], Link::VFS_APPNAME, array( + 'tmp_name' => Link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'], + 'name' => $link['id'], + ), $link['remark']); + } + } + + $event['links'] = $event['link_to']; + if($this->bo->check_perms(Acl::EDIT,$event)) { return lang('Save event as exception - Delete single occurrence - Edit status or alarms for this particular day'); @@ -2738,6 +2768,7 @@ class calendar_uiforms extends calendar_ui $preserv = null; $this->_create_exception($event,$preserv); unset($event['id']); + $links = $event['link_to']['to_id']; $messages = null; $conflicts = $this->bo->update($event,false,true,false,true,$messages); @@ -2826,6 +2857,12 @@ class calendar_uiforms extends calendar_ui $message = false; $conflicts=$this->bo->update($event,$ignore_conflicts, true, false, true, $message); + // Save links + if($links) + { + Link::link('calendar', $event['id'], $links); + } + $this->update_client($event['id'],$d); $response = Api\Json\Response::get(); if(!is_array($conflicts) && $conflicts)