From 52a54ce1d0292238a54278ae573da0aace056f63 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 16 Nov 2009 13:40:23 +0000 Subject: [PATCH] Patch from Lebbeous Fogle-Weekley to add a sample long wait notice for holds git-svn-id: svn://svn.open-ils.org/ILS/trunk@14919 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../examples/action_trigger_filters.json.example | 8 +++ Open-ILS/examples/fm_IDL.xml | 2 +- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 66 ++++++++++++++++++++ .../upgrade/0084.data.hold_request.long_wait.sql | 70 ++++++++++++++++++++++ 5 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0084.data.hold_request.long_wait.sql diff --git a/Open-ILS/examples/action_trigger_filters.json.example b/Open-ILS/examples/action_trigger_filters.json.example index f9b9df8b5..d599d7bd4 100644 --- a/Open-ILS/examples/action_trigger_filters.json.example +++ b/Open-ILS/examples/action_trigger_filters.json.example @@ -18,5 +18,13 @@ "shelf_time": {"!=": null}, "cancel_time": null } + }, + "hold_request.long_wait" : { + "context_org": "pickup_lib", + "filter": { + "frozen": "f", + "cancel_time": null, + "capture_time": null + } } } diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 0f8dba6c5..f7baeb5c1 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4867,7 +4867,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 2d6755228..2475548f7 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 ('0083'); -- miker +INSERT INTO config.upgrade_log (version) VALUES ('0084'); -- 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 d4ec9cfae..a0752f0eb 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -2228,6 +2228,72 @@ INSERT INTO action_trigger.environment ( ( 7, 'pickup_lib.billing_address'), ( 7, 'usr'); +-- long wait hold request notifications + +INSERT INTO action_trigger.hook ( + key, + core_type, + description, + passive + ) VALUES ( + 'hold_request.long_wait', + 'ahr', + 'A patron has been waiting on a hold to be fulfilled for a long time.', + TRUE + ); + +INSERT INTO action_trigger.event_definition ( + id, + active, + owner, + name, + hook, + validator, + reactor, + delay, + delay_field, + group_field, + template + ) VALUES ( + 9, + FALSE, + 1, + 'Hold waiting for pickup for long time', + 'hold_request.long_wait', + 'NOOP_True', + 'SendEmail', + '6 MONTHS', + 'request_time', + 'usr', +$$ +[%- USE date -%] +[%- user = target.0.usr -%] +To: [%- params.recipient_email || user.email %] +From: [%- params.sender_email || default_sender %] +Subject: Long Wait Hold Notification + +Dear [% user.family_name %], [% user.first_given_name %] + +You requested hold(s) on the following item(s), but unfortunately +we have not been able to fulfill your request after a considerable +length of time. If you would still like to recieve these items, +no action is required. + +[% FOR hold IN target %] + Title: [% hold.bib_rec.bib_record.simple_record.title %] + Author: [% hold.bib_rec.bib_record.simple_record.author %] +[% END %] +$$ +); + +INSERT INTO action_trigger.environment (event_def, path) + VALUES + (9, 'pickup_lib'), + (9, 'usr'), + (9, 'bib_rec.bib_record.simple_record'); + + + 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 diff --git a/Open-ILS/src/sql/Pg/upgrade/0084.data.hold_request.long_wait.sql b/Open-ILS/src/sql/Pg/upgrade/0084.data.hold_request.long_wait.sql new file mode 100644 index 000000000..4abf7a0ce --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0084.data.hold_request.long_wait.sql @@ -0,0 +1,70 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0084'); -- senator + +INSERT INTO action_trigger.hook ( + key, + core_type, + description, + passive + ) VALUES ( + 'hold_request.long_wait', + 'ahr', + 'A patron has been waiting on a hold to be fulfilled for a long time.', + TRUE + ); + +INSERT INTO action_trigger.event_definition ( + id, + active, + owner, + name, + hook, + validator, + reactor, + delay, + delay_field, + group_field, + template + ) VALUES ( + 9, + FALSE, + 1, + 'Hold waiting for pickup for long time', + 'hold_request.long_wait', + 'NOOP_True', + 'SendEmail', + '6 MONTHS', + 'request_time', + 'usr', +$$ +[%- USE date -%] +[%- user = target.0.usr -%] +To: [%- params.recipient_email || user.email %] +From: [%- params.sender_email || default_sender %] +Subject: Long Wait Hold Notification + +Dear [% user.family_name %], [% user.first_given_name %] + +You requested hold(s) on the following item(s), but unfortunately +we have not been able to fulfill your request after a considerable +length of time. If you would still like to recieve these items, +no action is required. + +[% FOR hold IN target %] + Title: [% hold.bib_rec.bib_record.simple_record.title %] + Author: [% hold.bib_rec.bib_record.simple_record.author %] +[% END %] +$$ +); + +INSERT INTO action_trigger.environment ( + event_def, + path + ) VALUES + (9, 'pickup_lib'), + (9, 'usr'), + (9, 'bib_rec.bib_record.simple_record'); + + +COMMIT; -- 2.11.0