← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11185: Fix bug - When to open person dashboard, some identifiers and identifiers removed.

 

------------------------------------------------------------
revno: 11185
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-06-10 16:32:43 +0700
message:
  Fix bug - When to open person dashboard, some identifiers and identifiers removed.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.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/GetPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java	2013-06-10 04:48:07 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java	2013-06-10 09:32:43 +0000
@@ -154,6 +154,18 @@
     {
         relationshipTypes = relationshipTypeService.getAllRelationshipTypes();
         patient = patientService.getPatient( id );
+        
+        // Get system identifier
+        
+        for ( PatientIdentifier identifier : patient.getIdentifiers() )
+        {
+            if ( identifier.getIdentifierType() == null )
+            {
+                systemIdentifier = identifier.getIdentifier();
+                break;
+            }
+        }
+        
         healthWorkers = patient.getOrganisationUnit().getUsers();
         Program program = null;
 
@@ -289,15 +301,6 @@
                 }
             }
         }
-        // Get system identifier
-        for ( PatientIdentifier identifier : patient.getIdentifiers() )
-        {
-            if ( identifier.getIdentifierType() == null )
-            {
-                systemIdentifier = identifier.getIdentifier();
-                break;
-            }
-        }
 
         return SUCCESS;
 

=== 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-05-29 14:28:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java	2013-06-10 09:32:43 +0000
@@ -221,38 +221,36 @@
         // Get patient-attribute-values
         // ---------------------------------------------------------------------
 
-        attributeValues = patientAttributeValueService.getPatientAttributeValues( patient );
-        Iterator<PatientAttributeValue> iterAttribute = attributeValues.iterator();
-
+        Collection<PatientAttributeValue> _attributeValues = patientAttributeValueService.getPatientAttributeValues( patient );
+        attributeValues = new HashSet<PatientAttributeValue>();
+        
         for ( Program program : programs )
         {
             Collection<PatientAttribute> atttributes = program.getPatientAttributes();
-            while ( iterAttribute.hasNext() )
+            for ( PatientAttributeValue attributeValue : _attributeValues )
             {
-                PatientAttributeValue attributeValue = iterAttribute.next();
-                if ( !atttributes.contains( attributeValue.getPatientAttribute() ) )
+                if ( atttributes.contains( attributeValue.getPatientAttribute() ) )
                 {
-                    iterAttribute.remove();
+                    attributeValues.add( attributeValue );
                 }
             }
         }
-
+        
         // ---------------------------------------------------------------------
         // Get patient-identifiers
         // ---------------------------------------------------------------------
 
-        identifiers = patient.getIdentifiers();
-        Iterator<PatientIdentifier> iterIdentifier = identifiers.iterator();
+        Collection<PatientIdentifier> _identifiers = patient.getIdentifiers();
+        identifiers = new HashSet<PatientIdentifier>();
         
         for ( Program program : programs )
         {
             Collection<PatientIdentifierType> identifierTypes = program.getPatientIdentifierTypes();
-            while ( iterIdentifier.hasNext() )
+            for ( PatientIdentifier identifier : _identifiers )
             {
-                PatientIdentifier identifier = iterIdentifier.next();
                 if ( !identifierTypes.contains( identifier.getIdentifierType() ) )
                 {
-                    iterIdentifier.remove();
+                    identifiers.add(identifier);
                 }
             }
         }