dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31654
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16164: Fixed bug - Don't allow to enroll a single event with registration one more time.
------------------------------------------------------------
revno: 16164
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-07-18 11:02:57 +0700
message:
Fixed bug - Don't allow to enroll a single event with registration one more time.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/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/trackedentity/ProgramEnrollmentSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentSelectAction.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentSelectAction.java 2014-07-18 04:02:57 +0000
@@ -126,20 +126,21 @@
Iterator<Program> iterProgram = programs.iterator();
while ( iterProgram.hasNext() )
{
- if ( iterProgram.next().getOnlyEnrollOnce() )
+ Program program = iterProgram.next();
+ for ( ProgramInstance programInstance : entityInstance.getProgramInstances() )
{
- iterProgram.remove();
+ if ( programInstance.getProgram().equals( program ) )
+ {
+ if (programInstance.getStatus() == ProgramInstance.STATUS_ACTIVE
+ || program.getOnlyEnrollOnce()
+ || ((programInstance.getStatus() == ProgramInstance.STATUS_COMPLETED && program.isSingleEvent() )))
+ {
+ iterProgram.remove();
+ }
+ }
}
}
- Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( entityInstance,
- ProgramInstance.STATUS_ACTIVE );
-
- for ( ProgramInstance programInstance : programInstances )
- {
- programs.remove( programInstance.getProgram() );
- }
-
return SUCCESS;
}
}