=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2012-10-18 07:29:10 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2012-10-19 07:08:17 +0000 @@ -30,6 +30,7 @@ import java.util.Collection; import java.util.Date; import java.util.HashSet; +import java.util.Iterator; import java.util.Set; import org.hisp.dhis.caseentry.state.SelectedStateManager; @@ -48,6 +49,7 @@ import org.hisp.dhis.relationship.Relationship; import org.hisp.dhis.relationship.RelationshipService; import org.hisp.dhis.user.CurrentUserService; +import org.hisp.dhis.validation.ValidationCriteria; import com.opensymphony.xwork2.Action; @@ -232,7 +234,18 @@ singlePrograms = programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit ); - singlePrograms.removeAll( patient.getPrograms() ); + singlePrograms.removeAll( patient.getPrograms() ); + Iterator iter = singlePrograms.iterator(); + while( iter.hasNext() ) + { + Program program = iter.next(); + ValidationCriteria criteria = program.isValid( patient ); + + if( criteria!= null) + { + iter.remove(); + } + } // --------------------------------------------------------------------- // Patient-Audit === 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 2012-10-19 06:27:45 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-10-19 07:08:17 +0000 @@ -1208,50 +1208,6 @@ } } -function saveEnrollment() -{ - var patientId = jQuery('#enrollmentDiv [id=patientId]').val(); - var programId = jQuery('#enrollmentDiv [id=programId] option:selected').val(); - var programName = jQuery('#enrollmentDiv [id=programId] option:selected').text(); - var dateOfIncident = jQuery('#enrollmentDiv [id=dateOfIncidentField]').val(); - var enrollmentDate = jQuery('#enrollmentDiv [id=enrollmentDateField]').val(); - - jQuery.postJSON( "saveProgramEnrollment.action", - { - patientId: patientId, - programId: programId, - dateOfIncident: dateOfIncident, - enrollmentDate: enrollmentDate - }, - function( json ) - { - var programInstanceId = json.programInstanceId; - var programStageInstanceId = json.activeProgramStageInstanceId; - var programStageName = json.activeProgramStageName; - var dueDate = json.dueDate; - var type = jQuery('#enrollmentDiv [id=programId] option:selected').attr('programType'); - - var activedRow = "" - + " " - + " " - + "" - + programName + " (" + enrollmentDate + ")" - + ""; - - activedRow += "" - + "• " + programStageName + " (" + dueDate + ")"; - - jQuery('#activeTB' ).prepend(activedRow); - jQuery('#enrollmentDiv').dialog("close"); - saveIdentifierAndAttribute( patientId, programId,'identifierAndAttributeDiv' ); - loadActiveProgramStageRecords( programInstanceId ); - showSuccessMessage(i18n_enrol_success); - }); -} - function saveSingleEnrollment(patientId, programId) { jQuery.postJSON( "saveProgramEnrollment.action", @@ -1317,6 +1273,50 @@ }); } +function saveEnrollment() +{ + var patientId = jQuery('#enrollmentDiv [id=patientId]').val(); + var programId = jQuery('#enrollmentDiv [id=programId] option:selected').val(); + var programName = jQuery('#enrollmentDiv [id=programId] option:selected').text(); + var dateOfIncident = jQuery('#enrollmentDiv [id=dateOfIncidentField]').val(); + var enrollmentDate = jQuery('#enrollmentDiv [id=enrollmentDateField]').val(); + + jQuery.postJSON( "saveProgramEnrollment.action", + { + patientId: patientId, + programId: programId, + dateOfIncident: dateOfIncident, + enrollmentDate: enrollmentDate + }, + function( json ) + { + var programInstanceId = json.programInstanceId; + var programStageInstanceId = json.activeProgramStageInstanceId; + var programStageName = json.activeProgramStageName; + var dueDate = json.dueDate; + var type = jQuery('#enrollmentDiv [id=programId] option:selected').attr('programType'); + + var activedRow = "" + + " " + + " " + + "" + + programName + " (" + enrollmentDate + ")" + + ""; + + activedRow += "" + + "• " + programStageName + " (" + dueDate + ")"; + + jQuery('#activeTB' ).prepend(activedRow); + jQuery('#enrollmentDiv').dialog("close"); + saveIdentifierAndAttribute( patientId, programId,'identifierAndAttributeDiv' ); + loadActiveProgramStageRecords( programInstanceId ); + showSuccessMessage(i18n_enrol_success); + }); +} + function unenrollmentForm( programInstanceId ) { $.ajax({