From 547d125a300910bcad373074353149e7c95cd41d Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 14 Feb 2013 11:11:17 +0000 Subject: [PATCH] Check app_refresh to not get an error if an application overrides app_refresh() instead of using register_app_refresh() --- phpgwapi/js/jsapi/jsapi.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/phpgwapi/js/jsapi/jsapi.js b/phpgwapi/js/jsapi/jsapi.js index 8d7854ce41..45e3a3e859 100644 --- a/phpgwapi/js/jsapi/jsapi.js +++ b/phpgwapi/js/jsapi/jsapi.js @@ -234,8 +234,9 @@ function egw_refresh(_msg, _app, _id, _type, _targetapp, _replace, _with) //alert("egw_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')"); var win = typeof _targetapp != 'undefined' ? egw_appWindow(_targetapp) : window; - // if window defines an app_refresh method, just call it - if (typeof win.app_refresh == "function" || typeof win.app_refresh.registered == "function" && win.app_refresh.registered(_app)) + // if window registered an app_refresh method or overwritten app_refresh, just call it + if(typeof win.app_refresh == "function" && typeof win.app_refresh.registered == "undefined" || + typeof win.app_refresh != "undefined" && win.app_refresh.registered(_app)) { win.app_refresh(_msg, _app, _id, _type); return; @@ -247,7 +248,7 @@ function egw_refresh(_msg, _app, _id, _type, _targetapp, _replace, _with) var et2 = etemplate2.getByApplication(_app); for(var i = 0; i < et2.length; i++) { - et2[i].refresh(_msg,_id,_type); + et2[i].refresh(_msg,_app,_id,_type); } return; }