← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16463: minor calendar fix

 

------------------------------------------------------------
revno: 16463
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-08-21 14:39:50 +0700
message:
  minor calendar fix
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/CalendarPeriodType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/DailyPeriodType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/FinancialPeriodType.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/period/CalendarPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/CalendarPeriodType.java	2014-08-20 10:58:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/CalendarPeriodType.java	2014-08-21 07:39:50 +0000
@@ -157,10 +157,12 @@
         dateUnit = getCalendar().minusYears( dateUnit, 4 );
         List<Period> periods = Lists.newArrayList();
 
+        Calendar calendar = getCalendar();
+
         for ( int i = 0; i < 5; i++ )
         {
             periods.addAll( generatePeriods( dateUnit ) );
-            dateUnit = getCalendar().plusYears( dateUnit, 1 );
+            dateUnit = calendar.plusYears( dateUnit, 1 );
         }
 
         return periods;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/DailyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/DailyPeriodType.java	2014-08-20 10:58:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/DailyPeriodType.java	2014-08-21 07:39:50 +0000
@@ -120,10 +120,12 @@
 
         int year = dateUnit.getYear();
 
+        Calendar calendar = getCalendar();
+
         while ( year == dateUnit.getYear() )
         {
             periods.add( createPeriod( dateUnit, null ) );
-            dateUnit = getCalendar().plusDays( dateUnit, 1 );
+            dateUnit = calendar.plusDays( dateUnit, 1 );
         }
 
         return periods;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/FinancialPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/FinancialPeriodType.java	2014-08-20 10:58:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/FinancialPeriodType.java	2014-08-21 07:39:50 +0000
@@ -125,10 +125,12 @@
         dateUnit.setMonth( getBaseMonth() + 1 );
         dateUnit.setDay( 1 );
 
+        Calendar calendar = getCalendar();
+
         for ( int i = 0; i < 11; i++ )
         {
             periods.add( createPeriod( dateUnit, cal ) );
-            dateUnit = getCalendar().plusYears( dateUnit, 1 );
+            dateUnit = calendar.plusYears( dateUnit, 1 );
         }
 
         return periods;