← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8727: Remove active progran from Enrollment from.

 

------------------------------------------------------------
revno: 8727
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-10-26 12:09:48 +0700
message:
  Remove active progran from Enrollment from.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== 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<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, false );
+
+        for ( ProgramInstance programInstance : programInstances )
+        {
+            programs.remove( programInstance.getProgram() );
+        }
+        
         return SUCCESS;
     }
 }