details:   https://code.openbravo.com/erp/devel/pi/rev/4ad163e229c5
changeset: 28574:4ad163e229c5
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Fri Feb 05 13:14:11 2016 +0100
summary:   fixes issue 31766: Application unexpectedly closed using some 
selectors in Edge

Now selectors based on OBSearchItem class are opened inside an Smartclient 
pop-up instead of using a new browser window.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-search.js
 |  21 ++++++---
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
           |   6 ++-
 src/org/openbravo/erpCommon/info/Account.html                                  
                                      |   6 +-
 src/org/openbravo/erpCommon/info/Account.java                                  
                                      |   5 +-
 src/org/openbravo/erpCommon/info/AccountElementValue.html                      
                                      |   6 +-
 src/org/openbravo/erpCommon/info/AccountElementValue.java                      
                                      |  13 +++--
 src/org/openbravo/erpCommon/info/AttributeSetInstance.html                     
                                      |   9 ++-
 src/org/openbravo/erpCommon/info/BusinessPartner.html                          
                                      |   6 +-
 src/org/openbravo/erpCommon/info/BusinessPartner.java                          
                                      |   3 +-
 src/org/openbravo/erpCommon/info/DebtPayment.html                              
                                      |   6 +-
 src/org/openbravo/erpCommon/info/ImageInfo.html                                
                                      |   5 +-
 src/org/openbravo/erpCommon/info/ImageInfoBLOB.html                            
                                      |   5 +-
 src/org/openbravo/erpCommon/info/Invoice.html                                  
                                      |   6 +-
 src/org/openbravo/erpCommon/info/Invoice.java                                  
                                      |   5 +-
 src/org/openbravo/erpCommon/info/InvoiceLine.html                              
                                      |   6 +-
 src/org/openbravo/erpCommon/info/InvoiceLine.java                              
                                      |  10 ++--
 src/org/openbravo/erpCommon/info/Location.java                                 
                                      |   5 +-
 src/org/openbravo/erpCommon/info/Location_F1.html                              
                                      |   9 +++-
 src/org/openbravo/erpCommon/info/Location_FS.html                              
                                      |   1 +
 src/org/openbravo/erpCommon/info/Locator.html                                  
                                      |   6 +-
 src/org/openbravo/erpCommon/info/Locator.java                                  
                                      |   5 +-
 src/org/openbravo/erpCommon/info/Product.html                                  
                                      |   6 +-
 src/org/openbravo/erpCommon/info/Product.java                                  
                                      |   5 +-
 src/org/openbravo/erpCommon/info/ProductComplete.html                          
                                      |   6 +-
 src/org/openbravo/erpCommon/info/ProductComplete.java                          
                                      |   3 +-
 src/org/openbravo/erpCommon/info/Project.html                                  
                                      |   6 +-
 src/org/openbravo/erpCommon/info/Project.java                                  
                                      |   5 +-
 src/org/openbravo/erpCommon/info/SalesOrder.html                               
                                      |   6 +-
 src/org/openbravo/erpCommon/info/SalesOrder.java                               
                                      |   5 +-
 src/org/openbravo/erpCommon/info/SalesOrderLine.html                           
                                      |   6 +-
 src/org/openbravo/erpCommon/info/SalesOrderLine.java                           
                                      |   5 +-
 src/org/openbravo/erpCommon/info/SearchUniqueKeyResponse.html                  
                                      |   5 +-
 src/org/openbravo/erpCommon/info/ShipmentReceipt.html                          
                                      |   4 +-
 src/org/openbravo/erpCommon/info/ShipmentReceipt.java                          
                                      |   5 +-
 src/org/openbravo/erpCommon/info/ShipmentReceiptLine.html                      
                                      |   6 +-
 src/org/openbravo/erpCommon/info/ShipmentReceiptLine.java                      
                                      |   5 +-
 36 files changed, 128 insertions(+), 94 deletions(-)

diffs (truncated from 948 to 300 lines):

diff -r dc0fe14356ec -r 4ad163e229c5 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-search.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-search.js
      Fri Feb 05 10:05:58 2016 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-search.js
      Fri Feb 05 13:14:11 2016 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2011-2012 Openbravo SLU
+ * All portions are Copyright (C) 2011-2016 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -70,7 +70,11 @@
         targetFld.form.focusInNextItem(targetFld.name);
       }
     }
