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>
/* 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;