← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4461: Minor fix

 

------------------------------------------------------------
revno: 4461
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-08-26 23:27:24 +0200
message:
  Minor fix
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/java/org/hisp/dhis/dataset/action/dataentryform/DelDataEntryFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.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-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	2011-05-08 08:06:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java	2011-08-26 21:27:24 +0000
@@ -106,7 +106,7 @@
         {
             dataEntryForm = new DataEntryForm( nameField, dataEntryFormService.prepareDataEntryFormForSave( designTextarea ) );
             int id = dataEntryFormService.addDataEntryForm( dataEntryForm );
-            message = id + "";
+            message = String.valueOf( id );
             
             dataset.setDataEntryForm( dataEntryForm );
             dataSetService.updateDataSet( dataset );
@@ -116,7 +116,7 @@
             dataEntryForm.setName( nameField );
             dataEntryForm.setHtmlCode( dataEntryFormService.prepareDataEntryFormForSave( designTextarea ) );
             dataEntryFormService.updateDataEntryForm( dataEntryForm );
-            message = dataEntryForm.getId() + "";
+            message = String.valueOf( dataEntryForm.getId() );
         }
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/DelDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/DelDataEntryFormAction.java	2010-09-16 05:35:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/DelDataEntryFormAction.java	2011-08-26 21:27:24 +0000
@@ -115,6 +115,7 @@
         }
 
         dataSet.setDataEntryForm( null );
+        dataSet.increaseVersion();
         
         dataSetService.updateDataSet( dataSet );
         

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.java	2011-05-08 08:06:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.java	2011-08-26 21:27:24 +0000
@@ -93,15 +93,20 @@
     {
         DataSet dataset = dataSetService.getDataSet( dataSetIdField );
 
+        designTextarea = dataEntryFormService.prepareDataEntryFormForSave( designTextarea );
+        
         DataEntryForm dataEntryForm = dataset.getDataEntryForm();
 
+        if ( !( dataEntryForm != null && dataEntryForm.getHtmlCode().equals( designTextarea ) ) )
+        {
+            dataset.increaseVersion(); // Check if version must be updated
+        }
+        
         if ( dataEntryForm == null )
         {
             dataEntryForm = new DataEntryForm( nameField, dataEntryFormService.prepareDataEntryFormForSave( designTextarea ) );
             dataEntryFormService.addDataEntryForm( dataEntryForm );
-
             dataset.setDataEntryForm( dataEntryForm );
-            dataSetService.updateDataSet( dataset );
         }
         else
         {
@@ -109,6 +114,8 @@
             dataEntryForm.setHtmlCode( dataEntryFormService.prepareDataEntryFormForSave( designTextarea ) );
             dataEntryFormService.updateDataEntryForm( dataEntryForm );
         }
+        
+        dataSetService.updateDataSet( dataset );
 
         return SUCCESS;
     }