← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13541: Fixed test error

 

------------------------------------------------------------
revno: 13541
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-01-02 15:21:19 +0100
message:
  Fixed test error
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.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-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java	2014-01-02 13:45:23 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java	2014-01-02 14:21:19 +0000
@@ -123,14 +123,17 @@
                 patientCommentService.deletePatientComment( patientComment );
             }
 
-            for ( PatientAttribute patientAttribute : programInstance.getProgram().getPatientAttributes() )
-            {
-                PatientAttributeValue patientAttributeValue = patientAttributeValueService.getPatientAttributeValue(
-                    patient, patientAttribute );
-
-                if ( patientAttributeValue != null )
+            if ( programInstance.getProgram() != null && programInstance.getProgram().getPatientAttributes() != null )
+            {            
+                for ( PatientAttribute patientAttribute : programInstance.getProgram().getPatientAttributes() )
                 {
-                    patientAttributeValueService.deletePatientAttributeValue( patientAttributeValue );
+                    PatientAttributeValue patientAttributeValue = patientAttributeValueService.getPatientAttributeValue(
+                        patient, patientAttribute );
+    
+                    if ( patientAttributeValue != null )
+                    {
+                        patientAttributeValueService.deletePatientAttributeValue( patientAttributeValue );
+                    }
                 }
             }