=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetOverviewAction.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetOverviewAction.java 2012-01-22 19:37:21 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetOverviewAction.java 2012-10-29 03:48:40 +0000 @@ -29,6 +29,7 @@ import com.opensymphony.xwork2.Action; import org.apache.commons.lang.Validate; +import org.hisp.dhis.dataset.CompleteDataSetRegistrationService; import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.dataset.Section; @@ -92,6 +93,13 @@ this.format = format; } + private CompleteDataSetRegistrationService registrationService; + + public void setRegistrationService( CompleteDataSetRegistrationService registrationService ) + { + this.registrationService = registrationService; + } + // ------------------------------------------------------------------------- // Input & Output // ------------------------------------------------------------------------- @@ -186,6 +194,18 @@ this.validated = validated; } + private boolean completed; + + public boolean isCompleted() + { + return completed; + } + + public void setCompleted( boolean isCompleted ) + { + this.completed = isCompleted; + } + // ------------------------------------------------------------------------- // Action Implementation // ------------------------------------------------------------------------- @@ -205,6 +225,16 @@ dataSet = dataSetService.getDataSet( dataSetId ); + if ( registrationService.getCompleteDataSetRegistration( dataSet, period, organisationUnit ) == null ) + { + completed = false; + } + else + { + completed = true; + } + + if ( sectionId != null ) { for ( Section section : dataSet.getSections() ) === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/MarkComplete.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/MarkComplete.java 2012-01-23 06:32:10 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/MarkComplete.java 2012-10-29 03:48:40 +0000 @@ -156,6 +156,7 @@ registration.setStoredBy( currentUserService.getCurrentUsername() ); registrationService.saveCompleteDataSetRegistration( registration ); + } return SUCCESS; === added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/UndoCompleteAction.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/UndoCompleteAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/UndoCompleteAction.java 2012-10-29 03:48:40 +0000 @@ -0,0 +1,107 @@ +package org.hisp.dhis.light.dataentry.action; + +import org.hisp.dhis.dataset.CompleteDataSetRegistration; +import org.hisp.dhis.dataset.CompleteDataSetRegistrationService; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.period.Period; +import org.hisp.dhis.period.PeriodService; +import com.opensymphony.xwork2.Action; + +public class UndoCompleteAction implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private CompleteDataSetRegistrationService registrationService; + + public void setRegistrationService( CompleteDataSetRegistrationService registrationService ) + { + this.registrationService = registrationService; + } + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private PeriodService periodService; + + public void setPeriodService( PeriodService periodService ) + { + this.periodService = periodService; + } + + // ------------------------------------------------------------------------- + // Input & Output + // ------------------------------------------------------------------------- + + private Integer organisationUnitId; + + public void setOrganisationUnitId( Integer organisationUnitId ) + { + this.organisationUnitId = organisationUnitId; + } + + public Integer getOrganisationUnitId() + { + return organisationUnitId; + } + + private String periodId; + + public void setPeriodId( String periodId ) + { + this.periodId = periodId; + } + + public String getPeriodId() + { + return periodId; + } + + private Integer dataSetId; + + public void setDataSetId( Integer dataSetId ) + { + this.dataSetId = dataSetId; + } + + public Integer getDataSetId() + { + return dataSetId; + } + + @Override + public String execute() + throws Exception + { + OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId ); + + Period period = periodService.getPeriodByExternalId( periodId ); + + DataSet dataSet = dataSetService.getDataSet( dataSetId ); + + CompleteDataSetRegistration registration = registrationService.getCompleteDataSetRegistration( dataSet, period, organisationUnit ); + + if ( registration != null ) + { + registrationService.deleteCompleteDataSetRegistration( registration ); + } + + return SUCCESS; + } + +} === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-10-23 07:56:15 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-10-29 03:48:40 +0000 @@ -70,6 +70,8 @@ + + + + + + + + + + + + /light/dataEntry.action?organisationUnitId=${organisationUnitId}&dataSetId=${dataSetId}&periodId=${periodId} + + === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm' --- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm 2012-10-12 09:22:44 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm 2012-10-29 03:48:40 +0000 @@ -38,8 +38,7 @@

-
- + @@ -47,7 +46,7 @@

- +