← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8108: Display relationship type next the the person name

 

------------------------------------------------------------
revno: 8108
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-09-17 11:35:16 +0700
message:
  Display relationship type next the the person name
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm


--
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-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java	2012-07-11 09:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java	2012-09-17 04:35:16 +0000
@@ -29,8 +29,10 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import org.hisp.dhis.light.utils.NamebasedUtils;
 import org.hisp.dhis.patient.Patient;
@@ -193,18 +195,18 @@
     
     //Use for add relationship
     
-    private List<Patient> relatedPeople;
+    private Map<String,Patient> relatedPeople;
 
-    public List<Patient> getRelatedPeople()
+    public Map<String, Patient> getRelatedPeople()
     {
         return relatedPeople;
     }
 
-    public void setRelatedPeople( List<Patient> relatedPeople )
+    public void setRelatedPeople( Map<String, Patient> relatedPeople )
     {
         this.relatedPeople = relatedPeople;
     }
-    
+
     private Collection<RelationshipType> relationshipTypes;
     
     public Collection<RelationshipType> getRelationshipTypes()
@@ -246,7 +248,7 @@
         throws Exception
     {
         programInstances.clear();
-        relatedPeople = new ArrayList<Patient>();
+        relatedPeople = new HashMap<String, Patient>();
 
         patient = patientService.getPatient( patientId );
         for ( ProgramInstance programInstance : programInstanceService.getProgramInstances( patient ) )
@@ -264,12 +266,12 @@
         {
             if ( relationship.getPatientA().getId() != patient.getId() )
             {
-                relatedPeople.add( relationship.getPatientA() );
+                relatedPeople.put( relationship.getRelationshipType().getName(), relationship.getPatientA() );
             }
 
             if ( relationship.getPatientB().getId() != patient.getId() )
             {
-                relatedPeople.add( relationship.getPatientB() );
+                relatedPeople.put( relationship.getRelationshipType().getName(), relationship.getPatientB() );
             }
         }
         

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm	2012-07-29 10:56:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/beneficiaryProgramList.vm	2012-09-17 04:35:16 +0000
@@ -77,9 +77,10 @@
 <p>
 	<ul>
         #if( $relatedPeople.size() > 0)
-            #foreach( $person in $relatedPeople )
-          			<li><a href="showPatientProgramList.action?patientId=$person.id">$!encoder.htmlEncode( ${person.getFullName()} )</a></li>
-          		#end
+            #foreach( $key in $relatedPeople.keySet() )
+				#set ( $person = $relatedPeople.get($key))
+          		<li><a href="showPatientProgramList.action?patientId=$person.id">$!encoder.htmlEncode( $person.fullName ) ($key)</a></li>
+          	#end
         #else
             <li>$i18n.getString("no_relationships")</li>
         #end