dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17985
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7392: WIP function for option for allowing for data entry of future periods
------------------------------------------------------------
revno: 7392
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-06-25 22:39:32 +0200
message:
WIP function for option for allowing for data entry of future periods
modified:
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-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-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/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2012-05-21 13:28:46 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2012-06-25 20:39:32 +0000
@@ -121,6 +121,11 @@
private boolean mobile;
/**
+ * Property indicating whether it should allow to enter data for future periods.
+ */
+ private boolean allowFuturePeriods;
+
+ /**
* Indicating custom data entry form.
*/
private DataEntryForm dataEntryForm;
@@ -487,6 +492,19 @@
@JsonProperty
@JsonView( {DetailedView.class, ExportView.class} )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+ public boolean isAllowFuturePeriods()
+ {
+ return allowFuturePeriods;
+ }
+
+ public void setAllowFuturePeriods( boolean allowFuturePeriods )
+ {
+ this.allowFuturePeriods = allowFuturePeriods;
+ }
+
+ @JsonProperty
+ @JsonView( {DetailedView.class, ExportView.class} )
+ @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public Integer getVersion()
{
return version;
=== 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 2012-06-05 23:39:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2012-06-25 20:39:32 +0000
@@ -383,6 +383,7 @@
executeSql( "update indicator set annualized = false where annualized is null" );
executeSql( "update indicatortype set indicatornumber = false where indicatornumber is null" );
executeSql( "update dataset set mobile = false where mobile is null" );
+ executeSql( "update dataset set allowfutureperiods = false where allowfutureperiods is null" );
executeSql( "update dataelement set zeroissignificant = false where zeroissignificant is null" );
executeSql( "update organisationunit set haspatients = false where haspatients is null" );
executeSql( "update dataset set expirydays = 0 where expirydays 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 2012-03-06 03:17:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2012-06-25 20:39:32 +0000
@@ -60,6 +60,8 @@
foreign-key="fk_dataset_dataentryform" cascade="all" />
<property name="mobile" not-null="true" />
+
+ <property name="allowFuturePeriods" />
<property name="version" />
=== 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 2012-04-24 16:39:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2012-06-25 20:39:32 +0000
@@ -547,8 +547,13 @@
{
var dataSetId = $( '#selectedDataSetId' ).val();
var periodType = dataSets[dataSetId].periodType;
+ var allowFuturePeriods = dataSets[dataSetId].allowFuturePeriods;
var periods = periodTypeFactory.get( periodType ).generatePeriods( currentPeriodOffset );
- periods = periodTypeFactory.filterFuturePeriods( periods );
+
+ if ( allowFuturePeriods == "false" )
+ {
+ periods = periodTypeFactory.filterFuturePeriods( periods );
+ }
clearListById( 'selectedPeriodId' );
@@ -573,8 +578,13 @@
var dataSetId = $( '#selectedDataSetId' ).val();
var periodId = $( '#selectedPeriodId' ).val();
var periodType = dataSets[dataSetId].periodType;
+ var allowFuturePeriods = dataSets[dataSetId].allowFuturePeriods;
var periods = periodTypeFactory.get( periodType ).generatePeriods( currentPeriodOffset );
- periods = periodTypeFactory.filterFuturePeriods( periods );
+
+ if ( allowFuturePeriods == "false" )
+ {
+ periods = periodTypeFactory.filterFuturePeriods( periods );
+ }
if ( dataSetId && dataSetId != -1 )
{
=== 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 2012-02-16 12:07:10 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm 2012-06-25 20:39:32 +0000
@@ -24,7 +24,7 @@
#set( $size = $dataSets.size() )
#foreach( $dataSet in $dataSets )
"${dataSet.id}":{"name":"$encoder.jsonEncode( ${dataSet.displayName} )","periodType":"$encoder.jsonEncode( ${dataSet.periodType.name} )",
-"version":"${dataSet.version}","type":"${dataSet.getDataSetType()}","expiryDays":"${dataSet.expiryDays}"
+"allowFuturePeriods":"${dataSet.allowFuturePeriods}","version":"${dataSet.version}","type":"${dataSet.getDataSetType()}","expiryDays":"${dataSet.expiryDays}"
}#if( $velocityCount < $size ),#end
#end },
=== 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 2012-03-06 03:17:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2012-06-25 20:39:32 +0000
@@ -114,6 +114,13 @@
this.description = description;
}
+ private boolean allowFuturePeriods;
+
+ public void setAllowFuturePeriods( boolean allowFuturePeriods )
+ {
+ this.allowFuturePeriods = allowFuturePeriods;
+ }
+
private int expiryDays;
public void setExpiryDays( int expiryDays )
@@ -182,10 +189,11 @@
indicators.add( indicatorService.getIndicator( Integer.parseInt( id ) ) );
}
+ dataSet.setDescription( description );
+ dataSet.setAllowFuturePeriods( allowFuturePeriods );
dataSet.setVersion( 1 );
dataSet.setMobile( mobile );
dataSet.setIndicators( indicators );
- dataSet.setDescription( description );
dataSetService.addDataSet( dataSet );
=== 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 2012-03-30 09:25:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2012-06-25 20:39:32 +0000
@@ -125,6 +125,13 @@
this.description = description;
}
+ private boolean allowFuturePeriods;
+
+ public void setAllowFuturePeriods( boolean allowFuturePeriods )
+ {
+ this.allowFuturePeriods = allowFuturePeriods;
+ }
+
private int expiryDays;
public void setExpiryDays( int expiryDays )
@@ -204,6 +211,7 @@
dataSet.setName( name );
dataSet.setShortName( shortName );
dataSet.setDescription( description );
+ dataSet.setAllowFuturePeriods( allowFuturePeriods );
dataSet.setCode( code );
dataSet.setPeriodType( periodService.getPeriodTypeByClass( periodType.getClass() ) );
dataSet.updateDataElements( dataElements );
=== 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 2012-06-04 16:20:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties 2012-06-25 20:39:32 +0000
@@ -86,4 +86,5 @@
comfortable=Comfortable
regular=Regular
compact=Compact
-none=None
\ No newline at end of file
+none=None
+allow_future_periods=Allow future periods
\ No newline at end of file
=== 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 2012-03-07 10:32:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2012-06-25 20:39:32 +0000
@@ -68,12 +68,21 @@
<td><input type="text" id="shortName" name="shortName" style="width:20em"/></td>
</tr>
<tr>
+ <td><label>$i18n.getString( "code" )</label></td>
+ <td><input type="text" id="code" name="code" style="width:20em"/></td>
+ </tr>
+ <tr>
<td><label>$i18n.getString( "description" )</label></td>
<td><input type="text" id="description" name="description" style="width:20em"/></td>
</tr>
<tr>
- <td><label>$i18n.getString( "code" )</label></td>
- <td><input type="text" id="code" name="code" style="width:20em"/></td>
+ <td><label>$i18n.getString( "allow_future_periods" )</label></td>
+ <td>
+ <select id="allowFuturePeriods" name="allowFuturePeriods" style="min-width:20em; margin:0;">
+ <option value="false">$i18n.getString( "no" )</option>
+ <option value="true">$i18n.getString( "yes" )</option>
+ </select>
+ </td>
</tr>
<tr>
<td><label>$i18n.getString( "expiry_days" )</label></td>
=== 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 2012-03-07 10:32:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2012-06-25 20:39:32 +0000
@@ -68,12 +68,21 @@
<td><input type="text" id="shortName" name="shortName" style="width:20em" value="$!encoder.htmlEncode( $dataSet.shortName )"/></td>
</tr>
<tr>
+ <td><label>$i18n.getString( "code" )</label></td>
+ <td><input type="text" id="code" name="code" style="width:20em" value="$!encoder.htmlEncode( $dataSet.code )"/></td>
+ </tr>
+ <tr>
<td><label>$i18n.getString( "description" )</label></td>
<td><input type="text" id="description" name="description" style="width:20em" value="$!encoder.htmlEncode( $dataSet.description )"/></td>
</tr>
<tr>
- <td><label>$i18n.getString( "code" )</label></td>
- <td><input type="text" id="code" name="code" style="width:20em" value="$!encoder.htmlEncode( $dataSet.code )"/></td>
+ <td><label>$i18n.getString( "allow_future_periods" )</label></td>
+ <td>
+ <select id="allowFuturePeriods" name="allowFuturePeriods" style="min-width:20em; margin:0;">
+ <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>$i18n.getString( "expiry_days" )</label></td>