-    isc.OBSearchItem.openedWindow.close();
+    if (isc.OBSearchItem.openedWindow.closeClick) {
+      isc.OBSearchItem.openedWindow.closeClick();
+    } else {
+      isc.OBSearchItem.openedWindow.close();
+    }
     isc.OBSearchItem.openSearchItem = null;
   };
 }(this)); // window
@@ -198,7 +202,11 @@
     left = parseInt((screen.width - width) / 2, 10);
 
     if (isc.OBSearchItem.openedWindow) {
-      isc.OBSearchItem.openedWindow.close();
+      if (isc.OBSearchItem.openedWindow.closeClick) {
+        isc.OBSearchItem.openedWindow.closeClick();
+      } else {
+        isc.OBSearchItem.openedWindow.close();
+      }
       this.clearUnloadEventHandling();
     }
     isc.OBSearchItem.openedWindow = null;
@@ -224,12 +232,9 @@
       }
     }
 
-    if (navigator.appName.indexOf('Netscape')) {
-      complementsNS4 = 'alwaysRaised=1, dependent=1, directories=0, hotkeys=0, 
menubar=0, ';
-    }
-    var complements = complementsNS4 + 'height=' + height + ', width=' + width 
+ ', left=' + left + ', top=' + top + ', screenX=' + left + ', screenY=' + top 
+ ', location=0, resizable=1, scrollbars=1, status=0, toolbar=0, titlebar=0, 
modal=\'yes\'';
-    isc.OBSearchItem.openedWindow = 
window.open(OB.Utilities.applicationUrl(url) + ((auxField === '') ? '' : '?' + 
auxField), 'SELECTOR', complements);
+    isc.OBSearchItem.openedWindow = 
OB.Layout.ClassicOBCompatibility.Popup.open('SELECTOR', width, height, 
OB.Utilities.applicationUrl(url) + ((auxField === '') ? '' : '?' + auxField), 
'', window, true, true, true, null, true);
     if (isc.OBSearchItem.openedWindow) {
+      isc.OBSearchItem.openedWindow.name = 'SELECTOR';
       isc.OBSearchItem.openedWindow.focus();
       this.setUnloadEventHandling();
     }
diff -r dc0fe14356ec -r 4ad163e229c5 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
        Fri Feb 05 10:05:58 2016 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
        Fri Feb 05 13:14:11 2016 +0100
@@ -627,7 +627,11 @@
     var index = url.indexOf('/', 1);
     url = url.substring(index + 1);
   }
-  OB.TestRegistry.register('org.openbravo.classicpopup.' + url, obj);
+  if (url.indexOf('?') !== -1 && url.indexOf('Command') === -1) {
+    OB.TestRegistry.register('org.openbravo.classicpopup.' + url.substring(0, 
url.indexOf('?')), obj);
+  } else {
+    OB.TestRegistry.register('org.openbravo.classicpopup.' + url, obj);
+  }
 };
 
 // ** {{{ OB.Utilities.isNonEmptyString(/*String*/ strValue }}} **
diff -r dc0fe14356ec -r 4ad163e229c5 
src/org/openbravo/erpCommon/info/Account.html
--- a/src/org/openbravo/erpCommon/info/Account.html     Fri Feb 05 10:05:58 
2016 +0100
+++ b/src/org/openbravo/erpCommon/info/Account.html     Fri Feb 05 13:14:11 
2016 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -85,13 +85,13 @@
   }
   
   function validateSelector(action) {
-       var keys; var key; var text;
+       var keys; var key; var text; var theOpener = parent.opener || 
getFrame('LayoutMDI');
        if(action == 'SAVE') {
                keys = getSelectdText().split("@_##_@"); 
                key = keys[0];
                text = keys[1];
        }
-       parent.opener.closeSearch(action, key, text, null);
+       theOpener.closeSearch(action, key, text, null);
   }
   
   function disableSaveButton(a) {
diff -r dc0fe14356ec -r 4ad163e229c5 
src/org/openbravo/erpCommon/info/Account.java
--- a/src/org/openbravo/erpCommon/info/Account.java     Fri Feb 05 10:05:58 
2016 +0100
+++ b/src/org/openbravo/erpCommon/info/Account.java     Fri Feb 05 13:14:11 
2016 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2001-2010 Openbravo SLU
+ * All portions are Copyright (C) 2001-2016 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -183,7 +183,8 @@
     html.append("\nfunction validateSelector() {\n");
     html.append("var key = \"" + data[0].cValidcombinationId + "\";\n");
     html.append("var text = \"" + Replace.replace(data[0].combination, "\"", 
"\\\"") + "\";\n");
-    html.append("parent.opener.closeSearch(\"SAVE\", key, text, null);\n");
+    html.append("var theOpener = parent.opener || getFrame('LayoutMDI');\n");
+    html.append("theOpener.closeSearch(\"SAVE\", key, text, null);\n");
     html.append("}\n");
     return html.toString();
   }
