=== 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; } }