From ae535e11a7c2322b821a92668ed27b88d2953089 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 12 Nov 2009 21:07:02 +0000 Subject: [PATCH] Patch from Lebbeous Fogle-Weekley to add seed data for a sample hold-shelf-expire notice git-svn-id: svn://svn.open-ils.org/ILS/trunk@14885 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../action_trigger_filters.json.example | 13 +++- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 67 ++++++++++++++++++ ...9.data.hold_request.shelf_expires_soon.sql | 68 +++++++++++++++++++ 4 files changed, 146 insertions(+), 4 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0079.data.hold_request.shelf_expires_soon.sql diff --git a/Open-ILS/examples/action_trigger_filters.json.example b/Open-ILS/examples/action_trigger_filters.json.example index 9f56d52b27..f9b9df8b50 100644 --- a/Open-ILS/examples/action_trigger_filters.json.example +++ b/Open-ILS/examples/action_trigger_filters.json.example @@ -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 + } } - } - diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 8d3a3b4cf1..8e18b2b46f 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log ( 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, diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index c4da7cf82b..579d2e07fe 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -2113,12 +2113,77 @@ The item(s) you requested are available for pickup from the Library. $$); + +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 @@ INSERT INTO action_trigger.hook (key,core_type,description) VALUES ( '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', diff --git a/Open-ILS/src/sql/Pg/upgrade/0079.data.hold_request.shelf_expires_soon.sql b/Open-ILS/src/sql/Pg/upgrade/0079.data.hold_request.shelf_expires_soon.sql new file mode 100644 index 0000000000..c45cea1391 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0079.data.hold_request.shelf_expires_soon.sql @@ -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; -- 2.43.2