← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17288: Approval. Get, hack for getting less info about approval level

 

------------------------------------------------------------
revno: 17288
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-10-26 00:06:04 +0200
message:
  Approval. Get, hack for getting less info about approval level
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.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-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java	2014-10-25 21:58:41 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java	2014-10-25 22:06:04 +0000
@@ -278,10 +278,18 @@
             
             DataApproval approval = status.getDataApproval();
             
+            Map<String, String> approvalLevel = new HashMap<>();
+            
+            if ( status.getDataApprovalLevel() != null )
+            {
+                approvalLevel.put( "id", status.getDataApprovalLevel().getUid() );
+                approvalLevel.put( "level", String.valueOf( status.getDataApprovalLevel().getLevel() ) );
+            }
+            
             if ( approval != null )
             {
                 item.put( "id", approval.getAttributeOptionCombo().getUid() );
-                item.put( "level", status.getDataApprovalLevel() );
+                item.put( "level", approvalLevel );
                 item.put( "ou",  approval.getOrganisationUnit().getUid() );
                 item.put( "accepted", approval.isAccepted() );
                 item.put( "permissions", status.getPermissions() );