From 3a5975e1aa599024103d02fb80d348d92ab02870 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 10 Mar 2015 12:21:19 +0000 Subject: [PATCH] keep automatic update of pricelist, if project get updated --- infolog/inc/class.infolog_ui.inc.php | 9 +++++++-- infolog/js/app.js | 13 +++++++++++++ infolog/templates/default/edit.xet | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 14b441520a..5542af469a 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -1689,7 +1689,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'])) { @@ -1762,8 +1767,8 @@ class infolog_ui { //echo "

this->link->unlink2(0,infolog,{$content['link_to']['to_id']},0,'projectmanager',{$content['old_pm_id']});

\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'])) diff --git a/infolog/js/app.js b/infolog/js/app.js index d6118a015f..0f12ebd1e0 100644 --- a/infolog/js/app.js +++ b/infolog/js/app.js @@ -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(); } }); diff --git a/infolog/templates/default/edit.xet b/infolog/templates/default/edit.xet index b686e0f1a5..5c7ea348e8 100644 --- a/infolog/templates/default/edit.xet +++ b/infolog/templates/default/edit.xet @@ -41,7 +41,7 @@ - +