← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2127: Fix bug: Auto-save dataentryform function doesn't run.

 

------------------------------------------------------------
revno: 2127
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-09-16 13:18:57 +0700
message:
  Fix bug: Auto-save dataentryform function doesn't run.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.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-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java	2010-09-03 04:31:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java	2010-09-16 06:18:57 +0000
@@ -84,6 +84,13 @@
         this.designTextarea = designTextarea;
     }
 
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
     // -------------------------------------------------------------------------
     // Execute
     // -------------------------------------------------------------------------
@@ -97,10 +104,12 @@
 
         if ( dataEntryForm == null )
         {
-            dataEntryForm = new DataEntryForm( nameField, dataEntryFormService.prepareDataEntryFormCode( designTextarea ) );
-            dataEntryFormService.addDataEntryForm( dataEntryForm );
+            dataEntryForm = new DataEntryForm( nameField, dataEntryFormService
+                .prepareDataEntryFormCode( designTextarea ) );
+            int id = dataEntryFormService.addDataEntryForm( dataEntryForm );
+            message = id + "";
             
-            dataset.setDataEntryForm(dataEntryForm);
+            dataset.setDataEntryForm( dataEntryForm );
             dataSetService.updateDataSet( dataset );
         }
         else
@@ -108,6 +117,7 @@
             dataEntryForm.setName( nameField );
             dataEntryForm.setHtmlCode( dataEntryFormService.prepareDataEntryFormCode( designTextarea ) );
             dataEntryFormService.updateDataEntryForm( dataEntryForm );
+            message = dataEntryForm.getId() + "";
         }
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js	2010-09-16 05:35:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js	2010-09-16 06:18:57 +0000
@@ -66,7 +66,7 @@
   }        
 
   params += '&dataSetId=' + document.getElementById( 'dataSetIdField' ).value;
-    
+  
   request.sendAsPost( params );
   request.send( requestString );
 
@@ -189,7 +189,8 @@
 		function (xmlObject)
 			{
 				setMessage(i18n_save_success); 
-				stat == "ADD";
+				stat = "EDIT";
+				dataEntryFormId = xmlObject.firstChild.nodeValue;
 			} );
 	  
 	var params = 'nameField=' + getFieldValue('nameField');