]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0460.schema.recall.sql
LP#1661688: Add a link and other tweaks to alternate hold pickup feature
[working/Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0460.schema.recall.sql
1 BEGIN;
2
3 INSERT INTO config.upgrade_log (version) VALUES ('0460'); -- dbs
4
5 INSERT INTO config.org_unit_setting_type (name, label, description, datatype)
6     VALUES
7         ('circ.holds.recall_threshold',
8         oils_i18n_gettext( 'circ.holds.recall_threshold',
9             'Recalls: Circulation duration that triggers a recall.', 'coust', 'label'),
10         oils_i18n_gettext( 'circ.holds.recall_threshold',
11             'Recalls: A hold placed on an item with a circulation duration longer than this will trigger a recall. For example, "14 days" or "3 weeks".', 'coust', 'description'),
12         'interval')
13 ;
14
15 INSERT INTO config.org_unit_setting_type (name, label, description, datatype)
16     VALUES
17         ('circ.holds.recall_return_interval',
18         oils_i18n_gettext( 'circ.holds.recall_return_interval',
19             'Recalls: Truncated loan period.', 'coust', 'label'),
20         oils_i18n_gettext( 'circ.holds.recall_return_interval',
21             'Recalls: When a recall is triggered, this defines the adjusted loan period for the item. For example, "4 days" or "1 week".', 'coust', 'description'),
22         'interval')
23 ;
24
25 INSERT INTO config.org_unit_setting_type (name, label, description, datatype)
26     VALUES
27         ('circ.holds.recall_fine_rules',
28         oils_i18n_gettext( 'circ.holds.recall_fine_rules',
29             'Recalls: An array of fine amount, fine interval, and maximum fine.', 'coust', 'label'),
30         oils_i18n_gettext( 'circ.holds.recall_fine_rules',
31             'Recalls: An array of fine amount, fine interval, and maximum fine. For example, to specify a new fine rule of $5.00 per day, with a maximum fine of $50.00, use: [5.00,"1 day",50.00]', 'coust', 'description'),
32         'array')
33 ;
34
35 INSERT INTO action_trigger.hook (key,core_type,description)
36     VALUES ('circ.recall.target', 'circ', 'A checked-out copy has been recalled for a hold.');
37
38 INSERT INTO action_trigger.event_definition (id, owner, name, hook, validator, reactor, group_field, template)
39     VALUES (37, 1, 'Item Recall Email Notice', 'circ.recall.target', 'NOOP_True', 'SendEmail', '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: Item Recall Notification 
46
47 Dear [% user.family_name %], [% user.first_given_name %]
48
49 The following item which you have checked out has been recalled so that
50 another patron can have access to the item:
51
52 [% FOR circ IN target %]
53     Title: [% circ.target_copy.call_number.record.simple_record.title %] 
54     Barcode: [% circ.target_copy.barcode %] 
55     Now Due: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
56     Library: [% circ.circ_lib.name %]
57
58     If this item is not returned by the new due date, fines will be assessed at
59     the rate of [% circ.recurring_fine %] every [% circ.fine_interval %].
60 [% END %]
61 $$
62 );
63
64 INSERT INTO action_trigger.environment (event_def, path) VALUES
65     (37, 'target_copy.call_number.record.simple_record'),
66     (37, 'usr'),
67     (37, 'circ_lib.billing_address')
68 ;
69
70 COMMIT;