]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0079.data.hold_request.shelf_expires_soon.sql
Allow combined search to be optional per class
[working/Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0079.data.hold_request.shelf_expires_soon.sql
1 BEGIN;
2
3 INSERT INTO config.upgrade_log (version) VALUES ('0079'); -- senator
4
5 INSERT INTO action_trigger.hook (
6         key,
7         core_type,
8         description,
9         passive
10     ) VALUES (
11         'hold_request.shelf_expires_soon',
12         'ahr',
13         'A hold on the shelf will expire there soon.',
14         TRUE
15     );
16
17 INSERT INTO action_trigger.event_definition (
18         id,
19         active,
20         owner,
21         name,
22         hook,
23         validator,
24         reactor,
25         delay,
26         delay_field,
27         group_field,
28         template
29     ) VALUES (
30         7,
31         FALSE,
32         1,
33         'Hold Expires from Shelf Soon',
34         'hold_request.shelf_expires_soon',
35         'HoldIsAvailable',
36         'SendEmail',
37         '- 1 DAY',
38         'shelf_expire_time',
39         'usr',
40 $$
41 [%- USE date -%]
42 [%- user = target.0.usr -%]
43 To: [%- params.recipient_email || user.email %]
44 From: [%- params.sender_email || default_sender %]
45 Subject: Hold Available Notification
46
47 Dear [% user.family_name %], [% user.first_given_name %]
48 You requested holds on the following item(s), which are available for
49 pickup, but these holds will soon expire.
50
51 [% FOR hold IN target %]
52     [%- data = helpers.get_copy_bib_basics(hold.current_copy.id) -%]
53     Title: [% data.title %]
54     Author: [% data.author %]
55     Library: [% hold.pickup_lib.name %]
56 [% END %]
57 $$
58     );
59
60 INSERT INTO action_trigger.environment (
61         event_def,
62         path
63     ) VALUES
64     ( 7, 'current_copy'),
65     ( 7, 'pickup_lib.billing_address'),
66     ( 7, 'usr');
67
68 COMMIT;