=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageInstanceVisitDateComparator.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageInstanceVisitDateComparator.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramStageInstanceVisitDateComparator.java 2013-03-05 13:55:46 +0000 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2004-2009, 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.program.comparator; + +import java.util.Comparator; +import java.util.Date; + +import org.hisp.dhis.program.ProgramStageInstance; + +/** + * @author Chau Thu Tran + * + * @version ProgramStageInstanceVisitDateComparator.java 8:24:02 PM Mar 5, 2013 + * $ + */ +public class ProgramStageInstanceVisitDateComparator + implements Comparator +{ + public int compare( ProgramStageInstance programStageInstance1, ProgramStageInstance programStageInstance2 ) + { + Date d1 = (programStageInstance1.getExecutionDate() != null ) ? programStageInstance1.getExecutionDate() : programStageInstance1.getDueDate(); + Date d2 = (programStageInstance2.getExecutionDate() != null ) ? programStageInstance2.getExecutionDate() : programStageInstance2.getDueDate(); + if ( d1.before( d2 ) ) + { + return -1; + } + else if ( d1.after( d2 ) ) + { + return 1; + } + return 0; + } +} \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2012-11-01 15:15:26 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2013-03-05 13:55:46 +0000 @@ -28,6 +28,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -46,6 +47,7 @@ import org.hisp.dhis.program.ProgramInstance; import org.hisp.dhis.program.ProgramInstanceService; import org.hisp.dhis.program.ProgramStageInstance; +import org.hisp.dhis.program.comparator.ProgramStageInstanceVisitDateComparator; import com.opensymphony.xwork2.Action; @@ -75,9 +77,7 @@ private Map identiferMap; - private ProgramInstance programInstance; - - private Collection programStageInstances = new ArrayList(); + private List programStageInstances = new ArrayList(); private List identifierTypes; @@ -134,7 +134,7 @@ { this.programInstanceService = programInstanceService; } - + public void setProgramInstanceId( Integer programInstanceId ) { this.programInstanceId = programInstanceId; @@ -145,12 +145,7 @@ return identifierTypes; } - public ProgramInstance getProgramInstance() - { - return programInstance; - } - - public Collection getProgramStageInstances() + public List getProgramStageInstances() { return programStageInstances; } @@ -178,7 +173,11 @@ // Load active ProgramInstance, completed = false // --------------------------------------------------------------------- - programInstance = programInstanceService.getProgramInstance( programInstanceId ); + ProgramInstance programInstance = programInstanceService.getProgramInstance( programInstanceId ); + + programStageInstances = new ArrayList(programInstance.getProgramStageInstances()); + + Collections.sort( programStageInstances, new ProgramStageInstanceVisitDateComparator() ); loadIdentifierTypes( programInstance ); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm 2013-03-05 07:29:03 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm 2013-03-05 13:55:46 +0000 @@ -144,5 +144,6 @@ var i18n_program_stage = '$encoder.jsEscape( $i18n.getString( "program_stage" ) , "'")'; var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")'; var i18n_main_form_link = '$encoder.jsEscape( $i18n.getString( "visit_schedule_form" ) , "'")'; + var i18n_insert_a_report_date = '$encoder.jsEscape( $i18n.getString( "insert_a_report_date" ) , "'")'; setDateRange(); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2013-03-05 05:09:03 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2013-03-05 13:55:46 +0000 @@ -178,6 +178,7 @@ var i18n_clear_filter = '$encoder.jsEscape( $i18n.getString( "clear_filter" ) , "'")'; var i18n_specify_a_date = '$encoder.jsEscape( $i18n.getString( "specify_a_date" ) , "'")'; var i18n_clear = '$encoder.jsEscape( $i18n.getString( "clear" ) , "'")'; + var i18n_insert_a_report_date = '$encoder.jsEscape( $i18n.getString( "insert_a_report_date" ) , "'")'; isAjax = true; contentDiv = ''; === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2013-03-05 09:01:39 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2013-03-05 13:55:46 +0000 @@ -680,12 +680,6 @@ { var field = byId( 'value_' + programStageInstanceId + '_date' ); var dateOfIncident = new Date( byId('dateOfIncident').value ); - - if(field.value==''){ - field.style.backgroundColor = '#FFCC00'; - alert( i18n_insert_a_due_date ); - return; - } var dueDate = new Date(field.value); if( dueDate < dateOfIncident ) @@ -878,7 +872,6 @@ jQuery('#tr2_' + programInstanceId).html(""); jQuery('#tr2_' + programInstanceId).attr("onClick", ""); - //hideById('entryForm'); hideById('executionDateTB'); hideById('inputCriteriaDiv'); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2013-03-05 08:35:37 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2013-03-05 13:55:46 +0000 @@ -278,8 +278,7 @@ $('#executionDate').change(function() { saveExecutionDate( getFieldValue('programId'), programStageInstanceId, byId('executionDate') ); }); - - + jQuery(".stage-object-selected").removeClass('stage-object-selected'); var selectedProgramStageInstance = jQuery( '#' + prefixId + programStageInstanceId ); selectedProgramStageInstance.addClass('stage-object-selected'); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm 2013-03-05 09:01:39 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm 2013-03-05 13:55:46 +0000 @@ -70,4 +70,5 @@ var i18n_list_all_patients = '$encoder.jsEscape( $i18n.getString( "list_all_patients" ), "'")'; var i18n_main_form_link = '$encoder.jsEscape( $i18n.getString( "multiple_individual_records_management" ), "'")'; var i18n_patient_details_and_history = '$encoder.jsEscape( $i18n.getString( "patient_details_and_history" ), "'")'; + var i18n_insert_a_report_date = '$encoder.jsEscape( $i18n.getString( "insert_a_report_date" ) , "'")'; === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2013-02-28 11:40:11 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm 2013-03-05 13:55:46 +0000 @@ -7,7 +7,10 @@
- #foreach( $programStageInstance in $programInstance.programStageInstances ) + #if( $programInstance) + #set( $programStageInstances = $programInstance.programStageInstances) + #end + #foreach( $programStageInstance in $programStageInstances )
#set($valueDate=$format.formatDate( $programStageInstance.dueDate )) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2013-03-05 08:35:37 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2013-03-05 13:55:46 +0000 @@ -154,7 +154,8 @@ var i18n_scheduled_in_futurei18n_scheduled_in_future = '$encoder.jsEscape( $i18n.getString( "scheduled_in_future" ) , "'")'; var i18n_send_message = '$encoder.jsEscape( $i18n.getString( "send_message" ) , "'")'; var i18n_patient_details_and_history = '$encoder.jsEscape( $i18n.getString( "patient_details_and_history" ), "'")'; - + var i18n_insert_a_report_date = '$encoder.jsEscape( $i18n.getString( "insert_a_report_date" ) , "'")'; + var checkedDuplicate = false; var registration = false; === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2013-03-04 09:38:55 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2013-03-05 13:55:46 +0000 @@ -90,4 +90,5 @@ var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")'; var i18n_date_is_greater_then_or_equals_due_date = '$encoder.jsEscape( $i18n.getString( "date_is_greater_then_or_equals_due_date" ) , "'")'; var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")'; + var i18n_insert_a_report_date = '$encoder.jsEscape( $i18n.getString( "insert_a_report_date" ) , "'")'; \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2013-03-02 15:09:06 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2013-03-05 13:55:46 +0000 @@ -97,6 +97,7 @@ var i18n_main_form_link = '$encoder.jsEscape( $i18n.getString( "patient_management" ) , "'")'; var i18n_comment_added = '$encoder.jsEscape( $i18n.getString( "comment_added" ) , "'")'; var i18n_update = '$encoder.jsEscape( $i18n.getString( "update" ) , "'")'; + var i18n_insert_a_report_date = '$encoder.jsEscape( $i18n.getString( "insert_a_report_date" ) , "'")'; var checkedDuplicate = false; // -1: no search anything === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2013-03-02 15:09:06 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2013-03-05 13:55:46 +0000 @@ -136,6 +136,7 @@ var i18n_main_form_link = '$encoder.jsEscape( $i18n.getString( "patient_management" ) , "'")'; var i18n_comment_added = '$encoder.jsEscape( $i18n.getString( "comment_added" ) , "'")'; var i18n_main_form_link = '$encoder.jsEscape( $i18n.getString( "single_event_with_registration" ) , "'")'; + var i18n_insert_a_report_date = '$encoder.jsEscape( $i18n.getString( "insert_a_report_date" ) , "'")'; datePickerValid( 'executionDateNewEvent', true ); \ No newline at end of file