=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java 2012-10-09 03:53:11 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java 2012-10-26 05:09:48 +0000 @@ -116,10 +116,15 @@ patient = patientService.getPatient( id ); // Get all programs - programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION ); - // Except anonymous program - programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) ); - + programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION ); + + Collection programInstances = programInstanceService.getProgramInstances( patient, false ); + + for ( ProgramInstance programInstance : programInstances ) + { + programs.remove( programInstance.getProgram() ); + } + return SUCCESS; } }