← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21937: Data value controller. Putting back null check for value. Fixes bug in data entry module where co...

 

------------------------------------------------------------
revno: 21937
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-02-10 17:39:06 +0100
message:
  Data value controller. Putting back null check for value. Fixes bug in data entry module where comments will clear out data values.
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueController.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-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueController.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueController.java	2016-02-10 16:39:06 +0000
@@ -267,7 +267,15 @@
                 fileResourceService.deleteFileResource( dataValue.getValue() );
             }
 
-            dataValue.setValue( StringUtils.trimToNull( value ) );
+            // -----------------------------------------------------------------
+            // Value and comment are sent individually, so null checks must be 
+            // made for each. Empty string is sent for clearing a value.
+            // -----------------------------------------------------------------
+            
+            if ( value != null )
+            {
+                dataValue.setValue( StringUtils.trimToNull( value ) );
+            }
 
             if ( comment != null )
             {