← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14660: Event report fix

 

------------------------------------------------------------
revno: 14660
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-04-04 15:06:17 +0200
message:
  Event report fix
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventReportController.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/event/EventReportController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventReportController.java	2014-03-27 14:54:30 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventReportController.java	2014-04-04 13:06:17 +0000
@@ -41,6 +41,10 @@
 import org.hisp.dhis.dxf2.utils.JacksonUtils;
 import org.hisp.dhis.eventreport.EventReport;
 import org.hisp.dhis.eventreport.EventReportService;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.i18n.I18nManager;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStageService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -72,7 +76,10 @@
     
     @Autowired
     private ProgramStageService programStageService;
-    
+
+    @Autowired
+    private I18nManager i18nManager;
+
     //--------------------------------------------------------------------------
     // CRUD
     //--------------------------------------------------------------------------
@@ -137,6 +144,21 @@
         throws Exception
     {
         report.populateAnalyticalProperties();
+
+        for ( OrganisationUnit organisationUnit : report.getOrganisationUnits() )
+        {
+            report.getParentGraphMap().put( organisationUnit.getUid(), organisationUnit.getParentGraph() );
+        }
+
+        I18nFormat format = i18nManager.getI18nFormat();
+
+        if ( report.getPeriods() != null && !report.getPeriods().isEmpty() )
+        {
+            for ( Period period : report.getPeriods() )
+            {
+                period.setName( format.formatPeriod( period ) );
+            }
+        }
     }
     
     //--------------------------------------------------------------------------