← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4711: Fixed issue with period persistence and period filtering in light module

 

------------------------------------------------------------
revno: 4711
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-09-27 13:21:17 +0200
message:
  Fixed issue with period persistence and period filtering in light module
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetPeriodsAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetSectionFormAction.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-light/src/main/java/org/hisp/dhis/light/action/GetPeriodsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetPeriodsAction.java	2011-09-23 15:49:07 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetPeriodsAction.java	2011-09-27 11:21:17 +0000
@@ -35,6 +35,8 @@
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.period.CalendarPeriodType;
 import org.hisp.dhis.period.Period;
+import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
+import org.hisp.dhis.system.util.FilterUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -109,6 +111,7 @@
             DataSet dataSet = dataSetService.getDataSet( dataSetId );
             CalendarPeriodType periodType = (CalendarPeriodType) dataSet.getPeriodType();
             periods = periodType.generatePeriods( new Date() );
+            FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() );
         }
 
         for ( Period period : periods )

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetSectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetSectionFormAction.java	2011-09-27 10:41:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetSectionFormAction.java	2011-09-27 11:21:17 +0000
@@ -225,8 +225,7 @@
     {
         OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
 
-        Period period = PeriodType.createPeriodExternalId( periodId );
-        Period vPeriod = periodService.reloadPeriod( PeriodType.createPeriodExternalId( periodId ) );
+        Period period = periodService.getPeriodByExternalId( periodId );
 
         dataSet = dataSetService.getDataSet( dataSetId );
 
@@ -245,7 +244,7 @@
                     if ( dataValue != null )
                     {
                         value = dataValue.getValue();
-                        validateDataElement( organisationUnit, dataElement, optionCombo, vPeriod, value );
+                        validateDataElement( organisationUnit, dataElement, optionCombo, period, value );
                     }
 
                     dataValues.put( key, value );