dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32958
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16762: use local dates for standard reports
------------------------------------------------------------
revno: 16762
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-09-21 16:05:07 +0700
message:
use local dates for standard reports
modified:
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.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-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.java 2014-09-21 08:42:21 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.java 2014-09-21 09:05:07 +0000
@@ -29,11 +29,14 @@
*/
import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.calendar.Calendar;
+import org.hisp.dhis.calendar.DateTimeUnit;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.period.CalendarPeriodType;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.RelativePeriods;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.report.ReportService;
@@ -191,11 +194,23 @@
Collections.reverse( periods );
FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() );
+ Calendar calendar = PeriodType.getCalendar();
+
for ( Period period_ : periods )
{
BaseIdentifiableObject period = new BaseIdentifiableObject();
- period.setUid( period_.getIsoDate() );
- period.setDisplayName( format.formatPeriod( period_ ) );
+
+ if ( calendar.isIso8601() )
+ {
+ period.setUid( period_.getIsoDate() );
+ period.setDisplayName( format.formatPeriod( period_ ) );
+ }
+ else
+ {
+ DateTimeUnit dateTimeUnit = calendar.fromIso( DateTimeUnit.fromJdkDate( period_.getStartDate() ) );
+ period.setUid( period_.getPeriodType().getIsoDate( dateTimeUnit ) );
+ period.setDisplayName( format.formatPeriod( period_ ) );
+ }
this.periods.add( period );
}