[open-ils-commits] r18127 - in branches/rel_2_0/Open-ILS/src/sql/Pg: . upgrade (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Oct 1 16:11:49 EDT 2010
Author: dbs
Date: 2010-10-01 16:11:43 -0400 (Fri, 01 Oct 2010)
New Revision: 18127
Added:
branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0424.schema.circ_due_date_trigger.sql
Modified:
branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql
branches/rel_2_0/Open-ILS/src/sql/Pg/090.schema.action.sql
branches/rel_2_0/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql
Log:
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.
Modified: branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-10-01 20:07:59 UTC (rev 18126)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-10-01 20:11:43 UTC (rev 18127)
@@ -70,7 +70,7 @@
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,
Modified: branches/rel_2_0/Open-ILS/src/sql/Pg/090.schema.action.sql
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/090.schema.action.sql 2010-10-01 20:07:59 UTC (rev 18126)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/090.schema.action.sql 2010-10-01 20:11:43 UTC (rev 18127)
@@ -164,7 +164,7 @@
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,
Modified: branches/rel_2_0/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql 2010-10-01 20:07:59 UTC (rev 18126)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql 2010-10-01 20:11:43 UTC (rev 18127)
@@ -18598,6 +18598,10 @@
ALTER TABLE action.hold_copy_map
ALTER COLUMN id SET DATA TYPE bigint;
+-- Make due times get pushed 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;
-- Some operations go outside of the transaction, because they may
Copied: branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0424.schema.circ_due_date_trigger.sql (from rev 18126, trunk/Open-ILS/src/sql/Pg/upgrade/0424.schema.circ_due_date_trigger.sql)
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0424.schema.circ_due_date_trigger.sql (rev 0)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0424.schema.circ_due_date_trigger.sql 2010-10-01 20:11:43 UTC (rev 18127)
@@ -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;
More information about the open-ils-commits
mailing list