=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java 2012-11-08 13:33:53 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java 2012-11-13 04:26:49 +0000 @@ -41,6 +41,7 @@ import org.hisp.dhis.api.mobile.model.ActivityValue; import org.hisp.dhis.api.mobile.model.DataElement; import org.hisp.dhis.api.mobile.model.DataValue; +import org.hisp.dhis.program.ProgramExpressionService; import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.i18n.I18nFormat; @@ -63,10 +64,9 @@ import org.hisp.dhis.program.ProgramValidationResult; import org.hisp.dhis.program.ProgramValidationService; import org.hisp.dhis.util.ContextUtils; - import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionContext; -//import org.hisp.dhis.api.mobile.model.ProgramStage; + public class SaveProgramStageFormAction implements Action @@ -204,7 +204,19 @@ { this.programStageSectionService = programStageSectionService; } + + private ProgramExpressionService programExpressionService; + + public ProgramExpressionService getProgramExpressionService() + { + return programExpressionService; + } + public void setProgramExpressionService( ProgramExpressionService programExpressionService ) + { + this.programExpressionService = programExpressionService; + } + // ------------------------------------------------------------------------- // Input & Output // ------------------------------------------------------------------------- @@ -357,7 +369,7 @@ this.patient = patient; } - private Map leftsideFormulaMap; + private Map leftsideFormulaMap = new HashMap();; public Map getLeftsideFormulaMap() { @@ -369,7 +381,7 @@ this.leftsideFormulaMap = leftsideFormulaMap; } - private Map rightsideFormulaMap; + private Map rightsideFormulaMap = new HashMap();; public Map getRightsideFormulaMap() { @@ -565,6 +577,7 @@ ProgramStageInstance programStageInstance ) { programValidationResults = new ArrayList(); + if ( validations != null ) { for ( ProgramValidation validation : validations ) @@ -575,8 +588,19 @@ if ( validationResult != null ) { programValidationResults.add( validationResult ); + + leftsideFormulaMap.put( + validationResult.getProgramValidation().getId(), + programExpressionService.getExpressionDescription( validationResult.getProgramValidation() + .getLeftSide().getExpression() ) ); + + rightsideFormulaMap.put( + validationResult.getProgramValidation().getId(), + programExpressionService.getExpressionDescription( validationResult.getProgramValidation() + .getRightSide().getExpression() ) ); } } } + } } === 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-29 03:48:40 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-11-13 04:26:49 +0000 @@ -210,6 +210,7 @@ + === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm' --- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm 2012-11-07 12:55:09 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm 2012-11-13 04:26:49 +0000 @@ -15,8 +15,11 @@

$i18n.getString("warnings_and_errors")

#if ($typeViolationsSize > 0)$typeViolationsSize $i18n.getString("type_violation_errors").
#end - #foreach($programValidation in $programValidationResults) - $programValidation.programValidation.description .
+ #foreach($result in $programValidationResults) + #set ( $id = $result.programValidation.id ) + #set ( $leftFormula = $leftsideFormulaMap.get( $id ) ) + #set ( $rightFormula = $rightsideFormulaMap.get( $id ) ) + $!encoder.htmlEncode( $leftFormula ) $encoder.htmlEncode( $result.programValidation.operator.mathematicalOperator ) $!encoder.htmlEncode( $rightFormula )
#end #if ($programViolationsSize > 0 && $typeViolationsSize == 0) $i18n.getString("save_any_way") #end