dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17930
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7340: check if there is an active user before trying to add a ou to the user
------------------------------------------------------------
revno: 7340
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-06-21 08:55:38 +0300
message:
check if there is an active user before trying to add a ou to the user
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.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-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-20 19:39:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-06-21 05:55:38 +0000
@@ -98,11 +98,16 @@
{
int id = organisationUnitStore.save( organisationUnit );
- if(organisationUnit.getParent() == null)
+ if ( organisationUnit.getParent() == 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"
- currentUserService.getCurrentUser().getOrganisationUnits().add( organisationUnit );
+ User currentUser = currentUserService.getCurrentUser();
+
+ if ( currentUser != null )
+ {
+ currentUser.getOrganisationUnits().add( organisationUnit );
+ }
}
log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_ADD,
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2012-05-22 18:57:53 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2012-06-21 05:55:38 +0000
@@ -288,7 +288,7 @@
{
var roots = JSON.parse( localStorage[getTagId( "Roots" )] );
- if ( roots != selected )
+ if ( $.inArray(selected, roots) == -1 )
{
return;
}