← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2653: Fix bug: Thrown exception while deleting PatientAttribute.

 

------------------------------------------------------------
revno: 2653
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-01-20 11:05:32 +0700
message:
  Fix bug: Thrown exception while deleting PatientAttribute.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueDeletionHandler.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties


--
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/patientattributevalue/PatientAttributeValueDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueDeletionHandler.java	2010-10-22 06:43:14 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueDeletionHandler.java	2011-01-20 04:05:32 +0000
@@ -31,6 +31,7 @@
 
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
 /**
@@ -52,11 +53,18 @@
         this.patientAttributeValueService = patientAttributeValueService;
     }
 
+    private PatientService patientService;
+
+    public void setPatientService( PatientService patientService ) {
+		this.patientService = patientService;
+	}
+    
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
 
-    @Override
+
+	@Override
     public String getClassName()
     {
         return PatientAttributeValue.class.getSimpleName();
@@ -83,7 +91,11 @@
         {
             for ( PatientAttributeValue attributeValue : attributeValues )
             {
+            	Patient patient = attributeValue.getPatient();
                 patientAttributeValueService.deletePatientAttributeValue( attributeValue );
+                
+                patient.getAttributes().remove(patientAttribute);
+                patientService.updatePatient( patient );
             }
         }
     }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2011-01-12 02:40:43 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2011-01-20 04:05:32 +0000
@@ -313,6 +313,7 @@
 	<bean id="org.hisp.dhis.patientattributevalue.PatientAttributeValueDeletionHandler" 
 		class="org.hisp.dhis.patientattributevalue.PatientAttributeValueDeletionHandler">
 		<property name="patientAttributeValueService" ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService"/>
+		<property name="patientService" ref="org.hisp.dhis.patient.PatientService"/>
 	</bean>
 	
 	<bean id="org.hisp.dhis.program.ProgramDeletionHandler" 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java	2011-01-19 11:13:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java	2011-01-20 04:05:32 +0000
@@ -37,7 +37,6 @@
 import org.apache.struts2.ServletActionContext;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.math.NumberUtils;
-import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2011-01-20 02:57:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2011-01-20 04:05:32 +0000
@@ -467,3 +467,4 @@
 search_result = Search result
 no_max_days_alowed_input_data = Maximum number of days allowed to input data
 no_min_days_alowed_input_data = Minimum number of days allowed to input data
+criteria_details = Criteria Details
\ No newline at end of file