← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7345: minor

 

------------------------------------------------------------
revno: 7345
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-06-21 13:34:24 +0300
message:
  minor
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.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-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2012-06-21 05:55:38 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2012-06-21 10:34:24 +0000
@@ -98,16 +98,11 @@
     {
         int id = organisationUnitStore.save( organisationUnit );
 
-        if ( organisationUnit.getParent() == null )
+        if ( organisationUnit.getParent() == null && currentUserService.getCurrentUser() != null )
         {
             // we are adding a new root node, add this node to the current user
             // this makes sense in most cases, and makes sure that we don't have "zombie nodes"
-            User currentUser = currentUserService.getCurrentUser();
-
-            if ( currentUser != null )
-            {
-                currentUser.getOrganisationUnits().add( organisationUnit );
-            }
+            currentUserService.getCurrentUser().getOrganisationUnits().add( organisationUnit );
         }
 
         log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_ADD,