dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17873
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7290: Only show lastest event for anonymous program.
------------------------------------------------------------
revno: 7290
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-06-14 11:41:08 +0700
message:
Only show lastest event for anonymous program.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.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/caseentry/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2012-06-13 08:22:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2012-06-14 04:41:08 +0000
@@ -171,7 +171,7 @@
program = programStageInstance.getProgramStage().getProgram();
- if ( program.getType() == Program.SINGLE_EVENT_WITHOUT_REGISTRATION && programStageInstance.isCompleted() )
+ if ( !program.isRegistration() && programStageInstance.isCompleted() )
{
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java 2012-06-07 04:23:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java 2012-06-14 04:41:08 +0000
@@ -39,6 +39,7 @@
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramInstanceService;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
import org.hisp.dhis.program.comparator.ProgramStageInstanceDueDateComparator;
@@ -133,16 +134,16 @@
List<ProgramInstance> programInstances = new ArrayList<ProgramInstance>();
- if ( program.getType() == Program.SINGLE_EVENT_WITHOUT_REGISTRATION )
+ if ( program.isRegistration() )
+ {
+ programInstances = new ArrayList<ProgramInstance>( programInstanceService.getProgramInstances( patient,
+ program, false ) );
+ }
+ else
{
programInstances = new ArrayList<ProgramInstance>( programInstanceService.getProgramInstances( program,
false ) );
}
- else
- {
- programInstances = new ArrayList<ProgramInstance>( programInstanceService.getProgramInstances( patient,
- program, false ) );
- }
if ( programInstances != null && programInstances.size() > 0 )
{
@@ -152,11 +153,20 @@
if ( programInstance.getProgramStageInstances() != null )
{
- programStageInstances.addAll( programInstance.getProgramStageInstances() );
- Collections.sort( programStageInstances, new ProgramStageInstanceDueDateComparator() );
-
- statusMap = programStageInstanceService.statusProgramStageInstances( programInstance
- .getProgramStageInstances() );
+ if ( program.isRegistration() )
+ {
+ programStageInstances.addAll( programInstance.getProgramStageInstances() );
+ Collections.sort( programStageInstances, new ProgramStageInstanceDueDateComparator() );
+ statusMap = programStageInstanceService.statusProgramStageInstances( programInstance
+ .getProgramStageInstances() );
+ }
+ else
+ {
+ ProgramStage programStage = program.getProgramStages().iterator().next();
+ ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance(
+ programInstance, programStage );
+ programStageInstances.add( programStageInstance );
+ }
}
}