Fixes issue 21550: You can select wrong 'Storage Bin'
authorJavier Etxarri <javier.echarri@openbravo.com>
Mon, 17 Sep 2012 18:18:41 +0200
changeset 17969 06e1886fd04d
parent 17968 e3a5ae024381
child 17970 f7344c95ba24
Fixes issue 21550: You can select wrong 'Storage Bin'
in tab 'Manufacturing' inside the window 'Product'
src/org/openbravo/erpCommon/info/Locator.html
src/org/openbravo/erpCommon/info/Locator.java
src/org/openbravo/erpCommon/info/Locator.xml
--- a/src/org/openbravo/erpCommon/info/Locator.html	Mon Sep 17 18:10:35 2012 +0200
+++ b/src/org/openbravo/erpCommon/info/Locator.html	Mon Sep 17 18:18:41 2012 +0200
@@ -115,6 +115,7 @@
 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="onLoadDo();" onresize="onResizeDo();">
 <form name="frmSelector" method="post" action="Locator.html">
   <input type="hidden" name="Command" />
+  <input type="hidden" name="paramOrgTree" id="paramOrgTree" value=""/>
   <input type="hidden" name="IsPopUpCall" value="1" />
   <div class="Popup_ContentPane_CircleLogo">
     <div class="Popup_WindowLogo">
--- a/src/org/openbravo/erpCommon/info/Locator.java	Mon Sep 17 18:10:35 2012 +0200
+++ b/src/org/openbravo/erpCommon/info/Locator.java	Mon Sep 17 18:18:41 2012 +0200
@@ -69,7 +69,11 @@
       strWarehouse = strWarehouse + "%";
       vars.setSessionValue("Locator.name", strName);
       vars.setSessionValue("Locator.warehousename", strWarehouse);
-      printPage(response, vars, strName, strWarehouse);
+      String strOrg = vars.getGlobalVariable("inpadOrgId", "Locator.adorgid", "");
+      if ("".equals(strOrg) || strOrg == null) {
+        strOrg = vars.getStringParameter("paramOrgTree");
+      }
+      printPage(response, vars, strName, strWarehouse, strOrg);
     } else if (vars.commandIn("KEY")) {
       removePageSessionVariables(vars);
       String strKeyValue = vars.getRequestGlobalVariable("inpNameValue", "Locator.name");
@@ -84,7 +88,10 @@
       strKeyValue = strKeyValue + "%";
       vars.setSessionValue("Locator.name", strKeyValue);
       vars.setSessionValue("Locator.warehousename", LocatorData.selectname(this, strWarehouse));
-      String strOrg = vars.getStringParameter("inpAD_Org_ID");
+      String strOrg = vars.getStringParameter("inpadOrgId");
+      if ("".equals(strOrg) || strOrg == null) {
+        strOrg = vars.getStringParameter("paramOrgTree");
+      }
       LocatorData[] data = LocatorData.selectKey(this,
           Utility.getContext(this, vars, "#User_Client", "Locator"),
           Utility.getSelectorOrgs(this, vars, strOrg), LocatorData.selectname(this, strWarehouse),
@@ -92,7 +99,7 @@
       if (data != null && data.length == 1) {
         printPageKey(response, vars, data);
       } else
-        printPage(response, vars, strKeyValue, LocatorData.selectname(this, strWarehouse));
+        printPage(response, vars, strKeyValue, LocatorData.selectname(this, strWarehouse), strOrg);
     } else if (vars.commandIn("STRUCTURE")) {
       printGridStructure(response, vars);
     } else if (vars.commandIn("DATA")) {
@@ -109,7 +116,10 @@
       String strPageSize = vars.getStringParameter("page_size");
       String strSortCols = vars.getInStringParameter("sort_cols", columnFilter);
       String strSortDirs = vars.getInStringParameter("sort_dirs", directionFilter);
-      String strOrg = vars.getGlobalVariable("inpAD_Org_ID", "Locator.adorgid", "");
+      String strOrg = vars.getGlobalVariable("inpadOrgId", "Locator.adorgid", "");
+      if ("".equals(strOrg) || strOrg == null) {
+        strOrg = vars.getStringParameter("paramOrgTree");
+      }
       printGridData(response, vars, strName, strWarehousename, strAisle, strBin, strLevel,
           strSortCols, strSortDirs, strOffset, strPageSize, strNewFilter, strOrg);
     } else
@@ -127,7 +137,8 @@
   }
 
   private void printPage(HttpServletResponse response, VariablesSecureApp vars,
-      String strNameValue, String strWarehousename) throws IOException, ServletException {
+      String strNameValue, String strWarehousename, String strOrg) throws IOException,
+      ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("Output: Frame 1 of Locators seeker");
     XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/info/Locator")
@@ -137,6 +148,7 @@
     xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
     xmlDocument.setParameter("theme", vars.getTheme());
     xmlDocument.setParameter("warehouse", strWarehousename);
+    xmlDocument.setParameter("OrgTree", strOrg);
 
     xmlDocument.setParameter("grid", "20");
     xmlDocument.setParameter("grid_Offset", "");
--- a/src/org/openbravo/erpCommon/info/Locator.xml	Mon Sep 17 18:10:35 2012 +0200
+++ b/src/org/openbravo/erpCommon/info/Locator.xml	Mon Sep 17 18:18:41 2012 +0200
@@ -22,6 +22,7 @@
 	<PARAMETER id="paramDirectory" name="directory" default=""/>
 	<PARAMETER id="paramLanguage" name="language" default=""/>
 	<PARAMETER id="paramCSS" name="theme" attribute="href" replace="Default"/>
+    <PARAMETER id="paramOrgTree" name="OrgTree" attribute="value"/>
 
 	<PARAMETER id="fieldKey" name="key" attribute="value"/>
 	<PARAMETER id="paramWarehouse" name="warehouse" attribute="value"/>