From 2f76aa0282bf2fb13a1ac297d14547f04db04f26 Mon Sep 17 00:00:00 2001 From: dbs Date: Fri, 1 Oct 2010 20:18:38 +0000 Subject: [PATCH] Set due times for durations measured in days to 23:59:59 after inserts OR updates The existing trigger acted only on the initial insert of a circulation transaction for duration intervals perfectly divisible by 24 hours. If updates to those due dates were subsequently issued, then the due time would revert to 00:00:00 - which could cause surprising overdue fines to be generated on the due date, rather than after the due date. This commit makes the trigger take effect on both INSERT and UPDATE to the action.circulation table. git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6@18129 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/090.schema.action.sql | 2 +- Open-ILS/src/sql/Pg/1.6.1-1.6.2-upgrade-db.sql | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 53c935e458..ba9a63520c 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -140,7 +140,7 @@ BEGIN END; $$ LANGUAGE PLPGSQL; -CREATE TRIGGER push_due_date_tgr BEFORE INSERT ON action.circulation FOR EACH ROW EXECUTE PROCEDURE action.push_circ_due_time(); +CREATE TRIGGER push_due_date_tgr BEFORE INSERT OR UPDATE ON action.circulation FOR EACH ROW EXECUTE PROCEDURE action.push_circ_due_time(); CREATE TABLE action.aged_circulation ( usr_post_code TEXT, diff --git a/Open-ILS/src/sql/Pg/1.6.1-1.6.2-upgrade-db.sql b/Open-ILS/src/sql/Pg/1.6.1-1.6.2-upgrade-db.sql index 9f87794d7d..510868f887 100644 --- a/Open-ILS/src/sql/Pg/1.6.1-1.6.2-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/1.6.1-1.6.2-upgrade-db.sql @@ -5,4 +5,8 @@ BEGIN; ALTER TABLE asset.copy_location ADD COLUMN label_prefix TEXT; ALTER TABLE asset.copy_location ADD COLUMN label_suffix TEXT; +-- Push due dates to 23:59:59 on insert OR update +DROP TRIGGER push_due_date_tgr ON action.circulation; +CREATE TRIGGER push_due_date_tgr BEFORE INSERT OR UPDATE ON action.circulation FOR EACH ROW EXECUTE PROCEDURE action.push_circ_due_time(); + COMMIT; -- 2.11.0