* Calendar - creating an exception to a recurring event now copies the links over to the exception

This commit is contained in:
nathangray 2017-05-08 13:18:04 -06:00
parent 26c19f4fa6
commit 96aac588e4

View File

@ -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)