← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17699: Org units, adding roots in list of org units when selected to make it possible to edit/delete

 

------------------------------------------------------------
revno: 17699
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-12-15 11:57:23 +0100
message:
  Org units, adding roots in list of org units when selected to make it possible to edit/delete
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.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-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2014-11-26 13:15:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2014-12-15 10:57:23 +0000
@@ -784,6 +784,11 @@
         return false;
     }
 
+    public boolean isRoot()
+    {
+        return parent == null;
+    }
+    
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.java	2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.java	2014-12-15 10:57:23 +0000
@@ -108,6 +108,11 @@
         {
             for ( OrganisationUnit selectedUnit : selectedUnits )
             {
+                if ( selectedUnit.isRoot() )
+                {
+                    organisationUnits.add( selectedUnit ); // Add to list if root
+                }
+                
                 organisationUnits.addAll( selectedUnit.getChildren() );
             }
         }