dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09977
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2720: Fixed bug, should only allow data elements of same period type in validation rule expression. Not...
------------------------------------------------------------
revno: 2720
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-01-22 23:35:40 +0100
message:
Fixed bug, should only allow data elements of same period type in validation rule expression. Not completely waterproof but alot better.
modified:
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/paging/ActionPagingSupport.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleForm.vm
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.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-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java 2011-01-22 20:56:30 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java 2011-01-22 22:35:40 +0000
@@ -40,6 +40,7 @@
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.paging.ActionPagingSupport;
import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
+import org.hisp.dhis.system.filter.DataElementPeriodTypeFilter;
import org.hisp.dhis.system.util.Filter;
import org.hisp.dhis.system.util.FilterUtils;
@@ -77,7 +78,7 @@
}
// -------------------------------------------------------------------------
- // Input
+ // Exclusive filters
// -------------------------------------------------------------------------
private Integer id;
@@ -101,12 +102,23 @@
this.dataSetId = dataSetId;
}
+ // -------------------------------------------------------------------------
+ // Inclusive filters
+ // -------------------------------------------------------------------------
+
private String aggregationOperator;
public void setAggregationOperator( String aggregationOperator )
{
this.aggregationOperator = aggregationOperator;
}
+
+ private String periodType;
+
+ public void setPeriodType( String periodType )
+ {
+ this.periodType = periodType;
+ }
private boolean includeTotals = false;
@@ -115,18 +127,6 @@
this.includeTotals = includeTotals;
}
- private boolean usePaging = false;
-
- public boolean isUsePaging()
- {
- return usePaging;
- }
-
- public void setUsePaging( boolean usePaging )
- {
- this.usePaging = usePaging;
- }
-
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -167,6 +167,11 @@
{
FilterUtils.filter( dataElements, AGGREGATABLE_FILTER );
}
+
+ if ( periodType != null )
+ {
+ FilterUtils.filter( dataElements, new DataElementPeriodTypeFilter( periodType ) );
+ }
operands = new ArrayList<DataElementOperand>( dataElementCategoryService.getOperands( dataElements, includeTotals ) );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/paging/ActionPagingSupport.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/paging/ActionPagingSupport.java 2011-01-22 20:56:30 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/paging/ActionPagingSupport.java 2011-01-22 22:35:40 +0000
@@ -66,6 +66,18 @@
return paging;
}
+ protected boolean usePaging = false;
+
+ public boolean isUsePaging()
+ {
+ return usePaging;
+ }
+
+ public void setUsePaging( boolean usePaging )
+ {
+ this.usePaging = usePaging;
+ }
+
@SuppressWarnings( "unchecked" )
private String getCurrentLink()
{
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleForm.vm 2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleForm.vm 2011-01-22 22:35:40 +0000
@@ -38,7 +38,7 @@
<td>
<select type="text" id="periodTypeName" name="periodTypeName" style="min-width:20em" >
#foreach ( $periodType in $periodTypes )
- <option value="$periodType.name" #if( $periodType.name.equals($monthlyPeriodTypeName ) ) selected #end>$i18n.getString($periodType.name)</option>
+ <option value="$periodType.name" #if( $periodType.name.equals( ${monthlyPeriodTypeName} ) ) selected #end>$i18n.getString($periodType.name)</option>
#end
</select>
<img title="$i18n.getString('clear_expression')" onclick='setNullExpression();' src='images/edit-clear.png' style='width: 20px;cursor:pointer' />
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.vm 2011-01-22 22:12:38 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.vm 2011-01-22 22:35:40 +0000
@@ -75,12 +75,12 @@
height:500,
title: "$i18n.getString( 'expression' )"
});
-
- getOperandsPage();
});
function editLeftExpression()
- {
+ {
+ getOperandsPage();
+
left = true;
var leftSideDescription = getFieldValue( 'leftSideDescription' );
@@ -96,6 +96,8 @@
function editRightExpression()
{
+ getOperandsPage();
+
left = false;
var rightSideDescription = getFieldValue( 'rightSideDescription' );
@@ -111,9 +113,11 @@
function getOperandsPage()
{
- var key = getFieldValue( "expression-container input[id=filter]");
+ var key = getFieldValue( "expression-container input[id=filter]" );
+
+ var periodType = getFieldValue( "periodTypeName" );
- dataDictionary.loadOperands( "#expression-container select[id=dataElementId]", {usePaging: true, key: key} );
+ dataDictionary.loadOperands( "#expression-container select[id=dataElementId]", {usePaging: true, key: key, periodType: periodType} );
}
function getExpressionText()