← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9190: normalize level parameter if its outside of bounds [1, maxOrganisationUnitLevels]

 

------------------------------------------------------------
revno: 9190
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-12-06 15:27:30 +0300
message:
  normalize level parameter if its outside of bounds [1, maxOrganisationUnitLevels]
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.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-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java	2012-12-06 12:22:40 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java	2012-12-06 12:27:30 +0000
@@ -89,6 +89,11 @@
                 level = entity.getOrganisationUnitLevel();
             }
 
+            if ( level < 1 || level > organisationUnitService.getNumberOfOrganisationalLevels() )
+            {
+                level = entity.getOrganisationUnitLevel();
+            }
+
             if ( level == entity.getOrganisationUnitLevel() )
             {
                 model.addAttribute( "model", entity );