← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14883: Allow approval controller state change accepted->unapproved

 

------------------------------------------------------------
revno: 14883
committer: Jim Grace <jimgrace@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-04-16 11:56:13 -0400
message:
  Allow approval controller state change accepted->unapproved
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataApprovalController.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.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-api/src/main/java/org/hisp/dhis/api/controller/DataApprovalController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataApprovalController.java	2014-04-07 04:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataApprovalController.java	2014-04-16 15:56:13 +0000
@@ -267,7 +267,10 @@
 
         DataApprovalPermissions permissions = dataApprovalService.getDataApprovalPermissions( dataSet, period, organisationUnit, categoryOptionGroups, null );
 
-        if ( !DataApprovalState.APPROVED_HERE.equals( permissions.getDataApprovalStatus().getDataApprovalState() ) )
+        DataApprovalState state = permissions.getDataApprovalStatus().getDataApprovalState();
+
+        if ( !DataApprovalState.APPROVED_HERE.equals( state )
+            && !DataApprovalState.ACCEPTED_HERE.equals(state ) )
         {
             ContextUtils.conflictResponse( response, "Data is not approved here and cannot be unapproved" );
             return;

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2014-04-11 11:58:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2014-04-16 15:56:13 +0000
@@ -154,12 +154,12 @@
 		    case "APPROVED_HERE":
 		        $( "#approvalNotification" ).html( i18n_approved );
 		        
-		        if (json.mayUnapprove)  {
+		        if ( json.mayUnapprove )  {
 		            $( "#approvalDiv" ).show();
 		            $( "#unapproveButton" ).show();
 		        }
 		        
-		        if (json.mayAccept)  {
+		        if ( json.mayAccept )  {
 		            $( "#approvalDiv" ).show();
 		            $( "#acceptButton" ).show();
 		        }
@@ -167,14 +167,14 @@
 		        break;
 		
 		    case "ACCEPTED_HERE":
-		        $( "#approvalNotification" ).html( i18n_approved );
+		        $( "#approvalNotification" ).html( i18n_approved_and_accepted );
 		        
 		        if ( json.mayUnapprove )  {
 		            $( "#approvalDiv" ).show();
 		            $( "#unapproveButton" ).show();
 		        }
 		        
-		        if (json.mayUnccept)  {
+		        if ( json.mayUnccept )  {
 		            $( "#approvalDiv" ).show();
 		            $( "#unacceptButton" ).show();
 		        }