dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16217
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6112: Script update
------------------------------------------------------------
revno: 6112
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-02-26 19:28:52 +0100
message:
Script update
removed:
resources/sql/grouping.sql
added:
resources/sql/remove_invalid_coordinates.sql
modified:
resources/sql/div.sql
--
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 'resources/sql/div.sql'
--- resources/sql/div.sql 2012-01-28 10:30:44 +0000
+++ resources/sql/div.sql 2012-02-26 18:28:52 +0000
@@ -46,3 +46,14 @@
join categorycombos_optioncombos co using(categoryoptioncomboid)
join categorycombo cc using(categorycomboid)
order by categorycomboname, categoryoptioncomboname;
+
+-- Groups orgunits into groups based on the text match in the where clause for the orgunit group with the given id
+
+insert into orgunitgroupmembers(orgunitgroupid,organisationunitid)
+select 22755 as orgunitgroupid,ou.organisationunitid as organisationunitid from organisationunit ou
+where lower(name) like '%dispensary%'
+and not exists (
+select orgunitgroupid from orgunitgroupmembers om
+where ou.organisationunitid=om.organisationunitid
+and om.orgunitgroupid=22755);
+
=== removed file 'resources/sql/grouping.sql'
--- resources/sql/grouping.sql 2011-03-18 13:51:29 +0000
+++ resources/sql/grouping.sql 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
-
--- Groups orgunits into groups based on the text match in the where clause for the orgunit group with the given id
-
-insert into orgunitgroupmembers(orgunitgroupid,organisationunitid)
-select 22755 as orgunitgroupid,ou.organisationunitid as organisationunitid from organisationunit ou
-where lower(name) like '%dispensary%'
-and not exists (
-select orgunitgroupid from orgunitgroupmembers om
-where ou.organisationunitid=om.organisationunitid
-and om.orgunitgroupid=22755);
=== added file 'resources/sql/remove_invalid_coordinates.sql'
--- resources/sql/remove_invalid_coordinates.sql 1970-01-01 00:00:00 +0000
+++ resources/sql/remove_invalid_coordinates.sql 2012-02-26 18:28:52 +0000
@@ -0,0 +1,164 @@
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates not like '%[%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates not like '%.%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates like '%,0%' and ou.coordinates not like '%,0.%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates like '%,-0%' and ou.coordinates not like '%,-0.%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates like '%[0%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates not like '%,%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates not like '%]' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates like '%.%.%.%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates not like '%.%.%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates like '%[ 0%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates like '%, 0%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates like '%+%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates like '%E%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates like '%00.%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);
+
+update organisationunit ou set coordinates=NULL
+where
+ou.coordinates like '%i%' and
+
+ou.organisationunitid in (
+select ou.organisationunitid from organisationunit ou, _orgunitstructure oustr
+where
+oustr."level"=5 and
+ou.organisationunitid=oustr.organisationunitid
+);