← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10601: minor upload fix

 

------------------------------------------------------------
revno: 10601
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-04-17 18:03:44 +0700
message:
  minor upload fix
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/UploadAnonymousEventAction.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/caseentry/UploadAnonymousEventAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/UploadAnonymousEventAction.java	2013-04-17 08:45:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/UploadAnonymousEventAction.java	2013-04-17 11:03:44 +0000
@@ -190,19 +190,15 @@
 
         PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance, dataElement );
 
-        if ( patientDataValue == null && value != null )
-        {
-            patientDataValue = new PatientDataValue( programStageInstance, dataElement, new Date(), value );
-            patientDataValue.setStoredBy( storedBy );
-            patientDataValue.setProvidedElsewhere( providedElsewhere );
-
-            patientDataValueService.savePatientDataValue( patientDataValue );
-        }
-        else
-        {
-            if ( value == null )
+        if ( value != null )
+        {
+            if ( patientDataValue == null )
             {
-                patientDataValueService.deletePatientDataValue( patientDataValue );
+                patientDataValue = new PatientDataValue( programStageInstance, dataElement, new Date(), value );
+                patientDataValue.setStoredBy( storedBy );
+                patientDataValue.setProvidedElsewhere( providedElsewhere );
+
+                patientDataValueService.savePatientDataValue( patientDataValue );
             }
             else
             {
@@ -214,5 +210,9 @@
                 patientDataValueService.updatePatientDataValue( patientDataValue );
             }
         }
+        else if ( patientDataValue != null )
+        {
+            patientDataValueService.deletePatientDataValue( patientDataValue );
+        }
     }
 }