keep automatic update of pricelist, if project get updated

This commit is contained in:
Ralf Becker 2015-03-10 12:21:03 +00:00
parent e59fecc0e7
commit 043f2480f4
3 changed files with 21 additions and 3 deletions

View File

@ -1694,7 +1694,12 @@ class infolog_ui
$app = $content['info_contact']['app'];
$id = $content['info_contact']['id'];
}
if($app && $id)
// if project has been removed, but is still info_contact --> also remove it
if ($app == 'projectmanager' && $id && $id == $content['old_pm_id'] && !$content['pm_id'])
{
unset($content['info_link_id'], $id, $content['info_contact']['id']);
}
elseif ($app && $id)
{
if(!is_array($content['link_to']))
{
@ -1767,8 +1772,8 @@ class infolog_ui
{
//echo "<p>this->link->unlink2(0,infolog,{$content['link_to']['to_id']},0,'projectmanager',{$content['old_pm_id']});</p>\n";
egw_link::unlink2(0,infolog,$content['link_to']['to_id'],0,'projectmanager',$content['old_pm_id']);
$content['old_pm_id'] = $content['pm_id'];
}
$content['old_pm_id'] = $content['pm_id'];
}
// writing links for a new entry
if ($info_id && is_array($content['link_to']['to_id']) && count($content['link_to']['to_id']))

View File

@ -558,5 +558,18 @@ app.classes.infolog = AppJS.extend(
var data = egw.dataGetUIDdata(_selected[0].id);
return data && data.data && data.data.info_id_parent > 0;
},
/**
* Submit template if widget has a value
*
* Used for project-selection to update pricelist items from server
*
* @param {DOMNode} _node
* @param {et2_widget} _widget
*/
submit_if_not_empty: function(_node, _widget)
{
if (_widget.get_value()) this.et2._inst.submit();
}
});

View File

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