← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7065: Minor fix

 

------------------------------------------------------------
revno: 7065
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-05-28 18:45:01 +0200
message:
  Minor fix
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.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-api/src/main/java/org/hisp/dhis/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2012-05-17 09:11:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2012-05-28 16:45:01 +0000
@@ -222,7 +222,14 @@
         }
         else if ( DIMENSION_ORGANISATIONUNIT.equals( dimension ) )
         {
-            list.addAll( getAllOrganisationUnits() );
+            if ( isOrganisationUnitGroupBased() )
+            {
+                list.addAll( organisationUnitGroupSet.getOrganisationUnitGroups() );
+            }
+            else
+            {
+                list.addAll( getAllOrganisationUnits() );
+            }
         }
 
         return list;
@@ -241,6 +248,15 @@
     // Logic
     // -------------------------------------------------------------------------
 
+    /**
+     * Indicates whether this report table is based on organisation unit groups
+     * or the organisation unit hierarchy.
+     */
+    public boolean isOrganisationUnitGroupBased()
+    {
+        return organisationUnitGroupSet != null && organisationUnitGroupSet.getOrganisationUnitGroups() != null;
+    }
+
     public void removeAllOrganisationUnits()
     {
         organisationUnits.clear();