LP#1410369: Seed A/T definitions for hold cancellation
authorMike Rylander <mrylander@gmail.com>
Wed, 18 Feb 2015 15:39:58 +0000 (10:39 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 20 Feb 2015 21:58:17 +0000 (16:58 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/YYYY.data.message-center.sql [new file with mode: 0644]

index 4eaa6e6..5abcaaf 100644 (file)
@@ -13839,6 +13839,98 @@ INSERT INTO action_trigger.environment (event_def, path) VALUES
     (50, 'circ_lib.billing_address'),
     (50, 'target_copy.location');
 
+
+-- Auto-cancelled, no target
+INSERT INTO action_trigger.event_definition (
+    id, active, owner, name, hook,
+    validator, reactor, delay, delay_field,
+    group_field, message_usr_path, message_library_path, message_title,
+    message_template
+) VALUES (
+    51, FALSE, 1, 'Hold Cancelled (No Target) User Message', 'hold_request.cancel.expire_no_target',
+    'HoldIsCancelled', 'NOOP_True', '30 minutes', 'cancel_time',
+    'usr', 'usr', 'usr.home_ou', 'Hold Request Cancelled',
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+The following holds were cancelled because no items were found to fullfil them.
+
+[% FOR hold IN target %]
+    Title: [% hold.bib_rec.bib_record.simple_record.title %]
+    Author: [% hold.bib_rec.bib_record.simple_record.author %]
+    Library: [% hold.pickup_lib.name %]
+    Request Date: [% date.format(helpers.format_date(hold.request_time), '%Y-%m-%d') %]
+[% END %]
+
+$$);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES
+    (51, 'usr'),
+    (51, 'pickup_lib'),
+    (51, 'bib_rec.bib_record.simple_record');
+
+
+-- Cancelled by staff
+INSERT INTO action_trigger.event_definition (
+    id, active, owner, name, hook,
+    validator, reactor, delay, delay_field,
+    group_field, message_usr_path, message_library_path, message_title,
+    message_template
+) VALUES (
+    52, FALSE, 1, 'Hold Cancelled (Staff) User Message', 'hold_request.cancel.staff',
+    'HoldIsCancelled', 'NOOP_True', '30 minutes', 'cancel_time',
+    'usr', 'usr', 'usr.home_ou', 'Hold Request Cancelled',
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+The following holds were cancelled by a staff member.
+
+[% FOR hold IN target %]
+    Title: [% hold.bib_rec.bib_record.simple_record.title %]
+    Author: [% hold.bib_rec.bib_record.simple_record.author %]
+    Library: [% hold.pickup_lib.name %]
+    Request Date: [% date.format(helpers.format_date(hold.request_time), '%Y-%m-%d') %]
+    Cancellation Note: [% hold.cancel_note %]
+[% END %]
+
+$$);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES
+    (52, 'usr'),
+    (52, 'pickup_lib'),
+    (52, 'bib_rec.bib_record.simple_record');
+
+
+-- Shelf expired
+INSERT INTO action_trigger.event_definition (
+    id, active, owner, name, hook,
+    validator, reactor, delay, delay_field,
+    group_field, message_usr_path, message_library_path, message_title,
+    message_template
+) VALUES (
+    53, TRUE, 1, 'Hold Cancelled (Shelf-expired) User Message', 'hold_request.cancel.expire_holds_shelf',
+    'HoldIsCancelled', 'NOOP_True', '30 minutes', 'cancel_time',
+    'usr', 'usr', 'usr.home_ou', 'Hold Request Cancelled',
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+The following holds were cancelled because they were never picked up.
+
+[% FOR hold IN target %]
+    Title: [% hold.bib_rec.bib_record.simple_record.title %]
+    Author: [% hold.bib_rec.bib_record.simple_record.author %]
+    Library: [% hold.pickup_lib.name %]
+    Request Date: [% date.format(helpers.format_date(hold.request_time), '%Y-%m-%d') %]
+    Pickup By: [% date.format(helpers.format_date(hold.shelf_expire_time), '%Y-%m-%d') %]
+[% END %]
+
+$$);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES
+    (53, 'usr'),
+    (53, 'pickup_lib'),
+    (53, 'bib_rec.bib_record.simple_record');
+
 -- OUS's for patron self-reg
 INSERT INTO config.org_unit_setting_type
     (name, grp, datatype, label, description)
@@ -14187,3 +14279,4 @@ INSERT INTO config.org_unit_setting_type
              'Void long overdue item processing fee when claims returned',
              'coust', 'description'),
          'bool');
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.data.message-center.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.data.message-center.sql
new file mode 100644 (file)
index 0000000..e6ddf4c
--- /dev/null
@@ -0,0 +1,95 @@
+BEGIN;
+
+-- Auto-cancelled, no target
+INSERT INTO action_trigger.event_definition (
+    id, active, owner, name, hook,
+    validator, reactor, delay, delay_field,
+    group_field, message_usr_path, message_library_path, message_title,
+    message_template
+) VALUES (
+    51, FALSE, 1, 'Hold Cancelled (No Target) User Message', 'hold_request.cancel.expire_no_target',
+    'HoldIsCancelled', 'NOOP_True', '30 minutes', 'cancel_time',
+    'usr', 'usr', 'usr.home_ou', 'Hold Request Cancelled',
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+The following holds were cancelled because no items were found to fullfil them.
+
+[% FOR hold IN target %]
+    Title: [% hold.bib_rec.bib_record.simple_record.title %]
+    Author: [% hold.bib_rec.bib_record.simple_record.author %]
+    Library: [% hold.pickup_lib.name %]
+    Request Date: [% date.format(helpers.format_date(hold.request_time), '%Y-%m-%d') %]
+[% END %]
+
+$$);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES
+    (51, 'usr'),
+    (51, 'pickup_lib'),
+    (51, 'bib_rec.bib_record.simple_record');
+
+
+-- Cancelled by staff
+INSERT INTO action_trigger.event_definition (
+    id, active, owner, name, hook,
+    validator, reactor, delay, delay_field,
+    group_field, message_usr_path, message_library_path, message_title,
+    message_template
+) VALUES (
+    52, FALSE, 1, 'Hold Cancelled (Staff) User Message', 'hold_request.cancel.staff',
+    'HoldIsCancelled', 'NOOP_True', '30 minutes', 'cancel_time',
+    'usr', 'usr', 'usr.home_ou', 'Hold Request Cancelled',
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+The following holds were cancelled by a staff member.
+
+[% FOR hold IN target %]
+    Title: [% hold.bib_rec.bib_record.simple_record.title %]
+    Author: [% hold.bib_rec.bib_record.simple_record.author %]
+    Library: [% hold.pickup_lib.name %]
+    Request Date: [% date.format(helpers.format_date(hold.request_time), '%Y-%m-%d') %]
+    Cancellation Note: [% hold.cancel_note %]
+[% END %]
+
+$$);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES
+    (52, 'usr'),
+    (52, 'pickup_lib'),
+    (52, 'bib_rec.bib_record.simple_record');
+
+
+-- Shelf expired
+INSERT INTO action_trigger.event_definition (
+    id, active, owner, name, hook,
+    validator, reactor, delay, delay_field,
+    group_field, message_usr_path, message_library_path, message_title,
+    message_template
+) VALUES (
+    53, TRUE, 1, 'Hold Cancelled (Shelf-Expired) User Message', 'hold_request.cancel.expire_holds_shelf',
+    'HoldIsCancelled', 'NOOP_True', '30 minutes', 'cancel_time',
+    'usr', 'usr', 'usr.home_ou', 'Hold Request Cancelled',
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+The following holds were cancelled because they were never picked up.
+
+[% FOR hold IN target %]
+    Title: [% hold.bib_rec.bib_record.simple_record.title %]
+    Author: [% hold.bib_rec.bib_record.simple_record.author %]
+    Library: [% hold.pickup_lib.name %]
+    Request Date: [% date.format(helpers.format_date(hold.request_time), '%Y-%m-%d') %]
+    Pickup By: [% date.format(helpers.format_date(hold.shelf_expire_time), '%Y-%m-%d') %]
+[% END %]
+
+$$);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES
+    (53, 'usr'),
+    (53, 'pickup_lib'),
+    (53, 'bib_rec.bib_record.simple_record');
+
+COMMIT;
+