← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7455: minor fix

 

------------------------------------------------------------
revno: 7455
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-06-29 16:45:31 +0300
message:
  minor fix
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.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-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java	2012-06-28 09:21:53 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java	2012-06-29 13:45:31 +0000
@@ -156,18 +156,20 @@
 
             OrganisationUnitLevel offlineOrganisationUnitLevel = configurationService.getConfiguration().getOfflineOrganisationUnitLevel();
 
+            int size = organisationUnitService.getOrganisationUnitLevels().size();
+
             if ( offlineOrganisationUnitLevel == null )
             {
-                int size = organisationUnitService.getOrganisationUnitLevels().size();
                 offlineOrganisationUnitLevel = organisationUnitService.getOrganisationUnitLevel( size );
             }
 
             int minLevel = rootOrganisationUnits.get( 0 ).getLevel();
+            int maxLevel = organisationUnitService.getOrganisationUnitLevel( size ).getLevel();
             int total = minLevel + offlineOrganisationUnitLevel.getLevel() - 1;
 
             if ( total > offlineOrganisationUnitLevel.getLevel() )
             {
-                total = offlineOrganisationUnitLevel.getLevel();
+                total = maxLevel;
             }
 
             final int finalTotal = total;