details:   /erp/devel/pi/rev/a7b660e076d5
changeset: 11489:a7b660e076d5
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Tue Apr 05 15:57:00 2011 +0200
summary:   Fixed issue 16647. Warehouse combo will once again depend on the 
role (due to the special case of the * organization)

details:   /erp/devel/pi/rev/ac20cbe4c16c
changeset: 11490:ac20cbe4c16c
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Tue Apr 05 16:31:16 2011 +0200
summary:   Fixed issue 16648. The first warehouse will automatically be 
selected if none is selected

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java
 |   3 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-user-profile-widget.js
                             |  21 +++++++--
 2 files changed, 17 insertions(+), 7 deletions(-)

diffs (67 lines):

diff -r f6835145eb18 -r ac20cbe4c16c 
modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java
    Tue Apr 05 16:10:27 2011 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java
    Tue Apr 05 16:31:16 2011 +0200
@@ -150,8 +150,6 @@
     result.put("language", createLanguageFormItemInfo());
     result.put("initialValues", createInitialValues());
     result.put("role", createRoleInfo(parameters));
-    result.put("warehouseOrgMap",
-        getWarehouses(OBContext.getOBContext().getCurrentClient().getId()));
     return result;
   }
 
@@ -183,6 +181,7 @@
         orgValueMap.put(org.getId(), org.getIdentifier());
       }
       jsonRole.put("organizationValueMap", orgValueMap);
+      jsonRole.put("warehouseOrgMap", getWarehouses(role.getClient().getId()));
       jsonRoles.put(jsonRole);
     }
     formItemInfo.put("roles", jsonRoles);
diff -r f6835145eb18 -r ac20cbe4c16c 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-user-profile-widget.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-user-profile-widget.js
        Tue Apr 05 16:10:27 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-user-profile-widget.js
        Tue Apr 05 16:31:16 2011 +0200
@@ -208,6 +208,10 @@
         // note, need to make a copy of the initial values
         // otherwise they are updated when the form values change!
         roleForm.setValues(isc.addProperties({}, 
roleForm.localFormData.initialValues));
+        if(roleForm.getItem('warehouse').getClientPickListData().length > 0 &&
+                !roleForm.getItem('warehouse').getValue()){
+            roleForm.getItem('warehouse').moveToFirstValue();
+        }
       },
       setInitialData: function(rpcResponse, data, rpcRequest){
         // order of these statements is important see comments in reset
@@ -234,7 +238,7 @@
           }
         }
         this.setWarehouseValueMap();
-        if (item.name === 'role' || item.name === 'organization') {
+        if (item.name !== 'warehouse') {
           if (roleForm.getItem('warehouse').getClientPickListData().length > 
0) {
             roleForm.getItem('warehouse').moveToFirstValue();
           }
@@ -255,12 +259,19 @@
         if (!orgId) {
           return;
         }
-        for (var j = 0; j < roleForm.localFormData.warehouseOrgMap.length; 
j++) {
-          var warehouseOrg = roleForm.localFormData.warehouseOrgMap[j];
-          if (warehouseOrg.orgId === orgId) {
-            roleForm.setValueMap('warehouse', warehouseOrg.warehouseMap);
+        var roleId = roleForm.getValue('role');
+        for (var i = 0; i < roleForm.localFormData.role.roles.length; i++) {
+          var role = roleForm.localFormData.role.roles[i];
+          if (role.id === roleId) {
+            for (var j = 0; j < role.warehouseOrgMap.length; j++) {
+              var warehouseOrg = role.warehouseOrgMap[j];
+              if (warehouseOrg.orgId === orgId) {
+                roleForm.setValueMap('warehouse', warehouseOrg.warehouseMap);
+              }
+            }
           }
         }
+        roleForm.getItem('warehouse').moveToFirstValue();
       },
       
       // call the server to save the information

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to