← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 8263
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-09-26 10:01:02 +0200
message:
  Minor
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.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/report/ReportService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java	2012-09-24 12:52:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java	2012-09-26 08:01:02 +0000
@@ -51,10 +51,13 @@
      * 
      * Will make the following params available:
      * 
-     * "periods" String of relative period ids)
-     * "organisationunits" String of selected organisation unit uids)
-     * "reporting_month_name" Name of the selected period
-     * "param_organisationunit_name" Name of the selected organisation unit
+     * "periods" String of relative period ids (String)
+     * "organisationunits" String of selected organisation unit ids (String)
+     * "reporting_month_name" Name of the selected period (String)
+     * "param_organisationunit_name" Name of the selected organisation unit (String)
+     * "organisationunit_level" Level of the selected organisation unit (int)
+     * "organisationunit_level_column" Name of the relevant level column in  (String)
+     *     table _orgunitstructure.
      * 
      * @param out the OutputStream to write the report to.
      * @param reportUid the uid of the report to render.

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2012-09-26 04:56:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2012-09-26 08:01:02 +0000
@@ -108,6 +108,7 @@
     public static final String REPORTING_MONTH_COLUMN_NAME = "reporting_month_name";
     public static final String PARAM_ORGANISATIONUNIT_COLUMN_NAME = "param_organisationunit_name";
     public static final String PARAM_ORGANISATIONUNIT_LEVEL = "organisationunit_level";
+    public static final String PARAM_ORGANISATIONUNIT_LEVEL_COLUMN = "organisationunit_level_column";
     public static final String ORGANISATION_UNIT_IS_PARENT_COLUMN_NAME = "organisation_unit_is_parent";
 
     public static final String SEPARATOR = "_";

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java	2012-09-26 04:56:05 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java	2012-09-26 08:01:02 +0000
@@ -27,7 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.reporttable.ReportTable.PARAM_ORGANISATIONUNIT_COLUMN_NAME;
+import static org.hisp.dhis.reporttable.ReportTable.*;
 import static org.hisp.dhis.reporttable.ReportTable.REPORTING_MONTH_COLUMN_NAME;
 import static org.hisp.dhis.reporttable.ReportTable.PARAM_ORGANISATIONUNIT_LEVEL;
 import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
@@ -73,6 +73,8 @@
 public class DefaultReportService
     implements ReportService
 {
+    public static final String ORGANISATIONUNIT_LEVEL_COLUMN_PREFIX = "idlevel";
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -152,8 +154,11 @@
         
         if ( orgUnit != null )
         {
+            int level = organisationUnitService.getLevelOfOrganisationUnit( orgUnit.getId() );
+            
             params.put( PARAM_ORGANISATIONUNIT_COLUMN_NAME, orgUnit.getName() );
-            params.put( PARAM_ORGANISATIONUNIT_LEVEL, organisationUnitService.getLevelOfOrganisationUnit( orgUnit.getId() ) );
+            params.put( PARAM_ORGANISATIONUNIT_LEVEL, level );
+            params.put( PARAM_ORGANISATIONUNIT_LEVEL_COLUMN, ORGANISATIONUNIT_LEVEL_COLUMN_PREFIX + level );
         }
         
         try
@@ -188,7 +193,7 @@
                 
                 if ( report.hasReportParams() && report.getReportParams().isParamOrganisationUnit() && orgUnit != null )
                 {
-                    params.put( PARAM_ORG_UNITS, orgUnit.getUid() );
+                    params.put( PARAM_ORG_UNITS, orgUnit.getId() );
                 }
                 
                 try