dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21626
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10281: Limit to access programinstanecs of person by current login in patient-dashboard.
------------------------------------------------------------
revno: 10281
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-03-18 12:30:59 +0700
message:
Limit to access programinstanecs of person by current login in patient-dashboard.
modified:
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/resources/META-INF/dhis/beans.xml
--
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/PatientDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2013-03-09 05:42:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2013-03-18 05:30:59 +0000
@@ -44,8 +44,10 @@
import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
import org.hisp.dhis.period.CalendarPeriodType;
+import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.relationship.Relationship;
import org.hisp.dhis.relationship.RelationshipService;
import org.hisp.dhis.user.CurrentUserService;
@@ -76,6 +78,8 @@
private CurrentUserService currentUserService;
+ private ProgramService programService;
+
// -------------------------------------------------------------------------
// Input && Output
// -------------------------------------------------------------------------
@@ -107,11 +111,16 @@
this.patientAuditService = patientAuditService;
}
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
public Map<PatientAttribute, String> getAttributeMap()
{
return attributeMap;
}
-
+
public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
{
this.patientAttributeValueService = patientAttributeValueService;
@@ -207,19 +216,28 @@
Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient );
+ // ---------------------------------------------------------------------
+ // Get program enrollment
+ // ---------------------------------------------------------------------
+
+ Collection<Program> programs = programService.getProgramsByCurrentUser();
+
activeProgramInstances = new HashSet<ProgramInstance>();
completedProgramInstances = new HashSet<ProgramInstance>();
for ( ProgramInstance programInstance : programInstances )
{
- if ( programInstance.isCompleted() )
- {
- completedProgramInstances.add( programInstance );
- }
- else
- {
- activeProgramInstances.add( programInstance );
+ if ( programs.contains( programInstance.getProgram() ) )
+ {
+ if ( programInstance.isCompleted() )
+ {
+ completedProgramInstances.add( programInstance );
+ }
+ else
+ {
+ activeProgramInstances.add( programInstance );
+ }
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-03-15 14:43:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-03-18 05:30:59 +0000
@@ -1067,6 +1067,7 @@
<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
<property name="patientAuditService" ref="org.hisp.dhis.patient.PatientAuditService" />
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
</bean>
<bean