← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4322: Fixed bug with complete registrations

 

------------------------------------------------------------
revno: 4322
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-08-16 20:38:22 +0200
message:
  Fixed bug with complete registrations
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.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/GetDataValuesForDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java	2011-08-13 13:55:24 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java	2011-08-16 18:38:22 +0000
@@ -199,7 +199,7 @@
         {
             CompleteDataSetRegistration registration = registrationService.getCompleteDataSetRegistration( dataSet, period, unit );
 
-            locked = registration != null;
+            complete = registration != null;
         }
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-08-16 15:08:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-08-16 18:38:22 +0000
@@ -591,8 +591,7 @@
         var periodId = $( '#selectedPeriodId' ).val();
         var dataSetId = $( '#selectedDataSetId' ).val();
 
-        $( '#completeButton' ).attr( 'disabled', 'disabled' );
-        $( '#undoButton' ).removeAttr( 'disabled' );
+        disableCompleteButton();
 
         $.getJSON( 'getValidationViolations.action', {
             periodId : periodId,
@@ -600,8 +599,7 @@
             organisationUnitId: currentOrganisationUnitId
         }, registerCompleteDataSet ).error( function()
         {
-            $( '#completeButton' ).removeAttr( 'disabled' );
-            $( '#undoButton' ).attr( 'disabled', 'disabled' );
+            disableUndoButton();
 
             window.alert( i18n_no_response_from_server );
         } );
@@ -623,14 +621,15 @@
         {
         } ).error( function()
         {
-            $( '#completeButton' ).removeAttr( 'disabled' );
-            $( '#undoButton' ).attr( 'disabled', 'disabled' );
+            disableUndoButton();
 
             window.alert( i18n_no_response_from_server );
         } );
     }
     else
     {
+    	disableUndoButton();
+    	
         validate();
     }
 }
@@ -644,8 +643,7 @@
         var periodId = $( '#selectedPeriodId' ).val();
         var dataSetId = $( '#selectedDataSetId' ).val();
 
-        $( '#completeButton' ).removeAttr( 'disabled' );
-        $( '#undoButton' ).attr( 'disabled', 'disabled' );
+        disableUndoButton();
 
         $.getJSON( 'undoCompleteDataSet.action', {
             periodId : periodId,
@@ -655,14 +653,25 @@
         {
         } ).error( function()
         {
-            $( '#completeButton' ).attr( 'disabled', 'disabled' );
-            $( '#undoButton' ).removeAttr( 'disabled' );
+            disableCompleteButton();
 
             window.alert( i18n_no_response_from_server );
         } );
     }
 }
 
+function disableUndoButton()
+{
+	$( '#completeButton' ).removeAttr( 'disabled' );
+    $( '#undoButton' ).attr( 'disabled', 'disabled' );
+}
+
+function disableCompleteButton()
+{
+	$( '#completeButton' ).attr( 'disabled', 'disabled' );
+    $( '#undoButton' ).removeAttr( 'disabled' );
+}
+
 // -----------------------------------------------------------------------------
 // Validation
 // -----------------------------------------------------------------------------