=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java 2012-11-12 06:07:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java 2012-11-12 07:04:25 +0000 @@ -105,14 +105,6 @@ this.program = program; } - public ProgramValidation( String description, ProgramExpression leftSide, ProgramExpression rightSide, Program program, Boolean dateType ) - { - this.description = description; - this.leftSide = leftSide; - this.rightSide = rightSide; - this.program = program; - } - // ------------------------------------------------------------------------- // hashCode() and equals() // ------------------------------------------------------------------------- @@ -241,16 +233,6 @@ this.program = program; } - public Boolean getDateType() - { - return dateType; - } - - public void setDateType( Boolean dateType ) - { - this.dateType = dateType; - } - public Operator getOperator() { return operator; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java 2012-11-08 13:09:31 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java 2012-11-12 07:04:25 +0000 @@ -51,8 +51,6 @@ Collection getProgramValidation( Program program ); - Collection getProgramValidation( Program program, Boolean dateType ); - Collection getProgramValidation( ProgramStage programStage ); Collection getProgramValidation( ProgramStageDataElement psdataElement ); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationStore.java 2012-01-13 02:14:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationStore.java 2012-11-12 07:04:25 +0000 @@ -40,6 +40,4 @@ String ID = ProgramValidation.class.getName(); Collection get( Program program ); - - Collection get( Program program, Boolean dateType ); } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-11-08 16:07:27 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-11-12 07:04:25 +0000 @@ -150,6 +150,7 @@ executeSql( "ALTER TABLE programvalidation DROP COLUMN leftside" ); executeSql( "ALTER TABLE programvalidation DROP COLUMN rightside" ); + executeSql( "ALTER TABLE programvalidation DROP COLUMN dateType" ); } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java 2012-11-12 06:07:30 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java 2012-11-12 07:04:25 +0000 @@ -53,7 +53,7 @@ { private final String regExp = "\\[" + OBJECT_PROGRAM_STAGE_DATAELEMENT + SEPARATOR_OBJECT + "([a-zA-Z0-9\\- ]+[" + SEPARATOR_ID + "[0-9]*]*)" + "\\]"; - + private ProgramValidationStore validationStore; private ProgramStageService programStageService; @@ -123,26 +123,24 @@ public ProgramValidationResult validate( ProgramValidation validation, ProgramStageInstance programStageInstance, I18nFormat format ) { - if ( !validation.getDateType() ) + String leftSideValue = expressionService.getProgramExpressionValue( validation.getLeftSide(), + programStageInstance, format ); + String rightSideValue = expressionService.getProgramExpressionValue( validation.getRightSide(), + programStageInstance, format ); + String operator = validation.getOperator().getMathematicalOperator(); + + if ( (leftSideValue != null && rightSideValue.equals( NOT_NULL_VALUE_IN_EXPRESSION ) && rightSideValue == null) + || ((leftSideValue != null && rightSideValue != null && !((operator.equals( "==" ) && leftSideValue + .compareTo( rightSideValue ) == 0) + || (operator.equals( "<" ) && leftSideValue.compareTo( rightSideValue ) < 0) + || (operator.equals( "<=" ) && (leftSideValue.compareTo( rightSideValue ) <= 0)) + || (operator.equals( ">" ) && leftSideValue.compareTo( rightSideValue ) > 0) + || (operator.equals( ">=" ) && leftSideValue.compareTo( rightSideValue ) >= 0) || (operator + .equals( "!=" ) && leftSideValue.compareTo( rightSideValue ) == 0)))) ) { - String leftSideValue = expressionService.getProgramExpressionValue( validation.getLeftSide(), - programStageInstance, format ); - String rightSideValue = expressionService.getProgramExpressionValue( validation.getRightSide(), - programStageInstance, format ); - String operator = validation.getOperator().getMathematicalOperator(); - - if ( (leftSideValue != null && rightSideValue.equals( NOT_NULL_VALUE_IN_EXPRESSION ) && rightSideValue == null) - || ( (leftSideValue != null && rightSideValue != null - && !( (operator.equals( "==" ) && leftSideValue.compareTo( rightSideValue )==0 ) - || (operator.equals( "<" ) && leftSideValue.compareTo( rightSideValue ) < 0 ) - || (operator.equals( "<=" ) && (leftSideValue.compareTo( rightSideValue ) <= 0)) - || (operator.equals( ">" ) && leftSideValue.compareTo( rightSideValue ) > 0) - || (operator.equals( ">=" ) && leftSideValue.compareTo( rightSideValue ) >= 0) - || (operator.equals( "!=" ) && leftSideValue.compareTo( rightSideValue ) ==0 ) )))) - { - return new ProgramValidationResult( programStageInstance, validation, leftSideValue, rightSideValue ); - } + return new ProgramValidationResult( programStageInstance, validation, leftSideValue, rightSideValue ); } + return null; } @@ -151,11 +149,6 @@ return validationStore.get( program ); } - public Collection getProgramValidation( Program program, Boolean dateType ) - { - return validationStore.get( program, dateType ); - } - public Collection getProgramValidation( ProgramStageDataElement psdataElement ) { Collection programValidation = validationStore.get( psdataElement.getProgramStage() @@ -190,7 +183,8 @@ { ProgramValidation validation = iter.next(); - String expression = validation.getLeftSide().getExpression() + " " + validation.getRightSide().getExpression(); + String expression = validation.getLeftSide().getExpression() + " " + + validation.getRightSide().getExpression(); Matcher matcher = pattern.matcher( expression ); boolean flag = false; @@ -219,11 +213,11 @@ return programValidation; } - + // ------------------------------------------------------------------------- // Supportive methods // ------------------------------------------------------------------------- - + private Collection getDataElementInExpression( ProgramValidation programValidation ) { Collection dataElements = new HashSet(); === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramValidationStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramValidationStore.java 2012-01-13 02:14:28 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramValidationStore.java 2012-11-12 07:04:25 +0000 @@ -48,10 +48,4 @@ { return getCriteria( Restrictions.eq( "program", program ) ).list(); } - - @SuppressWarnings( "unchecked" ) - public Collection get( Program program, Boolean dateType ) - { - return getCriteria( Restrictions.eq( "program", program ), Restrictions.eq( "dateType", dateType ) ).list(); - } } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramValidation.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramValidation.hbm.xml 2012-11-08 16:07:27 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramValidation.hbm.xml 2012-11-12 07:04:25 +0000 @@ -27,7 +27,5 @@ - - === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddProgramValidationAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddProgramValidationAction.java 2012-11-08 16:07:27 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddProgramValidationAction.java 2012-11-12 07:04:25 +0000 @@ -107,13 +107,6 @@ this.rightSideDescription = rightSideDescription; } - private Boolean dateType; - - public void setDateType( Boolean dateType ) - { - this.dateType = dateType; - } - private Integer programId; public void setProgramId( Integer programId ) @@ -142,7 +135,6 @@ validation.setOperator( Operator.valueOf( operator ) ); validation.setLeftSide( leftExpression ); validation.setRightSide( rightExpression ); - validation.setDateType( dateType ); Program program = programService.getProgram( programId ); validation.setProgram( program ); === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetDateDataElementsAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetDateDataElementsAction.java 2012-02-11 13:58:02 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetDateDataElementsAction.java 1970-01-01 00:00:00 +0000 @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2004-2012, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.hisp.dhis.patient.action.validation; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.program.ProgramStageDataElement; -import org.hisp.dhis.program.ProgramStageService; -import org.hisp.dhis.program.ProgramValidation; -import org.hisp.dhis.program.ProgramValidationService; - -import com.opensymphony.xwork2.Action; - -/** - * @author Chau Thu Tran - * - * @version $GetDateDataElementsAction.java Jan 12, 2012 10:30:44 PM$ - */ -public class GetDateDataElementsAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private ProgramStageService programStageService; - - public void setProgramStageService( ProgramStageService programStageService ) - { - this.programStageService = programStageService; - } - - private ProgramValidationService programValidationService; - - public void setProgramValidationService( ProgramValidationService programValidationService ) - { - this.programValidationService = programValidationService; - } - - // ------------------------------------------------------------------------- - // Input & Output - // ------------------------------------------------------------------------- - - private Integer psId; - - public void setPsId( Integer psId ) - { - this.psId = psId; - } - - public Integer getPsId() - { - return psId; - } - - private List dataElementList = new ArrayList(); - - public List getDataElementList() - { - return dataElementList; - } - - private Map validationMap = new HashMap(); - - public Map getValidationMap() - { - return validationMap; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - { - Collection psDataElements = programStageService.getProgramStage( psId ).getProgramStageDataElements(); - - if ( psDataElements != null && !psDataElements.isEmpty() ) - { - Iterator iter = psDataElements.iterator(); - - while ( iter.hasNext() ) - { - ProgramStageDataElement psDe = iter.next(); - - DataElement de = psDe.getDataElement(); - - if ( de.getType().equals( DataElement.VALUE_TYPE_DATE ) ) - { - dataElementList.add( de ); - - Collection validation = programValidationService.getProgramValidation( psDe ); - - if( !validation.isEmpty() ) - { - validationMap.put( de.getId(), validation.iterator().next() ); - } - else - { - validationMap.put( de.getId(), null ); - } - } - } - } - - return SUCCESS; - } - -} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramValidationListAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramValidationListAction.java 2012-02-15 07:24:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramValidationListAction.java 2012-11-12 07:04:25 +0000 @@ -49,8 +49,18 @@ private ProgramValidationService programValidationService; + public void setProgramValidationService( ProgramValidationService programValidationService ) + { + this.programValidationService = programValidationService; + } + private ProgramService programService; + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + // ------------------------------------------------------------------------- // Input && Output // ------------------------------------------------------------------------- @@ -58,28 +68,18 @@ private Integer programId; private Collection validations; - + private Program program; - + // ------------------------------------------------------------------------- // Getter && Setter // ------------------------------------------------------------------------- - public void setProgramService( ProgramService programService ) - { - this.programService = programService; - } - public Collection getValidations() { return validations; } - public void setProgramValidationService( ProgramValidationService programValidationService ) - { - this.programValidationService = programValidationService; - } - public Program getProgram() { return program; @@ -94,14 +94,13 @@ // Implementation Action // ------------------------------------------------------------------------- - @Override public String execute() throws Exception { program = programService.getProgram( programId ); - validations = programValidationService.getProgramValidation( program, false ); + validations = programValidationService.getProgramValidation( program ); return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateProgramValidationAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateProgramValidationAction.java 2012-11-08 16:07:27 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateProgramValidationAction.java 2012-11-12 07:04:25 +0000 @@ -106,13 +106,6 @@ this.rightSideDescription = rightSideDescription; } - private Boolean dateType; - - public void setDateType( Boolean dateType ) - { - this.dateType = dateType; - } - private Program program; public Program getProgram() @@ -149,8 +142,7 @@ validation.setOperator( Operator.valueOf( operator ) ); validation.setLeftSide( leftExpression ); validation.setRightSide( rightExpression ); - validation.setDateType( dateType ); - + programValidationService.updateProgramValidation( validation ); return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2012-11-08 16:07:27 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2012-11-12 07:04:25 +0000 @@ -892,17 +892,6 @@ - - - - - - - === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2012-11-08 13:09:31 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2012-11-12 07:04:25 +0000 @@ -889,15 +889,6 @@ F_PROGRAM_VALIDATION - - /main.vm - /dhis-web-maintenance-patient/addMultiProgramValidationForm.vm - javascript/programValidation.js - style/basic.css - F_PROGRAM_VALIDATION - - /main.vm @@ -906,15 +897,7 @@ style/basic.css F_PROGRAM_VALIDATION - - - /main.vm - /dhis-web-maintenance-patient/addDateProgramValidationForm.vm - javascript/programValidation.js - F_PROGRAM_VALIDATION - - + @@ -965,28 +948,6 @@ plainTextError - - /content.vm - /dhis-web-maintenance-patient/dateProgramValidationForm.vm - - - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - F_PROGRAM_VALIDATION - - - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - F_PROGRAM_VALIDATION - - === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addDateProgramValidationForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addDateProgramValidationForm.vm 2012-10-30 03:46:59 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addDateProgramValidationForm.vm 1970-01-01 00:00:00 +0000 @@ -1,38 +0,0 @@ - -

