← Back to team overview

dhis2-devs team mailing list archive

Re: UID issues when loading dataentry module or user management

 

Yes Alex.

I managed to do that using the PSQL query above. Thought some people could
be having the same problem and running that query can sort them out as fast
as possible.

Regards

On Fri, Oct 21, 2016 at 1:51 PM, Alex Tumwesigye <atumwesigye@xxxxxxxxx>
wrote:

> This was an issue in old versions. You need to replace all uids that begin
> with a number.
>
> Alex
>
>
> On Thursday, October 20, 2016, Ocaya Stephen <stephocay@xxxxxxxxx> wrote:
>
>> 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.*
>>
>>
>
> --
> Alex Tumwesigye
>
> Technical Advisor - DHIS2 (Consultant),
> Ministry of Health/AFENET  | HISP Uganda
> Kampala
> Uganda
> +256 774149 775, + 256 759 800161
> Skype ID: talexie
>
> IT Consultant (Servers, Networks and Security, Health Information Systems
> - DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant
>
>
> "I don't want to be anything other than what I have been - one tree hill "
>
>


-- 

*You can do anything, but not everything.*

References