diff -r dc0fe14356ec -r 4ad163e229c5 
src/org/openbravo/erpCommon/info/AccountElementValue.html
--- a/src/org/openbravo/erpCommon/info/AccountElementValue.html Fri Feb 05 
10:05:58 2016 +0100
+++ b/src/org/openbravo/erpCommon/info/AccountElementValue.html Fri Feb 05 
13:14:11 2016 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2009-2010 Openbravo SLU
+ * All portions are Copyright (C) 2009-2016 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -61,7 +61,7 @@
 </script>
 <script type="text/javascript">
   function validateSelector(action) {
-    var pos; var keys;  var key; var text; var parameter;
+    var pos; var keys;  var key; var text; var parameter; var theOpener = 
parent.opener || getFrame('LayoutMDI');
     if(action == "SAVE") {
         pos = getSelectedPos();
         keys = getSelectedValues().split("@_##_@")
@@ -70,7 +70,7 @@
         parameter = new Array(
         );
     }
-    parent.opener.closeSearch(action, key, text, parameter);
+    theOpener.closeSearch(action, key, text, parameter);
   }
 </script>
 <script language="JavaScript" type="text/javascript">
diff -r dc0fe14356ec -r 4ad163e229c5 
src/org/openbravo/erpCommon/info/AccountElementValue.java
--- a/src/org/openbravo/erpCommon/info/AccountElementValue.java Fri Feb 05 
10:05:58 2016 +0100
+++ b/src/org/openbravo/erpCommon/info/AccountElementValue.java Fri Feb 05 
13:14:11 2016 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2009-2015 Openbravo SLU
+ * All portions are Copyright (C) 2009-2016 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -151,7 +151,8 @@
     html.append("\nfunction validateSelector() {\n");
     html.append("var key = \"" + data[0].cElementvalueId + "\";\n");
     html.append("var text = \"" + Replace.replace(data[0].name, "\"", "\\\"") 
+ "\";\n");
-    html.append("parent.opener.closeSearch(\"SAVE\", key, text, null);\n");
+    html.append("var theOpener = parent.opener || getFrame('LayoutMDI');\n");
+    html.append("theOpener.closeSearch(\"SAVE\", key, text, null);\n");
     html.append("}\n");
     return html.toString();
   }
@@ -319,15 +320,15 @@
           data = AccountElementValueData.select(this, "ROWNUM", strAcctSchema, 
strValue, strName,
               strOrganization, strAccountElementValue,
               Utility.getContext(this, vars, "#User_Client", 
"AccountElementValue"),
-              Utility.getContext(this, vars, "#AccessibleOrgTree", 
"AccountElementValue"), strOrderBy,
-              oraLimit, "");
+              Utility.getContext(this, vars, "#AccessibleOrgTree", 
"AccountElementValue"),
+              strOrderBy, oraLimit, "");
         } else {
           String pgLimit = pageSize + " OFFSET " + offset;
           data = AccountElementValueData.select(this, "1", strAcctSchema, 
strValue, strName,
               strOrganization, strAccountElementValue,
               Utility.getContext(this, vars, "#User_Client", 
"AccountElementValue"),
-              Utility.getContext(this, vars, "#AccessibleOrgTree", 
"AccountElementValue"), strOrderBy, "",
-              pgLimit);
+              Utility.getContext(this, vars, "#AccessibleOrgTree", 
"AccountElementValue"),
+              strOrderBy, "", pgLimit);
         }
       } catch (ServletException e) {
         log4j.error("Error in print page data: " + e);
diff -r dc0fe14356ec -r 4ad163e229c5 
src/org/openbravo/erpCommon/info/AttributeSetInstance.html
--- a/src/org/openbravo/erpCommon/info/AttributeSetInstance.html        Fri Feb 
05 10:05:58 2016 +0100
+++ b/src/org/openbravo/erpCommon/info/AttributeSetInstance.html        Fri Feb 
05 13:14:11 2016 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2014 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -48,7 +48,8 @@
     if (msg!=null && msg != "") alert(msg);
     var key = document.frmMain.inpInstance.value;
     var text = document.frmMain.inpDescription.value;
-    top.opener.closeSearch("SAVE", key, text, null);
+    var theOpener = top.opener || getFrame('LayoutMDI');
+    theOpener.closeSearch("SAVE", key, text, null);
     return true;
 }
 </script>
