← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9158: correct sorting of ou-children in multiorgunit forms

 

------------------------------------------------------------
revno: 9158
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-12-01 13:12:01 +0100
message:
  correct sorting of ou-children in multiorgunit forms
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java	2012-11-30 15:43:14 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java	2012-12-01 12:12:01 +0000
@@ -309,19 +309,24 @@
         if ( multiOrganisationUnit != null && multiOrganisationUnit != 0 ) // for multiOrg, we only support section forms
         {
             OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( multiOrganisationUnit );
+            List<OrganisationUnit> organisationUnitChildren = new ArrayList<OrganisationUnit>();
+
+            for ( OrganisationUnit child : organisationUnit.getChildren() )
+            {
+                if ( child.getDataSets().contains( dataSet ) )
+                {
+                    organisationUnitChildren.add( child );
+                }
+            }
+
+            Collections.sort( organisationUnitChildren, IdentifiableObjectNameComparator.INSTANCE );
 
             if ( organisationUnit.getDataSets().contains( dataSet ) )
             {
                 organisationUnits.add( organisationUnit );
             }
 
-            for ( OrganisationUnit child : organisationUnit.getChildren() )
-            {
-                if ( child.getDataSets().contains( dataSet ) )
-                {
-                    organisationUnits.add( child );
-                }
-            }
+            organisationUnits.addAll( organisationUnitChildren );
 
             getSectionForm( dataElements, dataSet );
             displayMode = "multiorg_section";