=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2013-12-20 22:53:53 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2013-12-21 23:14:17 +0000 @@ -219,13 +219,9 @@ if ( !value.isEmpty() ) { // Compare property value with compare value -System.out.println("\n\n value : " + value ); -System.out.println("\n\n criteria.getValue() : " + criteria.getValue() ); -System.out.println("\n\n operator : " + value.compareTo( criteria.getValue() ) ); int i = value.compareTo( criteria.getValue() ); // Return validation criteria if criteria is not met - if ( i != criteria.getOperator() ) { return criteria; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddValidationCriteriaAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddValidationCriteriaAction.java 2013-12-20 22:53:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddValidationCriteriaAction.java 2013-12-21 23:14:17 +0000 @@ -28,6 +28,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.validation.ValidationCriteria; import org.hisp.dhis.validation.ValidationCriteriaService; @@ -46,6 +48,8 @@ private ValidationCriteriaService validationCriteriaService; + private ProgramService programService; + // ------------------------------------------------------------------------- // Input // ------------------------------------------------------------------------- @@ -60,6 +64,8 @@ private String value; + private int programId; + // ------------------------------------------------------------------------- // Setters // ------------------------------------------------------------------------- @@ -69,6 +75,21 @@ this.validationCriteriaService = validationCriteriaService; } + public void setProgramId( int programId ) + { + this.programId = programId; + } + + public int getProgramId() + { + return programId; + } + + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + public void setName( String name ) { this.name = name; @@ -112,6 +133,10 @@ validationCriteriaService.saveValidationCriteria( criteria ); + Program program = programService.getProgram( programId ); + program.getPatientValidationCriteria().add( criteria ); + programService.updateProgram( 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/GetValidationCriteriaAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetValidationCriteriaAction.java 2013-12-20 22:53:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetValidationCriteriaAction.java 2013-12-21 23:14:17 +0000 @@ -33,9 +33,9 @@ import java.util.List; import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; -import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.patient.PatientAttribute; -import org.hisp.dhis.patient.PatientAttributeService; +import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.validation.ValidationCriteria; import org.hisp.dhis.validation.ValidationCriteriaService; @@ -59,11 +59,11 @@ this.validationCriteriaService = validationCriteriaService; } - private PatientAttributeService patientAttributeService; + private ProgramService programService; - public void setPatientAttributeService( PatientAttributeService patientAttributeService ) + public void setProgramService( ProgramService programService ) { - this.patientAttributeService = patientAttributeService; + this.programService = programService; } // ------------------------------------------------------------------------- @@ -72,11 +72,13 @@ private int id; + private int programId; + private List patientAttributes = new ArrayList(); private ValidationCriteria validationCriteria; - private I18nFormat format; + private Program program; // ------------------------------------------------------------------------- // Getter && Setter @@ -87,14 +89,9 @@ this.id = id; } - public I18nFormat getFormat() - { - return format; - } - - public void setFormat( I18nFormat format ) - { - this.format = format; + public void setProgramId( int programId ) + { + this.programId = programId; } public ValidationCriteria getValidationCriteria() @@ -107,6 +104,11 @@ return patientAttributes; } + public Program getProgram() + { + return program; + } + // ------------------------------------------------------------------------- // Action Implementation // ------------------------------------------------------------------------- @@ -117,7 +119,9 @@ { validationCriteria = validationCriteriaService.getValidationCriteria( id ); - patientAttributes = new ArrayList( patientAttributeService.getAllPatientAttributes() ); + program = programService.getProgram( programId ); + + patientAttributes = new ArrayList( program.getPatientAttributes() ); Collections.sort( patientAttributes, IdentifiableObjectNameComparator.INSTANCE ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateValidationCriteriaAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateValidationCriteriaAction.java 2013-12-20 22:53:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateValidationCriteriaAction.java 2013-12-21 23:14:17 +0000 @@ -57,6 +57,8 @@ // Input // ------------------------------------------------------------------------- + private int programId; + private int id; private String name; @@ -78,6 +80,16 @@ this.name = name; } + public int getProgramId() + { + return programId; + } + + public void setProgramId( int programId ) + { + this.programId = programId; + } + public void setId( int id ) { this.id = id; === 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 2013-12-20 22:53:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2013-12-21 23:14:17 +0000 @@ -918,6 +918,9 @@ + + + - - + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-12-18 08:01:59 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-12-21 23:14:17 +0000 @@ -107,7 +107,6 @@ intro_relationship_type=Create, modify and view relationship types. A relationship is typically wife and husband or mother and child. intro_program=Create, modify and view programs. A program has program stages and defines which actions should be taken at each stage. intro_person_aggregation_query_builder=Set up aggregation rules for the process of aggregating person data to statistical data. -intro_validation_criteria=Create, modify and view validation criteria. A criteria is used for validation of person data. intro_schedule_automated_message_reminder=Set reminders to be automatically sent to enrolled persons before scheduled appointments and after missed visits. intro_program_attribute=Create, modify and view program attributes. A program can have any number of attributes. intro_configuration=Set the Excel XML template file used for automatically importing person data. @@ -482,4 +481,5 @@ select_at_least_one_scope=Select at least one scope for local id scheduling_of_events = Scheduling of events show_advanced_options = Show advanced options -tracker_associate = Tracker associate \ No newline at end of file +tracker_associate = Tracker associate +view_validation_criteria = View validation criteria \ No newline at end of file === 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 2013-12-20 22:53:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2013-12-21 23:14:17 +0000 @@ -917,14 +917,14 @@ + class="org.hisp.dhis.patient.action.program.GetProgramAction"> /main.vm /dhis-web-maintenance-patient/validationCriteria.vm /dhis-web-maintenance-patient/menu.vm javascript/validationcriteria.js - + /main.vm /dhis-web-maintenance-patient/addValidationCriteria.vm javascript/validationcriteria.js @@ -933,7 +933,7 @@ - validationCriteria.action + validationCriteria.action?id=${programId} F_VALIDATIONCRITERIA_ADD @@ -955,7 +955,7 @@ - validationCriteria.action + validationCriteria.action?id=${programId} F_VALIDATIONCRITERIA_ADD === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm 2013-12-20 22:53:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm 2013-12-21 23:14:17 +0000 @@ -4,7 +4,10 @@

$i18n.getString( "create_validation_criteria" )

+
$program.displayName
+
+ @@ -23,7 +26,7 @@
$i18n.getString('validation_criteria_details')
  - +
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm 2013-09-27 11:13:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm 2013-12-21 23:14:17 +0000 @@ -9,7 +9,6 @@ #introListImgItem( "patientRegistrationForm.action" "patient_registration_form" "pivottable" ) #introListImgItem( "program.action" "program" "program" ) #introListImgItem( "caseAggregation.action" "patient_aggregation_query_builder" "caseaggregationmapping" ) - #introListImgItem( "validationCriteria.action" "validation_criteria" "validationrule" ) #if( $auth.hasAccess( "dhis-web-maintenance-patient", "viewScheduleTasks" ) ) #introListImgItem( "viewScheduleTasks.action" "schedule_automated_message_reminder" "scheduling" ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2013-12-17 01:29:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2013-12-21 23:14:17 +0000 @@ -33,6 +33,10 @@ location.href = 'defineProgramAssociationsForm.action?id=' + context.id; } +function validationCriteria( context ) { + location.href = 'validationCriteria.action?id=' + context.id; +} + function showProgramDetails( context ) { jQuery.getJSON("getProgram.action", { id: context.id === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/validationcriteria.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/validationcriteria.js 2013-12-20 22:53:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/validationcriteria.js 2013-12-21 23:14:17 +0000 @@ -10,7 +10,7 @@ } function showUpdateValidationCriteriaForm( context ) { - location.href = 'showUpdateValidationCriteriaForm.action?id=' + context.id; + location.href = 'showUpdateValidationCriteriaForm.action?id=' + context.id + '&programId=' + getFieldValue('programId'); } // ----------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm 2013-09-27 11:13:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm 2013-12-21 23:14:17 +0000 @@ -12,7 +12,6 @@ #if( $auth.hasAccess( "dhis-web-maintenance-patient", "viewScheduleTasks" ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-12-17 01:29:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-12-21 23:14:17 +0000 @@ -8,6 +8,7 @@
  •   $i18n.getString( "assign_program_to_userroles" )
  •   $i18n.getString( "edit" )
  •   $i18n.getString( "view_program_stages" )
  • +
  •   $i18n.getString( "view_validation_criteria" )
  •   $i18n.getString( "program_validation_rule_management" )
  •   $i18n.getString( "program_indicator_management_form" )
  •   $i18n.getString( "sharing_settings" )
  • === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm 2013-12-20 22:53:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm 2013-12-21 23:14:17 +0000 @@ -1,10 +1,12 @@

    $i18n.getString( "edit_validation_criteria" )

    +
    $program.displayName
    + + - @@ -25,7 +27,7 @@ #else - + #end @@ -60,7 +62,7 @@
    $i18n.getString('validation_criteria_details')
      - +
    === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm 2013-12-17 01:29:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm 2013-12-21 23:14:17 +0000 @@ -1,4 +1,5 @@

    $i18n.getString( "validation_criteria_management" ) #openHelp( "validation_criteria" )

    +
    $program.displayName
      @@ -11,6 +12,7 @@
    + - #foreach($criteria in $criterias) + #foreach($criteria in $program.patientValidationCriteria)
    @@ -20,7 +22,8 @@
    - + +
    @@ -31,7 +34,7 @@