[open-ils-commits] r14600 - in trunk/Open-ILS/src/sql/Pg: . upgrade (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Oct 26 09:57:40 EDT 2009


Author: erickson
Date: 2009-10-26 09:57:38 -0400 (Mon, 26 Oct 2009)
New Revision: 14600

Added:
   trunk/Open-ILS/src/sql/Pg/upgrade/0054.data.action-trigger-predue-and-delay-age.sql
Modified:
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
seed data for sample pre-due notice.  added delay age param (1 day) to sample overdue notice

Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-10-25 20:49:46 UTC (rev 14599)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-10-26 13:57:38 UTC (rev 14600)
@@ -51,7 +51,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0053'); -- miker
+INSERT INTO config.upgrade_log (version) VALUES ('0054'); -- berick
 
 
 CREATE TABLE config.bib_source (

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2009-10-25 20:49:46 UTC (rev 14599)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2009-10-26 13:57:38 UTC (rev 14600)
@@ -1914,8 +1914,10 @@
     (1, 'usr'),
     (1, 'billable_transaction.summary'),
     (1, 'circ_lib.billing_address');
-  
 
+INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
+    (1, 'max_delay_age', '"1 day"');
+
 -- Sample Mark Long-Overdue Item Lost --
 
 INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field) 
@@ -2312,3 +2314,38 @@
         'bool'
     );
 
+
+-- Sample Pre-due Notice --
+
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field, group_field, template) 
+    VALUES (6, 'f', 1, '3 Day Courtesy Notice', 'checkout.due', 'MaxPassiveDelayAge', 'SendEmail', '-3 days', 'due_date', 'usr', 
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Subject: Courtesy Notice
+
+Dear [% user.family_name %], [% user.first_given_name %]
+As a reminder, the following items are due in 3 days.
+
+[% FOR circ IN target %]
+    Title: [% circ.target_copy.call_number.record.simple_record.title %] 
+    Barcode: [% circ.target_copy.barcode %] 
+    Due: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
+    Item Cost: [% helpers.get_copy_price(circ.target_copy) %]
+    Library: [% circ.circ_lib.name %]
+    Library Phone: [% circ.circ_lib.phone %]
+[% END %]
+
+$$);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES 
+    (6, 'target_copy.call_number.record.simple_record'),
+    (6, 'usr'),
+    (6, 'circ_lib.billing_address');
+
+INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
+    (6, 'max_delay_age', '"1 day"');
+  
+

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0054.data.action-trigger-predue-and-delay-age.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0054.data.action-trigger-predue-and-delay-age.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0054.data.action-trigger-predue-and-delay-age.sql	2009-10-26 13:57:38 UTC (rev 14600)
@@ -0,0 +1,42 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0054');
+
+-- Sample Pre-due Notice --
+
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field, group_field, template) 
+    VALUES (6, 'f', 1, '3 Day Courtesy Notice', 'checkout.due', 'CircIsOpen', 'SendEmail', '-3 days', 'due_date', 'usr', 
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Subject: Courtesy Notice
+
+Dear [% user.family_name %], [% user.first_given_name %]
+As a reminder, the following items are due in 3 days.
+
+[% FOR circ IN target %]
+    Title: [% circ.target_copy.call_number.record.simple_record.title %] 
+    Barcode: [% circ.target_copy.barcode %] 
+    Due: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
+    Item Cost: [% helpers.get_copy_price(circ.target_copy) %]
+    Library: [% circ.circ_lib.name %]
+    Library Phone: [% circ.circ_lib.phone %]
+[% END %]
+
+$$);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES 
+    (6, 'target_copy.call_number.record.simple_record'),
+    (6, 'usr'),
+    (6, 'circ_lib.billing_address');
+
+INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
+    (6, 'max_delay_age', '"1 day"');
+
+-- also add the max delay age to the default overdue notice event def
+INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
+    (1, 'max_delay_age', '"1 day"');
+  
+COMMIT;



More information about the open-ils-commits mailing list