handle case where an address is pending but replaces no other address
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 10 Feb 2009 20:46:08 +0000 (20:46 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 10 Feb 2009 20:46:08 +0000 (20:46 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12138 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index dd3514f..7fb7a0c 100644 (file)
@@ -189,8 +189,10 @@ DECLARE
 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;