[open-ils-commits] r12138 - trunk/Open-ILS/src/sql/Pg (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Feb 10 15:46:12 EST 2009
Author: erickson
Date: 2009-02-10 15:46:08 -0500 (Tue, 10 Feb 2009)
New Revision: 12138
Modified:
trunk/Open-ILS/src/sql/Pg/999.functions.global.sql
Log:
handle case where an address is pending but replaces no other address
Modified: trunk/Open-ILS/src/sql/Pg/999.functions.global.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/999.functions.global.sql 2009-02-10 19:41:10 UTC (rev 12137)
+++ trunk/Open-ILS/src/sql/Pg/999.functions.global.sql 2009-02-10 20:46:08 UTC (rev 12138)
@@ -189,8 +189,10 @@
BEGIN
SELECT INTO old_id replaces FROM actor.usr_address where id = pending_id;
IF old_id IS NULL THEN
+ UPDATE actor.usr_address SET pending = 'f' WHERE id = pending_id;
RETURN NULL;
END IF;
+ -- address replaces an existing address
DELETE FROM actor.usr_address WHERE id = -old_id;
UPDATE actor.usr_address SET id = -id WHERE id = old_id;
UPDATE actor.usr_address SET replaces = NULL, id = old_id WHERE id = pending_id;
More information about the open-ils-commits
mailing list