fixes bug 35825: Default org/warehouse not sorted properly in profile widget
authorCarlos Aristu <carlos.aristu@openbravo.com>
Mon, 24 Apr 2017 18:41:02 +0200
changeset 31978 a49574c6de23
parent 31977 9b4f2a32e438
child 31979 e833242c1051
fixes bug 35825: Default org/warehouse not sorted properly in profile widget

After the changes introduced on issue #35553, the content of the profile widget fields (role, organization, warehouse) is sorted in the client side. The sorting was already being done when displaying the pick lists, but the value map used by those fields was not being sorted.

The default value of the org/warehouse fields when changing the role is the first value of their respective value maps. For this reason, since now the value maps for those fields is always sorted: the OB.User.userInfo object is instantiated with the mentioned value maps sorted by identifier, thanks to the call to 'sortByProperty' added in the user-info.js.ftl template.
modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/templates/user-info.js.ftl
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/templates/user-info.js.ftl	Mon Apr 24 12:06:00 2017 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/templates/user-info.js.ftl	Mon Apr 24 18:41:02 2017 +0200
@@ -61,7 +61,7 @@
             _identifier: '${roleInfo.organizations[organizationId]}'
           } <#if organizationId_has_next>,</#if>
           </#list>
-        ],
+        ].sortByProperty('_identifier', true),
         warehouseOrgMap: [
           <#list roleInfo.organizationWarehouses?keys as key>
           {
@@ -73,7 +73,7 @@
                 _identifier: '${warehouse.warehouseName}'
               } <#if warehouse_has_next>,</#if>
               </#list>
-            ]
+            ].sortByProperty('_identifier', true)
           } <#if key_has_next>,</#if>
           </#list>
         ]