details:   /erp/stable/2.50/rev/03444906df84
changeset: 9364:03444906df84
user:      Adrián Romero <adrianromero <at> openbravo.com>
date:      Tue Apr 12 13:42:59 2011 +0200
summary:   Fixes issue 0016483: Warehouse combo box in the user pop-up window 
must depend on the organization
It has been added a filter in the sentence that gets the list of warehouses to 
get only the referenceables warehouses. It has been modified the window too to 
load the warehouses drop-down list when the organization selection changes

diffstat:

 src/org/openbravo/erpCommon/ad_forms/Role.html           |   9 +++++++--
 src/org/openbravo/erpCommon/ad_forms/Role.java           |  16 ++++++++++------
 src/org/openbravo/erpCommon/ad_forms/Warehouse_data.xsql |   2 ++
 3 files changed, 19 insertions(+), 8 deletions(-)

diffs (99 lines):

diff -r 332d1690cfa8 -r 03444906df84 
src/org/openbravo/erpCommon/ad_forms/Role.html
--- a/src/org/openbravo/erpCommon/ad_forms/Role.html    Tue Apr 12 15:01:41 
2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/Role.html    Tue Apr 12 13:42:59 
2011 +0200
@@ -94,6 +94,7 @@
 function loadSelectorWarehouse(updatefunc) {
     var cmbRole = document.frmMain.role;
     var cmbEntidad = document.frmMain.client;
+    var cmbOrg = document.frmMain.organization;
     var warehouse = document.frmMain.warehouse;
     if (warehouse.options.length!=null) {
         for (var i = warehouse.options.length; i >= 0; i--) {
@@ -110,7 +111,7 @@
           }
         }
       }
-    }, null, "WAREHOUSES", "Role.html", false, "&role=" + 
cmbRole.options[cmbRole.selectedIndex].value + "&client=" + 
cmbEntidad.options[cmbEntidad.selectedIndex].value, null);
+    }, null, "WAREHOUSES", "Role.html", false, "&role=" + 
cmbRole.options[cmbRole.selectedIndex].value + "&client=" + 
cmbEntidad.options[cmbEntidad.selectedIndex].value + "&organization=" + 
cmbOrg.options[cmbOrg.selectedIndex].value, null);
 }
 function refreshRole() {
   loadSelectorsClientOrg();
@@ -121,6 +122,10 @@
   loadSelectorWarehouse();
   return true;
 }
+function refreshOrganization() {
+  loadSelectorWarehouse();
+  return true;
+}
 
 function saveOptions() {
   if (document.frmMain.TextDirection.value=="RTL") {
@@ -461,7 +466,7 @@
                         </td>
                         <td class="TitleCell"><span 
class="LabelText">Organization</span></td>
                         <td class="Combo_ContentCell">
-                          <select name="organization" id="sectionOrganizacion" 
class="Combo Combo_OneCell_width">
+                          <select name="organization" id="sectionOrganizacion" 
onchange="return refreshOrganization()"class="Combo Combo_OneCell_width">
                             <option value="es" 
id="fieldClaveOrganizacion">xxOrganization1</option>
                           </select>
                         </td>
diff -r 332d1690cfa8 -r 03444906df84 
src/org/openbravo/erpCommon/ad_forms/Role.java
--- a/src/org/openbravo/erpCommon/ad_forms/Role.java    Tue Apr 12 15:01:41 
2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/Role.java    Tue Apr 12 13:42:59 
2011 +0200
@@ -28,9 +28,9 @@
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONObject;
-
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.LoginUtils;
 import org.openbravo.base.secureApp.VariablesSecureApp;
@@ -106,8 +106,10 @@
       throws IOException, ServletException {
     String role = vars.getRequiredStringParameter("role");
     String client = vars.getRequiredStringParameter("client");
+    String org = vars.getRequiredStringParameter("organization");
 
-    WarehouseData[] data = WarehouseData.selectByRoleAndClient(this, role, 
client);
+    WarehouseData[] data = WarehouseData.selectByRoleAndClient(this, role, 
client,
+        Utility.getReferenceableOrg(vars, org));
 
     response.setContentType("application/json; charset=UTF-8");
     PrintWriter out = response.getWriter();
@@ -264,10 +266,12 @@
     }
 
     xmlDocument.setData("structureRol", datarole);
-    xmlDocument.setParameter("clientes", 
Utility.arrayDobleEntrada("arrClientes", vecClients
-        .toArray(new ClientData[vecClients.size()])));
-    xmlDocument.setParameter("organizaciones", 
Utility.arrayDobleEntrada("arrOrgs",
-        OrganizationData.selectLogin(this)));
+    xmlDocument.setParameter(
+        "clientes",
+        Utility.arrayDobleEntrada("arrClientes",
+            vecClients.toArray(new ClientData[vecClients.size()])));
+    xmlDocument.setParameter("organizaciones",
+        Utility.arrayDobleEntrada("arrOrgs", 
OrganizationData.selectLogin(this)));
 
     {
       OBError myMessage = vars.getMessage("Role");
diff -r 332d1690cfa8 -r 03444906df84 
src/org/openbravo/erpCommon/ad_forms/Warehouse_data.xsql
--- a/src/org/openbravo/erpCommon/ad_forms/Warehouse_data.xsql  Tue Apr 12 
15:01:41 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/Warehouse_data.xsql  Tue Apr 12 
13:42:59 2011 +0200
@@ -48,10 +48,12 @@
         AND M_Warehouse.IsActive='Y'
         AND AD_ROLE_ORGACCESS.AD_ROLE_ID = ?
         AND M_Warehouse.AD_Client_ID = ?
+        AND M_Warehouse.AD_ORG_ID IN ('1')
         ORDER BY AD_ROLE_ORGACCESS.AD_ROLE_ID, M_Warehouse.Name
       ]]>
     </Sql>
     <Parameter name="role"/>
     <Parameter name="client"/>
+    <Parameter name="orgs" optional="true" type="replace" after="AND 
M_Warehouse.AD_ORG_ID IN (" text="'1'"/>
   </SqlMethod>
 </SqlClass>

------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to