$i18n.getString( "validation_for_date_data_elements" )

- -

$program.name

- -
- - - - - - - - - - - - - - - - - - -
- -
- -
- #parse( "dhis-web-commons/loader/loader.vm" ) -
- -
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addMultiProgramValidationForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addMultiProgramValidationForm.vm 2012-11-07 04:33:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addMultiProgramValidationForm.vm 1970-01-01 00:00:00 +0000 @@ -1,139 +0,0 @@ -

$i18n.getString( "add_multi_program_validation_rule" )

- -

$program.name

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$i18n.getString( "program_validation_rule_details" )
- -
- -
- - - -
- - - -
- -    - - - - - - - -    - - - -    - - - - - - - -    - -
-
- $i18n.getString("formula") * - -
-
-
- $i18n.getString("formula") * - -
-
-
- $i18n.getString( "description" ) -
-
-
-
- $i18n.getString( "description" ) -
-
-
 
- - -
- - === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addSingleProgramValidationForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addSingleProgramValidationForm.vm 2012-11-08 16:07:27 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addSingleProgramValidationForm.vm 2012-11-12 07:04:25 +0000 @@ -5,7 +5,6 @@ - @@ -24,7 +23,7 @@ - + === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm 2012-09-25 09:12:30 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm 1970-01-01 00:00:00 +0000 @@ -1,54 +0,0 @@ -
- @@ -39,13 +38,13 @@ - +
-#if( $dataElementList.size() > 0 ) - - - - - - - - - - - #set( $mark = false ) - #set( $index = 0 ) - #foreach( $dataElement in $dataElementList ) - #set( $id= '[DE:' + $psId + '.' + $dataElement.id + ']') - #set( $validationId= $id + '.validation' ) - #set( $index = $index + 1 ) - - - - - - #set ( $mark = !$mark) - #end -#else - - -#end -
$i18n.getString('#')$i18n.getString('data_element')$i18n.getString('condition')
$index$dataElement.name - -
$i18n.getString('no_date_data_element_in_selected_program_stage') -
\ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js 2012-11-08 16:07:27 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js 2012-11-12 07:04:25 +0000 @@ -43,7 +43,7 @@ } //------------------------------------------------------------------------------ -// Get DataElements of Program-Stage into left-side +// Load data-elements of each program-stage //------------------------------------------------------------------------------ function getLeftPrgramStageDataElements() @@ -64,10 +64,6 @@ }); } -//------------------------------------------------------------------------------ -// Get DataElements of Program-Stage into right-side -//------------------------------------------------------------------------------ - function getRightPrgramStageDataElements() { clearListById( 'rightSideDE' ); @@ -87,123 +83,6 @@ } -function getDateDataElements() -{ - hideById('dataElementValidation'); - showLoader(); - var programStageId = getFieldValue('programStage'); - - if( programStageId == '') - { - hideById('loaderDiv'); - hideById('dataElementValidation'); - return; - } - - $( '#dataElementValidation' ).load( "getDateDataElements.action", - { - psId:programStageId - },function( ) - { - hideById('loaderDiv'); - showById('dataElementValidation'); - }); -} - -function dateValidation( id, fieldId, dataElementName ) -{ - var expression = $("#" + fieldId + ' option:selected').val(); - var validationid = $("#" + fieldId ).attr('validationid'); - - if( expression != -5) - { - hideById( 'div' + fieldId ); - setFieldValue('days' + fieldId, '' ); - saveDateValidation( id, fieldId, dataElementName ); - } - else - { - byId( fieldId ).style.backgroundColor = COLOR_WHITE; - byId( 'days' + fieldId ).style.backgroundColor = COLOR_WHITE; - showById( 'div' + fieldId ); - } - -} - -function saveDateValidation( id, fieldId, dataElementName ) -{ - var expression = $("#" + fieldId + ' option:selected').val(); - if( expression == -5 ) - { - expression += "D" + getFieldValue( 'days' + fieldId ); - } - var validationid = $("#" + fieldId ).attr('validationid'); - - if( validationid == '' ) - { - var description = $('#programStage option:selected').text() + ' - ' + dataElementName; - jQuery.post( "addDateProgramValidation.action", { - description: description, - leftSide: id, - rightSide: expression, - programId: getFieldValue('programId'), - dateType: getFieldValue('dateType') - }, function( json ) - { - byId( fieldId ).style.backgroundColor = COLOR_GREEN; - byId( 'days' + fieldId ).style.backgroundColor = COLOR_GREEN; - $("#" + fieldId ).attr('validationid', json.message ); - }); - } - else - { - var rightSide = $("#" + fieldId + ' option:selected').val(); - if( rightSide == '') - { - jQuery.post( "removeProgramValidation.action", { - id:validationid - }, function( json ) - { - byId( fieldId ).style.backgroundColor = COLOR_GREEN; - byId( 'days' + fieldId ).style.backgroundColor = COLOR_GREEN; - $("#" + fieldId ).attr('validationid', '' ); - }); - } - else - { - var description = $('#programStage option:selected').text() + ' - ' + dataElementName; - jQuery.post( "updateDateProgramValidation.action", { - id:validationid, - description: description, - leftSide: id, - rightSide: expression, - programId: getFieldValue('programId') - }, function( json ) - { - byId( fieldId ).style.backgroundColor = COLOR_GREEN; - byId( 'days' + fieldId ).style.backgroundColor = COLOR_GREEN; - }); - } - } -} - -function parseRightSide( dataElementId, rightSide ) -{ - var index = rightSide.indexOf('D'); - if( index < 0 ) - { - $('#' + dataElementId ).val( rightSide ); - } - else - { - var selectorValue = rightSide.substr( 0,index ); - var daysValue = rightSide.substr( index + 1,rightSide.length); - $('#' + dataElementId).val(selectorValue); - $('#days' + dataElementId ).val(daysValue); - showById('div' + dataElementId ); - } -} - //------------------------------------------------------------------------------ // Show Left side form for designing //------------------------------------------------------------------------------ === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm 2012-11-08 16:19:13 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm 2012-11-12 07:04:25 +0000 @@ -34,12 +34,6 @@ - #foreach( $validation in $validations ) === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateMultiProgramValidationForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateMultiProgramValidationForm.vm 2012-11-07 04:33:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateMultiProgramValidationForm.vm 1970-01-01 00:00:00 +0000 @@ -1,142 +0,0 @@ -

$i18n.getString( "edit_program_validation_rule" )

- -

$validation.program.name

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$i18n.getString( "program_validation_rule_details" )
- -
- -
 
- - - -
- - - -
- -    - - - - - - - -    - - - -    - - - - - - - -    - -
-
- $i18n.getString("formula") * - -
-
-
- $i18n.getString("formula") * - -
-
-
- $i18n.getString( "description" ) -
$!leftDescription
-
-
-
- $i18n.getString( "description" ) -
$!rightDescription
-
-
 
- - -
- - \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateSingleProgramValidationForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateSingleProgramValidationForm.vm 2012-11-08 16:07:27 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateSingleProgramValidationForm.vm 2012-11-12 07:04:25 +0000 @@ -6,7 +6,6 @@ - @@ -41,13 +40,13 @@
- + - +