[open-ils-commits] r11830 - trunk/Open-ILS/src/sql/Pg
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jan 14 17:03:01 EST 2009
Author: erickson
Date: 2009-01-14 17:02:56 -0500 (Wed, 14 Jan 2009)
New Revision: 11830
Modified:
trunk/Open-ILS/src/sql/Pg/999.functions.global.sql
Log:
return the new ID on success
Modified: trunk/Open-ILS/src/sql/Pg/999.functions.global.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/999.functions.global.sql 2009-01-14 21:49:46 UTC (rev 11829)
+++ trunk/Open-ILS/src/sql/Pg/999.functions.global.sql 2009-01-14 22:02:56 UTC (rev 11830)
@@ -167,18 +167,19 @@
-CREATE OR REPLACE FUNCTION actor.approve_pending_address(pending_id INT) RETURNS VOID AS $$
+CREATE OR REPLACE FUNCTION actor.approve_pending_address(pending_id INT) RETURNS BIGINT AS $$
DECLARE
old_id INT;
BEGIN
SELECT INTO old_id replaces FROM actor.usr_address where id = pending_id;
IF old_id IS NULL THEN
RAISE NOTICE 'Address % does not replace any address', pending_id;
- RETURN;
+ RETURN NULL;
END IF;
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;
+ RETURN old_id;
END
$$ LANGUAGE plpgsql;
More information about the open-ils-commits
mailing list