[open-ils-commits] r13605 - trunk/Open-ILS/src/sql/Pg (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jul 15 13:04:45 EDT 2009


Author: scottmk
Date: 2009-07-15 13:04:42 -0400 (Wed, 15 Jul 2009)
New Revision: 13605

Modified:
   trunk/Open-ILS/src/sql/Pg/999.functions.global.sql
Log:
In actor.usr_delete(): correct the mistreatment of the profile column.
It points to permission.grp_tree, not to actor.org_unit.


Modified: trunk/Open-ILS/src/sql/Pg/999.functions.global.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/999.functions.global.sql	2009-07-15 16:50:30 UTC (rev 13604)
+++ trunk/Open-ILS/src/sql/Pg/999.functions.global.sql	2009-07-15 17:04:42 UTC (rev 13605)
@@ -724,33 +724,28 @@
 	--
 	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 is null;
+	--
+	SELECT
+		id
+	INTO
+		new_home_ou
+	FROM
+		actor.org_unit_ancestors( old_home_ou )
+	WHERE
 		parent_ou 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;
-	--
 	-- Truncate date of birth
 	--
 	IF new_dob IS NOT NULL THEN



More information about the open-ils-commits mailing list