@@ -59,11 +60,13 @@
 </script>
 <script language="JavaScript" type="text/javascript">
 function validateSelector(action) {
+    var theOpener = top.opener || getFrame('LayoutMDI');
     if (action=="SAVE") {
         if (validate()) {
             submitCommandForm("SAVE");
         }
-    } else top.opener.closeSearch(action, "", "", null);
+    } else theOpener.closeSearch(action, "", "", null);
+
     return true;
 }
 function validate() {
diff -r dc0fe14356ec -r 4ad163e229c5 
src/org/openbravo/erpCommon/info/BusinessPartner.html
--- a/src/org/openbravo/erpCommon/info/BusinessPartner.html     Fri Feb 05 
10:05:58 2016 +0100
+++ b/src/org/openbravo/erpCommon/info/BusinessPartner.html     Fri Feb 05 
13:14:11 2016 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -51,7 +51,7 @@
 </script>
 <script type="text/javascript">    
   function validateSelector(action) {
-       var pos; var keys;  var key; var text; var parameter;
+       var pos; var keys;  var key; var text; var parameter; var theOpener = 
parent.opener || getFrame('LayoutMDI');
        if(action == "SAVE") {
            pos = getSelectedPos();
            keys = getSelectedValues().split("@_##_@")
@@ -62,7 +62,7 @@
                    new SearchElements("_CON", true, keys[1])
                );
     }    
-       parent.opener.closeSearch(action, key, text, parameter);
+       theOpener.closeSearch(action, key, text, parameter);
   }
 </script>
 <script language="JavaScript" type="text/javascript" id="selectedColumn">
diff -r dc0fe14356ec -r 4ad163e229c5 
src/org/openbravo/erpCommon/info/BusinessPartner.java
--- a/src/org/openbravo/erpCommon/info/BusinessPartner.java     Fri Feb 05 
10:05:58 2016 +0100
+++ b/src/org/openbravo/erpCommon/info/BusinessPartner.java     Fri Feb 05 
13:14:11 2016 +0100
@@ -227,7 +227,8 @@
     html.append("new SearchElements(\"_LOC\", true, \"" + 
data[0].cBpartnerLocationId + "\"),\n");
     html.append("new SearchElements(\"_CON\", true, \"" + 
data[0].cBpartnerContactId + "\")\n");
     html.append(");\n");
-    html.append("parent.opener.closeSearch(\"SAVE\", key, text, 
parameter);\n");
+    html.append("var theOpener = parent.opener || getFrame('LayoutMDI');\n");
+    html.append("theOpener.closeSearch(\"SAVE\", key, text, parameter);\n");
     html.append("}\n");
     return html.toString();
   }
diff -r dc0fe14356ec -r 4ad163e229c5 
src/org/openbravo/erpCommon/info/DebtPayment.html
--- a/src/org/openbravo/erpCommon/info/DebtPayment.html Fri Feb 05 10:05:58 
2016 +0100
+++ b/src/org/openbravo/erpCommon/info/DebtPayment.html Fri Feb 05 13:14:11 
2016 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2011 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -48,14 +48,14 @@
 </script>
 <script type="text/javascript">    
   function validateSelector(action) {
-       var pos; var keys;  var key; var text; var parameter;
+       var pos; var keys;  var key; var text; var parameter; var theOpener = 
parent.opener || getFrame('LayoutMDI');
        if(action == "SAVE") {
            pos = getSelectedPos();
            keys = getSelectedValues().split("@_##_@")
            key = keys[0];
            text = keys[1];
     }    
-       parent.opener.closeSearch(action, key, text);
+       theOpener.closeSearch(action, key, text);
   }
 </script>
 <script language="JavaScript" type="text/javascript" id="selectedColumn">

------------------------------------------------------------------------------
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=272487151&iu=/4140
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to