From: dbs Date: Fri, 1 Oct 2010 20:07:59 +0000 (+0000) Subject: Set due times for durations measured in days to 23:59:59 after inserts OR updates X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6e7f1503b9d72e658927974a034f9e1cbf56af18;p=contrib%2FConifer.git 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/trunk@18126 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index e4960f61bf..c864e8e774 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -70,7 +70,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0423'); -- miker +INSERT INTO config.upgrade_log (version) VALUES ('0424'); -- dbs CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 170f4626a4..fc86d8aeb8 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -164,7 +164,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/upgrade/0424.schema.circ_due_date_trigger.sql b/Open-ILS/src/sql/Pg/upgrade/0424.schema.circ_due_date_trigger.sql new file mode 100644 index 0000000000..6d2a8a095a --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0424.schema.circ_due_date_trigger.sql @@ -0,0 +1,9 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0424'); -- dbs + +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;