money.mat_bill_xact_sum anonymize user not delete user/ckolasinski/money_materialized_bill_xact_sum_delete_function_edit
authorCodey Kolasinski <ckolasinski@cwmars.org>
Mon, 25 Jan 2016 17:01:37 +0000 (12:01 -0500)
committerCodey Kolasinski <ckolasinski@cwmars.org>
Mon, 25 Jan 2016 17:01:37 +0000 (12:01 -0500)
During the circulation anonymization process, the
money.materialized_billable_xact_summary row for the circ is deleted.
This is problematic for reports which relies heavily on this table.
Rather than delete the row, the change will anonymize the user.

Signed-off-by: Codey Kolasinski <ckolasinski@cwmars.org>
Open-ILS/src/sql/Pg/080.schema.money.sql

index 3bba2ed..cf031bc 100644 (file)
@@ -289,7 +289,9 @@ $$ LANGUAGE PLPGSQL;
 /* AFTER trigger only! */
 CREATE OR REPLACE FUNCTION money.mat_summary_delete () RETURNS TRIGGER AS $$
 BEGIN
-       DELETE FROM money.materialized_billable_xact_summary WHERE id = OLD.id;
+       UPDATE money.materialized_billable_xact_summary SET usr=NULL WHERE id = OLD.id; 
+       /* DELETE FROM money.materialized_billable_xact_summary WHERE id = OLD.id; */
+
        RETURN OLD;
 END;
 $$ LANGUAGE PLPGSQL;