[open-ils-commits] r13489 - trunk/Open-ILS/src/sql/Pg (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jun 30 09:06:21 EDT 2009
Author: scottmk
Date: 2009-06-30 09:06:20 -0400 (Tue, 30 Jun 2009)
New Revision: 13489
Modified:
trunk/Open-ILS/src/sql/Pg/999.functions.global.sql
Log:
In actor.usr_merge(): when transferring rows from vandelay.queue,
change the name in order to avoid collisions with existing rows
belonging to the destination user.
Modified: trunk/Open-ILS/src/sql/Pg/999.functions.global.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/999.functions.global.sql 2009-06-30 03:00:09 UTC (rev 13488)
+++ trunk/Open-ILS/src/sql/Pg/999.functions.global.sql 2009-06-30 13:06:20 UTC (rev 13489)
@@ -49,6 +49,7 @@
suffix TEXT;
bucket_row RECORD;
picklist_row RECORD;
+ queue_row RECORD;
BEGIN
-- do some initial cleanup
@@ -175,7 +176,25 @@
UPDATE container.user_bucket_item SET target_user = dest_usr WHERE target_user = src_usr;
-- vandelay.*
- PERFORM actor.usr_merge_rows('vandelay.queue', 'owner', src_usr, dest_usr);
+ -- transfer queues the same way we transfer buckets (see above)
+ FOR queue_row in
+ SELECT id, name
+ FROM vandelay.queue
+ WHERE owner = src_usr
+ LOOP
+ suffix := ' (' || src_usr || ')';
+ LOOP
+ BEGIN
+ UPDATE vandelay.queue
+ SET owner = dest_usr, name = name || suffix
+ WHERE id = queue_row.id;
+ EXCEPTION WHEN unique_violation THEN
+ suffix := suffix || ' ';
+ CONTINUE;
+ END;
+ EXIT;
+ END LOOP;
+ END LOOP;
-- money.*
PERFORM actor.usr_merge_rows('money.collections_tracker', 'usr', src_usr, dest_usr);
More information about the open-ils-commits
mailing list