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

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Nov 12 16:07:07 EST 2009


Author: erickson
Date: 2009-11-12 16:07:02 -0500 (Thu, 12 Nov 2009)
New Revision: 14885

Added:
   trunk/Open-ILS/src/sql/Pg/upgrade/0079.data.hold_request.shelf_expires_soon.sql
Modified:
   trunk/Open-ILS/examples/action_trigger_filters.json.example
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
Patch from Lebbeous Fogle-Weekley to add seed data for a sample hold-shelf-expire notice

Modified: trunk/Open-ILS/examples/action_trigger_filters.json.example
===================================================================
--- trunk/Open-ILS/examples/action_trigger_filters.json.example	2009-11-12 20:31:35 UTC (rev 14884)
+++ trunk/Open-ILS/examples/action_trigger_filters.json.example	2009-11-12 21:07:02 UTC (rev 14885)
@@ -1,5 +1,4 @@
 {
-
 "checkout.due" :
     { "context_org" : "circ_lib",
       "filter"      :
@@ -9,7 +8,15 @@
                       { "stop_fines"  : null }
                     ]
             }
+    },
+    "hold_request.shelf_expires_soon" : {
+        "context_org": "pickup_lib",
+        "filter": {
+            "shelf_expire_time": {"!=": null},
+            "capture_time": {"!=": null},
+            "current_copy": {"!=": null},
+            "shelf_time": {"!=": null},
+            "cancel_time": null
+        }
     }
-
 }
-

Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-11-12 20:31:35 UTC (rev 14884)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-11-12 21:07:02 UTC (rev 14885)
@@ -51,7 +51,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0078'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0079'); -- senator
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2009-11-12 20:31:35 UTC (rev 14884)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2009-11-12 21:07:02 UTC (rev 14885)
@@ -2113,12 +2113,77 @@
 
 $$);
 
+
+INSERT INTO action_trigger.hook (
+        key,
+        core_type,
+        description,
+        passive
+    ) VALUES (
+        'hold_request.shelf_expires_soon',
+        'ahr',
+        'A hold on the shelf will expire there soon.',
+        TRUE
+    );
+
 INSERT INTO action_trigger.environment (event_def, path) VALUES
     (5, 'current_copy.call_number.record.simple_record'),
     (5, 'usr'),
     (5, 'pickup_lib.billing_address');
 
 
+INSERT INTO action_trigger.event_definition (
+        id,
+        active,
+        owner,
+        name,
+        hook,
+        validator,
+        reactor,
+        delay,
+        delay_field,
+        group_field,
+        template
+    ) VALUES (
+        7,
+        FALSE,
+        1,
+        'Hold Expires from Shelf Soon',
+        'hold_request.shelf_expires_soon',
+        'HoldIsAvailable',
+        'SendEmail',
+        '- 1 DAY',
+        'shelf_expire_time',
+        'usr',
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Subject: Hold Available Notification
+
+Dear [% user.family_name %], [% user.first_given_name %]
+You requested holds on the following item(s), which are available for
+pickup, but these holds will soon expire.
+
+[% FOR hold IN target %]
+    [%- data = helpers.get_copy_bib_basics(hold.current_copy.id) -%]
+    Title: [% data.title %]
+    Author: [% data.author %]
+    Library: [% hold.pickup_lib.name %]
+[% END %]
+$$
+);
+
+
+INSERT INTO action_trigger.environment (
+        event_def,
+        path
+    ) VALUES
+    ( 7, 'current_copy'),
+    ( 7, 'pickup_lib.billing_address'),
+    ( 7, 'usr');
+
 SELECT SETVAL('action_trigger.event_definition_id_seq'::TEXT, 100);
 
 -- Org Unit Settings for configuring org unit weights and org unit max-loops for hold targeting
@@ -2195,6 +2260,8 @@
     'A hold is cancelled by the patron'
 );
 
+
+
 -- hold targeter skip me
 INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
     'circ.holds.target_skip_me',

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0079.data.hold_request.shelf_expires_soon.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0079.data.hold_request.shelf_expires_soon.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0079.data.hold_request.shelf_expires_soon.sql	2009-11-12 21:07:02 UTC (rev 14885)
@@ -0,0 +1,68 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0079'); -- senator
+
+INSERT INTO action_trigger.hook (
+        key,
+        core_type,
+        description,
+        passive
+    ) VALUES (
+        'hold_request.shelf_expires_soon',
+        'ahr',
+        'A hold on the shelf will expire there soon.',
+        TRUE
+    );
+
+INSERT INTO action_trigger.event_definition (
+        id,
+        active,
+        owner,
+        name,
+        hook,
+        validator,
+        reactor,
+        delay,
+        delay_field,
+        group_field,
+        template
+    ) VALUES (
+        7,
+        FALSE,
+        1,
+        'Hold Expires from Shelf Soon',
+        'hold_request.shelf_expires_soon',
+        'HoldIsAvailable',
+        'SendEmail',
+        '- 1 DAY',
+        'shelf_expire_time',
+        'usr',
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Subject: Hold Available Notification
+
+Dear [% user.family_name %], [% user.first_given_name %]
+You requested holds on the following item(s), which are available for
+pickup, but these holds will soon expire.
+
+[% FOR hold IN target %]
+    [%- data = helpers.get_copy_bib_basics(hold.current_copy.id) -%]
+    Title: [% data.title %]
+    Author: [% data.author %]
+    Library: [% hold.pickup_lib.name %]
+[% END %]
+$$
+    );
+
+INSERT INTO action_trigger.environment (
+        event_def,
+        path
+    ) VALUES
+    ( 7, 'current_copy'),
+    ( 7, 'pickup_lib.billing_address'),
+    ( 7, 'usr');
+
+COMMIT;



More information about the open-ils-commits mailing list