← Back to team overview

dhis2-devs team mailing list archive

UID issues when loading dataentry module or user management

 

Dear All,

You could have noted after upgrading DHIS2 from lower version to 2.24 or
so, the organisationunits may not load when opening data entry module or
user managerment so you can't attach any user to any orgunit.

We noted that the issue is brought about by a Token Error on uid. All the
orgunits with uid starting with a number will cause this to fail in dhis2
2.24 or so. To resolve, we managed to write an SQL query to update the uids
as below.

UPDATE organisationunit SET uid = (
 CASE
WHEN (substring(uid FROM 1 FOR 1)) = '0'
THEN 'o' || substring(uid FROM 2)
WHEN (substring(uid FROM 1 FOR 1)) = '1'
THEN 'a' || substring(uid FROM 2)
WHEN (substring(uid FROM 1 FOR 1)) = '2'
THEN 'b' || substring(uid FROM 2)
WHEN (substring(uid FROM 1 FOR 1)) = '3'
THEN 'c' || substring(uid FROM 2)
WHEN (substring(uid FROM 1 FOR 1)) = '4'
THEN 'd' || substring(uid FROM 2)
WHEN (substring(uid FROM 1 FOR 1)) = '5'
THEN 'e' || substring(uid FROM 2)
WHEN (substring(uid FROM 1 FOR 1)) = '6'
THEN 'f' || substring(uid FROM 2)
WHEN (substring(uid FROM 1 FOR 1)) = '7'
THEN 'g' || substring(uid FROM 2)
WHEN (substring(uid FROM 1 FOR 1)) = '8'
THEN 'h' || substring(uid FROM 2)
WHEN (substring(uid FROM 1 FOR 1)) = '9'
THEN 'i' || substring(uid FROM 2)
    ELSE
        uid
    END
  )
WHERE uid ~ '^[0-9]';

Replacing the starting number with a letter random.

Hope this helps

-- 

*You can do anything, but not everything.*

Follow ups