[open-ils-commits] r14788 - branches/rel_1_6_0/Open-ILS/src/sql/Pg (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Nov 5 13:52:04 EST 2009
Author: miker
Date: 2009-11-05 13:52:01 -0500 (Thu, 05 Nov 2009)
New Revision: 14788
Modified:
branches/rel_1_6_0/Open-ILS/src/sql/Pg/090.schema.action.sql
Log:
forward-porting r-r14786:
Modified: branches/rel_1_6_0/Open-ILS/src/sql/Pg/090.schema.action.sql
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/sql/Pg/090.schema.action.sql 2009-11-05 18:32:26 UTC (rev 14787)
+++ branches/rel_1_6_0/Open-ILS/src/sql/Pg/090.schema.action.sql 2009-11-05 18:52:01 UTC (rev 14788)
@@ -130,7 +130,18 @@
CREATE TRIGGER mat_summary_change_tgr AFTER UPDATE ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_update ();
CREATE TRIGGER mat_summary_remove_tgr AFTER DELETE ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_delete ();
+CREATE OR REPLACE FUNCTION action.push_circ_due_time () RETURNS TRIGGER AS $$
+BEGIN
+ IF (EXTRACT(EPOCH FROM NEW.circ_duration)::INT % EXTRACT(EPOCH FROM '1 day'::INTERVAL)::INT) = 0 THEN
+ NEW.due_date = (NEW.due_date::DATE + '1 day'::INTERVAL - '1 second'::INTERVAL)::TIMESTAMPTZ;
+ END IF;
+ RETURN NEW;
+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 TABLE action.aged_circulation (
usr_post_code TEXT,
usr_home_ou INT NOT NULL,
More information about the open-ils-commits
mailing list