← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6858: Report table, fixed bug, prompting for month when last 12 months is selected as relative period i...

 

------------------------------------------------------------
revno: 6858
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-05-04 14:22:46 +0200
message:
  Report table, fixed bug, prompting for month when last 12 months is selected as relative period instead of year
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.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/RelativePeriods.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java	2012-04-20 07:38:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java	2012-05-04 12:22:46 +0000
@@ -250,6 +250,9 @@
         this.last6BiMonths = false;
         this.last4Quarters = false;
         this.last2SixMonths = false;
+        this.thisFinancialYear = false;
+        this.lastFinancialYear = false;
+        this.last5FinancialYears = false;
 
         return this;
     }
@@ -261,25 +264,30 @@
      */
     public PeriodType getPeriodType()
     {
-        if ( isReportingMonth() )
+        if ( isReportingMonth() || isLast12Months() )
         {
             return PeriodType.getPeriodTypeByName( MonthlyPeriodType.NAME );
         }
 
-        if ( isReportingBimonth() )
+        if ( isReportingBimonth() || isLast6BiMonths() )
         {
             return PeriodType.getPeriodTypeByName( BiMonthlyPeriodType.NAME );
         }
 
-        if ( isReportingQuarter() )
+        if ( isReportingQuarter() || isLast4Quarters() )
         {
             return PeriodType.getPeriodTypeByName( QuarterlyPeriodType.NAME );
         }
 
-        if ( isLastSixMonth() )
+        if ( isLastSixMonth() || isLast2SixMonths() )
         {
             return PeriodType.getPeriodTypeByName( SixMonthlyPeriodType.NAME );
         }
+        
+        if ( isThisFinancialYear() || isLastFinancialYear() || isLast5FinancialYears() )
+        {
+            return PeriodType.getPeriodTypeByName( FinancialJulyPeriodType.NAME );
+        }
 
         return PeriodType.getPeriodTypeByName( YearlyPeriodType.NAME );
     }
@@ -828,6 +836,9 @@
         result = prime * result + (last6BiMonths ? 1 : 0);
         result = prime * result + (last4Quarters ? 1 : 0);
         result = prime * result + (last2SixMonths ? 1 : 0);
+        result = prime * result + (thisFinancialYear ? 1 : 0);
+        result = prime * result + (lastFinancialYear ? 1 : 0);
+        result = prime * result + (last5FinancialYears ? 1 : 0);
 
         return result;
     }
@@ -927,6 +938,21 @@
             return false;
         }
 
+        if ( !thisFinancialYear == other.thisFinancialYear )
+        {
+            return false;
+        }
+
+        if ( !lastFinancialYear == other.lastFinancialYear )
+        {
+            return false;
+        }
+
+        if ( !last5FinancialYears == other.last5FinancialYears )
+        {
+            return false;
+        }
+
         return true;
     }
 }