dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37890
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19347: Data set. Replaced the allowFuturePeriods property with int openFuturePeriods. Allows specifying ...
------------------------------------------------------------
revno: 19347
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-06-10 22:22:17 +0200
message:
Data set. Replaced the allowFuturePeriods property with int openFuturePeriods. Allows specifying the number of periods to open for data entry in the future, which is more granular than simply allowing/disallowing future periods. Existing data sets which allows future periods are set to 12. Zero means no future periods which is consistent with the current default.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtilsImpl.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm
--
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/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2015-04-24 08:11:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2015-06-10 20:22:17 +0000
@@ -53,6 +53,7 @@
import org.hisp.dhis.schema.PropertyType;
import org.hisp.dhis.schema.annotation.Property;
import org.hisp.dhis.schema.annotation.PropertyRange;
+import org.hisp.dhis.util.ObjectUtils;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
@@ -358,22 +359,20 @@
}
/**
- * Indicates whether collecting data for future periods should be allowed for
- * this data element.
- *
- * @return true if all the associated data sets allow future periods, false otherwise.
- */
- public boolean isAllowFuturePeriods()
+ * Number of periods in the future to open for data capture, 0 means capture
+ * not allowed for current period. Based on the data sets of which this data
+ * element is a member.
+ */
+ public int getOpenFuturePeriods()
{
+ Set<Integer> openPeriods = new HashSet<>();
+
for ( DataSet dataSet : dataSets )
{
- if ( dataSet != null && !dataSet.isAllowFuturePeriods() )
- {
- return false;
- }
+ openPeriods.add( dataSet.getOpenFuturePeriods() );
}
-
- return true;
+
+ return ObjectUtils.firstNonNull( Collections.max( openPeriods ), 0 );
}
/**
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2015-03-31 03:17:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2015-06-10 20:22:17 +0000
@@ -186,11 +186,11 @@
// -------------------------------------------------------------------------
/**
- * Property indicating whether it should allow to enter data for future
- * periods.
+ * Number of periods in the future to open for data capture, 0 means capture
+ * not allowed for current period.
*/
- private boolean allowFuturePeriods;
-
+ private int openFuturePeriods;
+
/**
* Property indicating that all fields for a data element must be filled.
*/
@@ -698,14 +698,14 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public boolean isAllowFuturePeriods()
+ public int getOpenFuturePeriods()
{
- return allowFuturePeriods;
+ return openFuturePeriods;
}
- public void setAllowFuturePeriods( boolean allowFuturePeriods )
+ public void setOpenFuturePeriods( int openFuturePeriods )
{
- this.allowFuturePeriods = allowFuturePeriods;
+ this.openFuturePeriods = openFuturePeriods;
}
@JsonProperty
@@ -828,7 +828,7 @@
renderHorizontally = dataSet.isRenderHorizontally();
expiryDays = dataSet.getExpiryDays();
skipAggregation = dataSet.isSkipAggregation();
- allowFuturePeriods = dataSet.isAllowFuturePeriods();
+ openFuturePeriods = dataSet.getOpenFuturePeriods();
fieldCombinationRequired = dataSet.isFieldCombinationRequired();
mobile = dataSet.isMobile();
validCompleteOnly = dataSet.isValidCompleteOnly();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-04-28 20:52:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-06-10 20:22:17 +0000
@@ -588,6 +588,8 @@
executeSql( "UPDATE dataset SET renderastabs = false WHERE renderastabs IS NULL" );
executeSql( "UPDATE dataset SET renderhorizontally = false WHERE renderhorizontally IS NULL" );
executeSql( "UPDATE dataset SET novaluerequirescomment = false WHERE novaluerequirescomment IS NULL" );
+ executeSql( "UPDATE dataset SET openfutureperiods = 12 where allowfutureperiods is true" );
+ executeSql( "UPDATE dataset SET openfutureperiods = 0 where allowfutureperiods is false" );
executeSql( "UPDATE categorycombo SET skiptotal = false WHERE skiptotal IS NULL" );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2015-04-01 08:55:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2015-06-10 20:22:17 +0000
@@ -81,7 +81,7 @@
<!-- Form properties -->
- <property name="allowFuturePeriods" />
+ <property name="openFuturePeriods" column="openfutureperiods" />
<property name="fieldCombinationRequired" />
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java 2015-06-10 20:22:17 +0000
@@ -101,7 +101,7 @@
statementBuilder.setColumn( "code" );
statementBuilder.setColumn( "periodtypeid" );
statementBuilder.setColumn( "mobile" );
- statementBuilder.setColumn( "allowfutureperiods" );
+ statementBuilder.setColumn( "openfutureperiods" );
statementBuilder.setColumn( "dataentryform" );
statementBuilder.setColumn( "expirydays" );
statementBuilder.setColumn( "timelydays" );
@@ -126,7 +126,7 @@
statementBuilder.setValue( dataSet.getCode() );
statementBuilder.setValue( dataSet.getPeriodType().getId() );
statementBuilder.setValue( dataSet.isMobile() );
- statementBuilder.setValue( dataSet.isAllowFuturePeriods() );
+ statementBuilder.setValue( dataSet.getOpenFuturePeriods() );
statementBuilder.setValue( dataSet.getDataEntryForm() != null ? dataSet.getDataEntryForm().getId() : null );
statementBuilder.setValue( dataSet.getExpiryDays() );
statementBuilder.setValue( dataSet.getTimelyDays() );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueController.java 2015-03-18 20:13:23 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueController.java 2015-06-10 20:22:17 +0000
@@ -186,13 +186,12 @@
}
// ---------------------------------------------------------------------
- // Future period constraint check
+ // Future period constraint check //TODO better check
// ---------------------------------------------------------------------
-
- if ( period.isFuture() && !dataElement.isAllowFuturePeriods() )
+
+ if ( period.isFuture() && dataElement.getOpenFuturePeriods() <= 0 )
{
- ContextUtils.conflictResponse( response, "Cannot save data value for future period. " +
- "One or more data sets for data element " + de + " does not allow future periods." );
+ ContextUtils.conflictResponse( response, "One or more data sets for data element does not allow future periods: " + de );
return;
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java 2015-02-12 08:42:09 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java 2015-06-10 20:22:17 +0000
@@ -61,7 +61,7 @@
public class FormUtils
{
private static final String KEY_PERIOD_TYPE = "periodType";
- private static final String KEY_ALLOW_FUTURE_PERIODS = "allowFuturePeriods";
+ private static final String KEY_OPEN_FUTURE_PERIODS = "openFuturePeriods";
private static final String KEY_DATA_ELEMENTS = "dataElements";
private static final String KEY_INDICATORS = "indicators";
private static final String KEY_EXPIRY_DAYS = "expiryDays";
@@ -74,7 +74,7 @@
form.setSubtitle( dataSet.getDisplayShortName() );
form.getOptions().put( KEY_PERIOD_TYPE, dataSet.getPeriodType().getName() );
- form.getOptions().put( KEY_ALLOW_FUTURE_PERIODS, dataSet.isAllowFuturePeriods() );
+ form.getOptions().put( KEY_OPEN_FUTURE_PERIODS, dataSet.getOpenFuturePeriods() );
form.getOptions().put( KEY_EXPIRY_DAYS, dataSet.getExpiryDays() );
if ( dataSet.hasSections() )
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js 2015-03-27 15:44:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js 2015-06-10 20:22:17 +0000
@@ -273,6 +273,27 @@
};
/**
+ * @param {String} generator Generator to use (String)
+ * @param {Array} the periods to filter.
+ * @param {int} n number of open periods in the future.
+ * @returns {Array} Generated periods as array
+ */
+dhis2.period.PeriodGenerator.prototype.filterOpenPeriods = function( generator, periods, n ) {
+ var max = this.generators[generator].todayPlusPeriods(n);
+
+ var array = [];
+ var today = this.calendar.today();
+
+ $.each(periods, function() {
+ if( this['_endDate'].compareTo(max) < 0 ) {
+ array.push(this);
+ }
+ });
+
+ return array;
+};
+
+/**
* Convenience method to get Daily generator
*/
dhis2.period.PeriodGenerator.prototype.daily = function( offset ) {
@@ -440,6 +461,17 @@
*/
$generate: function( offset ) {
throw new Error('$generate method not implemented on ' + this.name + ' generator.');
+ },
+ /**
+ * Get the date calculated from current date added the given number of periods
+ * of this period type.
+ *
+ * @param {int} n number of periods.
+ * @return date object.
+ */
+ todayPlusPeriods: function( n ) {
+ n = n || 0;
+ return this.$todayPlusPeriods(n);
}
});
@@ -482,6 +514,9 @@
}
return periods;
+ },
+ $todayPlusPeriods: function( n ) {
+ return this.calendar.today().add(n, 'd');
}
});
@@ -535,6 +570,9 @@
}
return periods;
+ },
+ $todayPlusPeriods: function( n ) {
+ return this.calendar.today().add(n, 'w');
}
});
@@ -557,7 +595,7 @@
$generate: function( offset ) {
var year = offset + this.calendar.today().year();
var periods = [];
-
+
for( var month = 1; month <= this.calendar.monthsInYear(year); month++ ) {
var startDate = this.calendar.newDate(year, month, 1);
var endDate = this.calendar.newDate(startDate).set(startDate.daysInMonth(month), 'd');
@@ -576,6 +614,9 @@
}
return periods;
+ },
+ $todayPlusPeriods: function( n ) {
+ return this.calendar.today().add(n, 'm');
}
});
@@ -618,6 +659,9 @@
}
return periods;
+ },
+ $todayPlusPeriods: function( n ) {
+ return this.calendar.today().add(n * 2, 'm');
}
});
@@ -660,6 +704,9 @@
}
return periods;
+ },
+ $todayPlusPeriods: function( n ) {
+ return this.calendar.today().add(n * 3, 'm');
}
});
@@ -716,6 +763,9 @@
periods.push(period);
return periods;
+ },
+ $todayPlusPeriods: function( n ) {
+ return this.calendar.today().add(n * 6, 'm');
}
});
@@ -772,6 +822,9 @@
periods.push(period);
return periods;
+ },
+ $todayPlusPeriods: function( n ) {
+ return this.calendar.today().add(n * 6, 'm');
}
});
@@ -815,6 +868,9 @@
}
return periods;
+ },
+ $todayPlusPeriods: function( n ) {
+ return this.calendar.today().add(n, 'y');
}
});
@@ -867,6 +923,9 @@
}
return periods;
+ },
+ $todayPlusPeriods: function( n ) {
+ return this.calendar.today().add(n, 'y');
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2015-04-10 10:22:15 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2015-06-10 20:22:17 +0000
@@ -1164,7 +1164,7 @@
var previousDataSetValid = ( dhis2.de.currentDataSetId && dhis2.de.currentDataSetId != -1 );
var previousDataSet = !!previousDataSetValid ? dhis2.de.dataSets[dhis2.de.currentDataSetId] : undefined;
var previousPeriodType = previousDataSet ? previousDataSet.periodType : undefined;
- var previousAllowFuturePeriods = previousDataSet ? previousDataSet.allowFuturePeriods : false;
+ var previousOpenFuturePeriods = previousDataSet ? previousDataSet.openFuturePeriods : false;
dhis2.de.currentDataSetId = $( '#selectedDataSetId' ).val();
@@ -1175,10 +1175,10 @@
$( '#nextButton' ).removeAttr( 'disabled' );
var periodType = dhis2.de.dataSets[dhis2.de.currentDataSetId].periodType;
- var allowFuturePeriods = dhis2.de.dataSets[dhis2.de.currentDataSetId].allowFuturePeriods;
+ var openFuturePeriods = dhis2.de.dataSets[dhis2.de.currentDataSetId].openFuturePeriods;
var previousSelectionValid = !!( periodType == previousPeriodType &&
- ( allowFuturePeriods == previousAllowFuturePeriods || dhis2.de.currentPeriodOffset <= 0 ) );
+ ( openFuturePeriods == previousOpenFuturePeriods || dhis2.de.currentPeriodOffset <= 0 ) );
dhis2.de.currentCategories = dhis2.de.getCategories( dhis2.de.currentDataSetId );
@@ -1250,9 +1250,9 @@
*/
function nextPeriodsSelected()
{
- var allowFuturePeriods = !!( dhis2.de.currentDataSetId && dhis2.de.dataSets[dhis2.de.currentDataSetId].allowFuturePeriods );
+ var openFuturePeriods = !!( dhis2.de.currentDataSetId && dhis2.de.dataSets[dhis2.de.currentDataSetId].openFuturePeriods );
- if ( dhis2.de.currentPeriodOffset < 0 || allowFuturePeriods )
+ if ( dhis2.de.currentPeriodOffset < 0 || openFuturePeriods )
{
dhis2.de.currentPeriodOffset++;
displayPeriods();
@@ -1275,14 +1275,11 @@
{
var dataSetId = $( '#selectedDataSetId' ).val();
var periodType = dhis2.de.dataSets[dataSetId].periodType;
- var allowFuturePeriods = dhis2.de.dataSets[dataSetId].allowFuturePeriods;
- var periods = dhis2.period.generator.generateReversedPeriods(periodType, dhis2.de.currentPeriodOffset);
-
- if ( allowFuturePeriods == false )
- {
- periods = dhis2.period.generator.filterFuturePeriods( periods );
- }
-
+ var openFuturePeriods = dhis2.de.dataSets[dataSetId].openFuturePeriods;
+ var periods = dhis2.period.generator.generateReversedPeriods( periodType, dhis2.de.currentPeriodOffset );
+
+ periods = dhis2.period.generator.filterOpenPeriods( periodType, periods, openFuturePeriods );
+
clearListById( 'selectedPeriodId' );
if ( periods.length > 0 )
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm 2014-11-17 17:24:22 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm 2015-06-10 20:22:17 +0000
@@ -36,7 +36,7 @@
#set( $size = $dataSets.size() )
#foreach( $dataSet in $dataSets )
"${dataSet.uid}":{"name":"$encoder.jsonEncode( ${dataSet.displayName} )","periodType":"$encoder.jsonEncode( ${dataSet.periodType.name} )","categoryCombo":"${dataSet.categoryCombo.uid}","version":"${dataSet.version}",
-"type":"${dataSet.getDataSetType()}","expiryDays":"${dataSet.expiryDays}","allowFuturePeriods":${dataSet.allowFuturePeriods},"fieldCombinationRequired":${dataSet.fieldCombinationRequired},
+"type":"${dataSet.getDataSetType()}","expiryDays":"${dataSet.expiryDays}","openFuturePeriods":${dataSet.openFuturePeriods},"fieldCombinationRequired":${dataSet.fieldCombinationRequired},
"validCompleteOnly":${dataSet.validCompleteOnly},"skipOffline":${dataSet.skipOffline}, "renderAsTabs":${dataSet.renderAsTabs}, "renderHorizontally":${dataSet.renderHorizontally}}#if( $velocityCount < $size ),#end
#end },
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtilsImpl.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtilsImpl.java 2015-05-28 16:10:07 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtilsImpl.java 2015-06-10 20:22:17 +0000
@@ -283,7 +283,9 @@
periodType = (CalendarPeriodType) dataSet.getPeriodType();
}
- if ( dataSet.isAllowFuturePeriods() )
+ //TODO implement properly
+
+ if ( dataSet.getOpenFuturePeriods() > 0 )
{
List<Period> periods = periodType.generatePeriods( new Date() );
Collections.reverse( periods );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2015-03-11 11:01:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2015-06-10 20:22:17 +0000
@@ -197,11 +197,11 @@
this.frequencySelect = frequencySelect;
}
- private boolean allowFuturePeriods;
+ private int openFuturePeriods;
- public void setAllowFuturePeriods( boolean allowFuturePeriods )
+ public void setOpenFuturePeriods( int openFuturePeriods )
{
- this.allowFuturePeriods = allowFuturePeriods;
+ this.openFuturePeriods = openFuturePeriods;
}
private boolean fieldCombinationRequired;
@@ -340,7 +340,7 @@
dataSet.setMobile( false );
dataSet.setIndicators( indicators );
dataSet.setNotificationRecipients( userGroupService.getUserGroup( notificationRecipients ) );
- dataSet.setAllowFuturePeriods( allowFuturePeriods );
+ dataSet.setOpenFuturePeriods( openFuturePeriods );
dataSet.setFieldCombinationRequired( fieldCombinationRequired );
dataSet.setValidCompleteOnly( validCompleteOnly );
dataSet.setNoValueRequiresComment( noValueRequiresComment );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2015-05-28 16:10:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2015-06-10 20:22:17 +0000
@@ -216,11 +216,11 @@
this.dataSetId = dataSetId;
}
- private boolean allowFuturePeriods;
+ private int openFuturePeriods;
- public void setAllowFuturePeriods( boolean allowFuturePeriods )
+ public void setOpenFuturePeriods( int openFuturePeriods )
{
- this.allowFuturePeriods = allowFuturePeriods;
+ this.openFuturePeriods = openFuturePeriods;
}
private boolean fieldCombinationRequired;
@@ -362,7 +362,7 @@
dataSet.setPeriodType( periodService.getPeriodTypeByClass( periodType.getClass() ) );
dataSet.updateDataElements( dataElements );
dataSet.setIndicators( indicators );
- dataSet.setAllowFuturePeriods( allowFuturePeriods );
+ dataSet.setOpenFuturePeriods( openFuturePeriods );
dataSet.setFieldCombinationRequired( fieldCombinationRequired );
dataSet.setValidCompleteOnly( validCompleteOnly );
dataSet.setNoValueRequiresComment( noValueRequiresComment );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties 2014-12-22 16:00:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties 2015-06-10 20:22:17 +0000
@@ -114,3 +114,4 @@
legend_set=Legend set
enable_for_java_mobile_client = Enable for Java mobile client
view_sections = View sections
+open_future_periods_for_data_entry=Open future periods for data entry
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2014-10-23 11:57:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2015-06-10 20:22:17 +0000
@@ -66,6 +66,10 @@
<td><input type="text" id="expiryDays" name="expiryDays" value="0"></td>
</tr>
<tr>
+ <td><label>$i18n.getString( "open_future_periods_for_data_entry" )</label></td>
+ <td><input type="text" id="openFuturePeriods" name="openFuturePeriods" value="0"></td>
+ </tr>
+ <tr>
<td><label>$i18n.getString( "timely_days" )</label></td>
<td><input type="text" id="timelyDays" name="timelyDays" value="15"></td>
</tr>
@@ -151,15 +155,6 @@
</thead>
<tbody>
<tr>
- <td><label>$i18n.getString( "allow_future_periods" )</label></td>
- <td>
- <select id="allowFuturePeriods" name="allowFuturePeriods">
- <option value="false">$i18n.getString( "no" )</option>
- <option value="true">$i18n.getString( "yes" )</option>
- </select>
- </td>
- </tr>
- <tr>
<td><label>$i18n.getString( "all_fields_for_data_element_required" )</label></td>
<td>
<select id="fieldCombinationRequired" name="fieldCombinationRequired">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2014-10-23 11:57:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2015-06-10 20:22:17 +0000
@@ -70,6 +70,10 @@
<td><input type="text" id="expiryDays" name="expiryDays" value="$!encoder.htmlEncode( $dataSet.expiryDays )"/></td>
</tr>
<tr>
+ <td><label>$i18n.getString( "open_future_periods_for_data_entry" )</label></td>
+ <td><input type="text" id="openFuturePeriods" name="openFuturePeriods" value="$!encoder.htmlEncode( $dataSet.openFuturePeriods )"></td>
+ </tr>
+ <tr>
<td><label>$i18n.getString( "timely_days" )</label></td>
<td><input type="text" id="timelyDays" name="timelyDays" value="$!encoder.htmlEncode( $dataSet.timelyDays )"/></td>
</tr>
@@ -155,15 +159,6 @@
</thead>
<tbody>
<tr>
- <td><label for="allowFuturePeriods">$i18n.getString( "allow_future_periods" )</label></td>
- <td>
- <select id="allowFuturePeriods" name="allowFuturePeriods">
- <option value="false">$i18n.getString( "no" )</option>
- <option value="true"#if( $dataSet.allowFuturePeriods == true ) selected="selected"#end>$i18n.getString( "yes" )</option>
- </select>
- </td>
- </tr>
- <tr>
<td><label for="fieldCombinationRequired">$i18n.getString( "all_fields_for_data_element_required" )</label></td>
<td>
<select id="fieldCombinationRequired" name="fieldCombinationRequired">