Fix bug in linking infologs copied by projectmanager causing doubles

This commit is contained in:
nathangray 2016-12-15 10:24:14 -07:00
parent 1e4ac003a2
commit bdd45ee909
2 changed files with 7 additions and 2 deletions

View File

@ -1050,6 +1050,10 @@ class infolog_bo
$app = $values['info_contact']['app'];
$id = $values['info_contact']['id'];
}
else if ($values['info_contact'])
{
list($app, $id) = explode(':', $values['info_contact'], 2);
}
// if project has been removed, but is still info_contact --> also remove it
if ($app == 'projectmanager' && $id && $id == $values['old_pm_id'] && !$values['pm_id'])
{
@ -1493,7 +1497,7 @@ class infolog_bo
$query = array(
'col_filter' => array('info_id' => $args['infolog']),
'subs' => true,
'cols' => 'info_id,info_type,info_status,info_percent,info_id_parent',
'cols' => 'egw_infolog.info_id,info_type,info_status,info_percent,info_id_parent',
);
$infos = array();
foreach($this->search($query) as $row)

View File

@ -115,6 +115,7 @@ class infolog_datasource extends datasource
{
$this->infolog_bo->link_id2from($info); // unsets info_from and sets info_link_target
unset($info['info_link_id']);
unset($info['info_contact']);
}
// we need to unset a view fields, to get a new entry
foreach(array('info_id','info_owner','info_modified','info_modifierer') as $key)
@ -158,7 +159,7 @@ class infolog_datasource extends datasource
if(!($info['info_id'] = $this->infolog_bo->write($info))) return false;
// link the new infolog against the project and setting info_link_id and evtl. info_from
$old_link = $info['info_link_id'] ? Link::get_link($info['info_link']) : $info['info_link'];
$old_link = $info['info_link_id'] ? Link::get_link($info['info_link_id']) : $info['info_link'];
$info['info_link_id'] = Link::link('projectmanager',$target,'infolog',$info['info_id'],$element['pe_remark'],0,0,1);
if (!$info['info_from'] || $old_link && $info['info_from'] == $old_link['title'])
{