← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4399: Fixed bug with comments

 

------------------------------------------------------------
revno: 4399
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-08-20 13:33:08 +0200
message:
  Fixed bug with comments
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveCommentAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js


--
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-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java	2011-08-20 11:10:50 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java	2011-08-20 11:33:08 +0000
@@ -156,7 +156,6 @@
 
         Period period = PeriodType.createPeriodExternalId( periodId );
         
-        System.out.println( "id " + organisationUnitId + ", dep " + organisationUnitService );
         OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
         
         chart = chartService.getJFreeChartHistory( dataElement, categoryOptionCombo, period, organisationUnit, HISTORY_LENGTH, format );

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveCommentAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveCommentAction.java	2011-07-20 21:38:30 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveCommentAction.java	2011-08-20 11:33:08 +0000
@@ -104,11 +104,11 @@
         this.periodId = periodId;
     }
 
-    private String comment;
+    private String commentValue;
 
-    public void setComment( String comment )
+    public void setCommentValue( String commentValue )
     {
-        this.comment = comment;
+        this.commentValue = commentValue;
     }
 
     private int dataElementId;
@@ -165,9 +165,9 @@
             storedBy = "[unknown]";
         }
 
-        if ( comment != null && comment.trim().equals( "" ) )
+        if ( commentValue != null && commentValue.isEmpty() )
         {
-            comment = null;
+            commentValue = null;
         }
 
         // ---------------------------------------------------------------------
@@ -178,21 +178,21 @@
 
         if ( dataValue == null )
         {
-            if ( comment != null )
+            if ( commentValue != null )
             {
-                LOG.debug( "Adding DataValue, comment added" );
+                LOG.info( "Adding DataValue, comment added " + commentValue );
 
-                dataValue = new DataValue( dataElement, period, organisationUnit, null, storedBy, new Date(), comment,
-                    optionCombo );
+                dataValue = new DataValue( dataElement, period, organisationUnit, null, 
+                    storedBy, new Date(), commentValue, optionCombo );
 
                 dataValueService.addDataValue( dataValue );
             }
         }
         else
         {
-            LOG.debug( "Updating DataValue, comment added/changed" );
+            LOG.info( "Updating DataValue, comment added/changed " + commentValue );
 
-            dataValue.setComment( comment );
+            dataValue.setComment( commentValue );
             dataValue.setTimestamp( new Date() );
             dataValue.setStoredBy( storedBy );
 

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js	2011-08-20 11:10:50 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js	2011-08-20 11:33:08 +0000
@@ -13,13 +13,13 @@
     commentSaver.save();
 }
 
-function CommentSaver( dataElementId_, optionComboId_, organisationUnitId_, periodId_, value_ )
+function CommentSaver( dataElementId_, optionComboId_, organisationUnitId_, periodId_, commentValue_ )
 {
     var dataElementId = dataElementId_;
     var optionComboId = optionComboId_;
     var organisationUnitId = organisationUnitId_;
     var periodId = periodId_;
-    var value = value_;
+    var commentValue = commentValue_;
 
     this.save = function()
     {
@@ -33,7 +33,7 @@
             	dataElementId: dataElementId,
             	optionComboId: optionComboId,
             	periodId: periodId,
-            	value: value
+            	commentValue: commentValue
             },
             dataType: 'json',
             cache: false,