=== modified file 'dhis-2/dhis-web/dhis-web-light/pom.xml'
--- dhis-2/dhis-web/dhis-web-light/pom.xml 2011-12-26 09:25:32 +0000
+++ dhis-2/dhis-web/dhis-web-light/pom.xml 2012-01-16 18:30:37 +0000
@@ -44,6 +44,10 @@
org.hisp.dhis
+ dhis-service-administration
+
+
+ org.hisp.dhis
dhis-service-mobile
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetPeriodsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetPeriodsAction.java 2012-01-04 12:55:23 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetPeriodsAction.java 2012-01-16 18:30:37 +0000
@@ -26,14 +26,10 @@
*/
package org.hisp.dhis.light.dataentry.action;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
import org.apache.commons.lang.Validate;
+import org.hisp.dhis.datalock.DataSetLock;
+import org.hisp.dhis.datalock.DataSetLockService;
import org.hisp.dhis.dataset.CompleteDataSetRegistration;
import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
import org.hisp.dhis.dataset.DataSet;
@@ -46,7 +42,7 @@
import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
import org.hisp.dhis.system.util.FilterUtils;
-import com.opensymphony.xwork2.Action;
+import java.util.*;
/**
* @author mortenoh
@@ -74,6 +70,13 @@
this.dataSetService = dataSetService;
}
+ private DataSetLockService dataSetLockService;
+
+ public void setDataSetLockService( DataSetLockService dataSetLockService )
+ {
+ this.dataSetLockService = dataSetLockService;
+ }
+
private CompleteDataSetRegistrationService registrationService;
public void setRegistrationService( CompleteDataSetRegistrationService registrationService )
@@ -142,6 +145,13 @@
return periods;
}
+ private List lockedPeriods = new ArrayList();
+
+ public List getLockedPeriods()
+ {
+ return lockedPeriods;
+ }
+
private Boolean complete = false;
public void setComplete( Boolean complete )
@@ -190,6 +200,8 @@
periods = periods.subList( 0, MAX_PERIODS );
}
+ markLockedDataSets( organisationUnit, dataSet, periods );
+
for ( Period period : periods )
{
period.setName( format.formatPeriod( period ) );
@@ -202,4 +214,30 @@
return SUCCESS;
}
+
+ private void markLockedDataSets( OrganisationUnit organisationUnit, DataSet dataSet, List periods )
+ {
+ for ( Period period : periods )
+ {
+ boolean locked = dataSetLocked( organisationUnit, dataSet, period );
+
+ if ( locked )
+ {
+ lockedPeriods.add( period );
+ }
+ }
+ }
+
+ private boolean dataSetLocked( OrganisationUnit organisationUnit, DataSet dataSet, Period period )
+ {
+ // HACK workaround since get dataSetLock by unit/dataSet/period fails
+ DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
+
+ if ( dataSetLock != null && dataSetLock.getSources().contains( organisationUnit ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java 2012-01-12 09:16:32 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java 2012-01-16 18:30:37 +0000
@@ -37,6 +37,8 @@
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.datalock.DataSetLock;
+import org.hisp.dhis.datalock.DataSetLockService;
import org.hisp.dhis.dataset.*;
import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.datavalue.DataValueService;
@@ -105,6 +107,13 @@
this.dataSetService = dataSetService;
}
+ private DataSetLockService dataSetLockService;
+
+ public void setDataSetLockService( DataSetLockService dataSetLockService )
+ {
+ this.dataSetLockService = dataSetLockService;
+ }
+
private CompleteDataSetRegistrationService registrationService;
public void setRegistrationService( CompleteDataSetRegistrationService registrationService )
@@ -275,6 +284,9 @@
dataSet = dataSetService.getDataSet( dataSetId );
+ // this should never happen, but validate that that dataset is not locked
+ Validate.isTrue( !dataSetLocked( organisationUnit, dataSet, period ) );
+
String storedBy = currentUserService.getCurrentUsername();
if ( StringUtils.isBlank( storedBy ) )
@@ -463,4 +475,17 @@
return SUCCESS;
}
+
+ private boolean dataSetLocked( OrganisationUnit organisationUnit, DataSet dataSet, Period period )
+ {
+ // HACK workaround since get dataSetLock by unit/dataSet/period fails
+ DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
+
+ if ( dataSetLock != null && dataSetLock.getSources().contains( organisationUnit ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
}
=== 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-01-12 08:43:22 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-01-16 18:30:37 +0000
@@ -38,6 +38,7 @@
scope="prototype">
+
@@ -70,6 +71,7 @@
+
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-01-13 10:16:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-01-16 18:30:37 +0000
@@ -44,3 +44,4 @@
reply=Reply
write_feedback=Write feedback
form_complete=Form complete
+successfully_saved_section=Successfully Saved
=== 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-01-13 10:16:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm 2012-01-16 18:30:37 +0000
@@ -32,6 +32,7 @@
#end
*#
+#if( $complete != true)
#if( $dataSet.sections.size() > 0 )
@@ -45,6 +46,9 @@
#end
+#else
+
+#end