← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 19556
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-07-07 12:26:40 +0700
message:
  minor fix
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	2015-07-07 05:22:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2015-07-07 05:26:40 +0000
@@ -326,12 +326,16 @@
     {
         List<OrganisationUnit> ouParents = new ArrayList<>( organisationUnitStore.getByUid( parents ) );
         Set<String> ou = new HashSet<>();
-        User user = currentUserService.getCurrentUser();
 
-        if ( user != null && OrganisationUnitSelectionMode.ACCESSIBLE == ouMode )
+        if ( OrganisationUnitSelectionMode.ACCESSIBLE == ouMode )
         {
-            ouParents = new ArrayList<>( user.getDataViewOrganisationUnitsWithFallback() );
-            ouMode = OrganisationUnitSelectionMode.DESCENDANTS;
+            User user = currentUserService.getCurrentUser();
+
+            if ( user != null )
+            {
+                ouParents = new ArrayList<>( user.getDataViewOrganisationUnitsWithFallback() );
+                ouMode = OrganisationUnitSelectionMode.DESCENDANTS;
+            }
         }
 
         for ( OrganisationUnit organisationUnit : ouParents )