In actor.usr_delete(): correct the mistreatment of the profile column.
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Jul 2009 17:04:42 +0000 (17:04 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Jul 2009 17:04:42 +0000 (17:04 +0000)
It points to permission.grp_tree, not to actor.org_unit.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@13605 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/sql/Pg/999.functions.global.sql

index 4a39393..fd1937a 100644 (file)
@@ -724,32 +724,27 @@ BEGIN
        --
        perform actor.usr_purge_data( src_usr, dest_usr );
        --
-       -- Find the root org_unit(s).  This would be simpler if we could assume
-       -- that there is only one root.  Theoretically, someday, maybe, there
-       -- could be multiple roots, so we go to some extra trouble to get
-       -- the right ones.
+       -- Find the root grp_tree and the root org_unit.  This would be simpler if we 
+       -- could assume that there is only one root.  Theoretically, someday, maybe,
+       -- there could be multiple roots, so we take extra trouble to get the right ones.
        --
        SELECT
                id
        INTO
                new_profile
        FROM
-               actor.org_unit_ancestors( old_profile )
+               permission.grp_ancestors( old_profile )
        WHERE
-               parent_ou is null;
+               parent is null;
        --
-       IF old_home_ou = old_profile THEN
-               new_home_ou := new_profile;
-       ELSE
-               SELECT
-                       id
-               INTO
-                       new_home_ou
-               FROM
-                       actor.org_unit_ancestors( old_home_ou )
-               WHERE
-                       parent_ou is null;
-       END IF;
+       SELECT
+               id
+       INTO
+               new_home_ou
+       FROM
+               actor.org_unit_ancestors( old_home_ou )
+       WHERE
+               parent_ou is null;
        --
        -- Truncate date of birth
        --