← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2125: Fix bug: Delete dataentry form didn't work.

 

------------------------------------------------------------
revno: 2125
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-09-16 12:12:42 +0700
message:
  Fix bug: Delete dataentry form didn't work.
modified:
  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/resources/META-INF/dhis/beans.xml
  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/viewDataEntryForm.vm


--
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/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-04-12 21:23:33 +0000
+++ 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:12:42 +0000
@@ -27,8 +27,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.dataentryform.DataEntryForm;
-import org.hisp.dhis.dataentryform.DataEntryFormService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.i18n.I18n;
 
 import com.opensymphony.xwork2.Action;
@@ -44,11 +44,11 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private DataEntryFormService dataEntryFormService;
+    private DataSetService dataSetService;
 
-    public void setDataEntryFormService( DataEntryFormService dataEntryFormService )
+    public void setDataSetService( DataSetService dataSetService )
     {
-        this.dataEntryFormService = dataEntryFormService;
+        this.dataSetService = dataSetService;
     }
 
     // -------------------------------------------------------------------------
@@ -66,11 +66,11 @@
     // Getters & setters
     // -------------------------------------------------------------------------
 
-    private int dataEntryFormId;
+    private int dataSetId;
 
-    public void setDataEntryFormId( int dataEntryFormId )
+    public void setDataSetId( int dataSetId )
     {
-        this.dataEntryFormId = dataEntryFormId;
+        this.dataSetId = dataSetId;
     }
 
     private String message;
@@ -87,16 +87,18 @@
     public String execute()
         throws Exception
     {
-        DataEntryForm dataEntryForm = dataEntryFormService.getDataEntryForm( dataEntryFormId );
+        DataSet dataSet = dataSetService.getDataSet( dataSetId );
         
-        if ( dataEntryForm == null )
+        if ( dataSet == null )
         {
             message = i18n.getString( "unable_delete" );
-            
+
             return INPUT;
         }
-
-        dataEntryFormService.deleteDataEntryForm( dataEntryForm );
+        
+        dataSet.setDataEntryForm( null );
+        
+        dataSetService.updateDataSet( dataSet );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml	2010-09-14 09:03:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml	2010-09-16 05:12:42 +0000
@@ -354,8 +354,8 @@
 	<bean id="org.hisp.dhis.dataset.action.dataentryform.DelDataEntryFormAction"
 		class="org.hisp.dhis.dataset.action.dataentryform.DelDataEntryFormAction"
 		scope="prototype">
-		<property name="dataEntryFormService">
-			<ref bean="org.hisp.dhis.dataentryform.DataEntryFormService"/>
+		<property name="dataSetService">
+			<ref bean="org.hisp.dhis.dataset.DataSetService"/>
 		</property>
 	</bean>
 	

=== 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-07-27 03:51:10 +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 05:12:42 +0000
@@ -3,13 +3,13 @@
 // Delete DataEntryForm
 // -----------------------------------------------------------------------------
 
-function removeDataEntryForm( dataEntryFormId, dataEntryFormName )
+function removeDataEntryForm( dataSetIdField, dataEntryFormName )
 {
   var request = new Request();
   request.setResponseTypeXML( 'message' );
   request.setCallbackSuccess( removeDataEntryFormCompleted );
  
-  var requestString = 'delDataEntryForm.action?dataEntryFormId=' + dataEntryFormId;
+  var requestString = 'delDataEntryForm.action?dataSetId=' + dataSetIdField;
   var result = window.confirm( i18n_confirm_delete + '\n\n' + dataEntryFormName );
 
   if ( result )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm	2010-08-17 07:26:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm	2010-09-16 05:12:42 +0000
@@ -70,7 +70,7 @@
           <input type="button" name="cancel" value="$i18n.getString( "cancel" )" onclick="window.location.href='dataSet.action'">
         </td>
         <td id="cde_deletebuttoncell">
-          <input type="button" name="delete" value="$i18n.getString( "delete" )" onclick="removeDataEntryForm( $dataEntryForm.id, '$dataEntryForm.name' )" #if($status == "ADD") disabled #end>
+          <input type="button" name="delete" value="$i18n.getString( "delete" )" onclick="removeDataEntryForm( $dataSet.id, '$dataEntryForm.name' )" #if($status == "ADD") disabled #end>
         </td>
         </tr>
 		<tr><td><span id="message"></span></td></tr>