* InfoLog: fixed not able to remove already selected project

This commit is contained in:
Ralf Becker 2015-03-10 11:32:00 +00:00
parent 564f958fbb
commit 1c1dea3d5e
2 changed files with 14 additions and 4 deletions

View File

@ -1697,14 +1697,24 @@ class infolog_ui
} }
$content['info_link_id'] = (int)($info_link_id = egw_link::link('infolog',$content['link_to']['to_id'],$app,$id)); $content['info_link_id'] = (int)($info_link_id = egw_link::link('infolog',$content['link_to']['to_id'],$app,$id));
} }
else
{
unset($content['info_link_id']);
}
if ($old_link_id && $old_link_id != $content['info_link_id']) if ($old_link_id && $old_link_id != $content['info_link_id'])
{ {
$link = egw_link::get_link($old_link_id); $link = egw_link::get_link($old_link_id);
// Keep projectmanager link if it's the same project as before // remove selected project, if removed link is that project
if(!($link['link_app2'] == 'projectmanager' && $link['link_id2'] == $content['old_pm_id'])) if($link['link_app2'] == 'projectmanager' && $link['link_id2'] == $content['old_pm_id'])
{ {
egw_link::unlink($old_link_id); unset($content['pm_id'], $content['old_pm_id']);
} }
egw_link::unlink($old_link_id);
}
// if added link is a project and no other project selected, also add as project
if ($app == 'projectmanager' && $id && !$content['pm_id'])
{
$content['old_pm_id'] = $content['pm_id'] = $id;
} }
} }
if (is_array($content['link_to']['to_id']) && count($content['link_to']['to_id'])) if (is_array($content['link_to']['to_id']) && count($content['link_to']['to_id']))

View File

@ -41,7 +41,7 @@
</row> </row>
<row class="row"> <row class="row">
<description value="Project"/> <description value="Project"/>
<link-entry id="pm_id" onchange="1" only_app='projectmanager' blur='None' class="infolog_projectName"/> <link-entry id="pm_id" only_app='projectmanager' blur='None' class="infolog_projectName"/>
</row> </row>
<row class="row"> <row class="row">
<description value="Price"/> <description value="Price"/>