details:   https://code.openbravo.com/erp/devel/pi/rev/cc28a29cb724
changeset: 28552:cc28a29cb724
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Fri Jan 29 12:56:36 2016 +0100
summary:   fixes issue 31180: openDirectTab action now works if the tab is 
already opened

When the opening tab was already opened, the openDirectTab method was not 
waiting properly to the new tab be refreshed/opened. This was caused because 
the callout of OB.Utilities.openDirectTab method was invoked after the line 
that checks if the action needs to wait.
Now if the tab is already opened the action is called again with a delay of 
100ms, giving OB.Utilities.openDirectTab enough time to execute its callout.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-action-def.js
 |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 9080d38ba575 -r cc28a29cb724 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-action-def.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-action-def.js
     Fri Jan 29 09:55:26 2016 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-action-def.js
     Fri Jan 29 12:56:36 2016 +0100
@@ -93,11 +93,12 @@
 // * {{{command}}}: The command with which the view to be opened
 // * {{{wait}}}: If true, the thread in which this action was called (if there 
is any) will be paused until the view be opened.
 OB.Utilities.Action.set('openDirectTab', function (paramObj) {
-  var processIndex, tabPosition;
+  var processIndex, tabPosition, isTabOpened = false;
   if (!paramObj.newTabPosition) {
     tabPosition = OB.Utilities.getTabNumberById(paramObj.tabId); // Search if 
the tab has been opened before
     if (tabPosition !== -1) {
       paramObj.newTabPosition = tabPosition;
+      isTabOpened = true;
     } else {
       processIndex = 
OB.Utilities.getProcessTabBarPosition(paramObj._processView);
       if (processIndex === -1) {
@@ -113,7 +114,7 @@
     OB.Utilities.openDirectTab(paramObj.tabId, paramObj.recordId, 
paramObj.command, paramObj.newTabPosition, paramObj.criteria);
   }
   if ((paramObj.wait === true || paramObj.wait === 'true') && 
paramObj.threadId) {
-    if (!OB.MainView.TabSet.getTabObject(paramObj.newTabPosition) || 
OB.MainView.TabSet.getTabObject(paramObj.newTabPosition).pane.isLoadingTab === 
true) {
+    if (!OB.MainView.TabSet.getTabObject(paramObj.newTabPosition) || 
OB.MainView.TabSet.getTabObject(paramObj.newTabPosition).pane.isLoadingTab === 
true || isTabOpened) {
       OB.Utilities.Action.pauseThread(paramObj.threadId);
       paramObj.isOpening = true;
       OB.Utilities.Action.execute('openDirectTab', paramObj, 100); //Call this 
action again with a 100ms delay

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to