4 CREATE TABLE action.batch_hold_event (
6 staff INT NOT NULL REFERENCES actor.usr (id) ON UPDATE CASCADE ON DELETE CASCADE,
7 bucket INT NOT NULL REFERENCES container.user_bucket (id) ON UPDATE CASCADE ON DELETE CASCADE,
9 hold_type TEXT NOT NULL DEFAULT 'T', -- maybe different hold types in the future...
10 run_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
11 cancelled TIMESTAMP WITH TIME ZONE
14 CREATE TABLE action.batch_hold_event_map (
15 id SERIAL PRIMARY KEY,
16 batch_hold_event INT NOT NULL REFERENCES action.batch_hold_event (id) ON UPDATE CASCADE ON DELETE CASCADE,
17 hold INT NOT NULL REFERENCES action.hold_request (id) ON UPDATE CASCADE ON DELETE CASCADE
20 INSERT INTO container.user_bucket_type (code,label) VALUES ('hold_subscription','Hold Group Container');
22 INSERT INTO config.org_unit_setting_type
23 (name, label, description, grp, datatype)
25 'holds.subscription.randomize',
27 'holds.subscription.randomize',
28 'Randomize group hold order',
33 'holds.subscription.randomize',
34 'When placing a batch group hold, randomize the order of the patrons receiving the holds so they are not always in the same order.',
42 -- Committer! Verify permission id before pushing!
43 INSERT INTO permission.perm_list (id,code,description)
44 VALUES ( 623, 'MANAGE_HOLD_GROUPS', oils_i18n_gettext(623, 'Manage hold groups and hold group events', 'ppl', 'description'));
46 INSERT INTO action.hold_request_cancel_cause (id,label)
47 VALUES ( 8, oils_i18n_gettext(8, 'Hold Group Event rollback', 'ahrcc', 'label'));
49 INSERT INTO action_trigger.event_definition (active, owner, name, hook, validator, reactor, delay, delay_field, group_field, cleanup_success, template)
50 VALUES ('f', 1, 'Hold Group Hold Placed for Patron Email Notification', 'hold_request.success', 'NOOP_True', 'SendEmail', '30 minutes', 'request_time', 'usr', 'CreateHoldNotification',
53 [%- user = target.0.usr -%]
54 To: [%- params.recipient_email || user.email %]
55 From: [%- params.sender_email || default_sender %]
56 Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
57 Subject: Subcription Hold placed for you
58 Auto-Submitted: auto-generated
60 Dear [% user.family_name %], [% user.first_given_name %]
61 The following items have been placed on hold for you:
63 [% FOR hold IN target %]
64 [%- copy_details = helpers.get_copy_bib_basics(hold.current_copy.id) -%]
65 Title: [% copy_details.title %]
66 Author: [% copy_details.author %]
67 Call Number: [% hold.current_copy.call_number.label %]
68 Barcode: [% hold.current_copy.barcode %]
69 Library: [% hold.pickup_lib.name %]
74 INSERT INTO action_trigger.environment (event_def, path ) VALUES
75 ( currval('action_trigger.event_definition_id_seq'), 'usr' ),
76 ( currval('action_trigger.event_definition_id_seq'), 'pickup_lib' ),
77 ( currval('action_trigger.event_definition_id_seq'), 'current_copy.call_number' );
80 INSERT INTO action_trigger.event_definition (
81 active, owner, name, hook, validator, reactor, cleanup_success,
82 delay, delay_field, group_field, template
84 false, 1, 'Hold Group Hold Placed for Patron SMS Notification', 'hold_request.success', 'NOOP_True',
85 'SendSMS', 'CreateHoldNotification', '00:30:00', 'shelf_time', 'sms_notify',
87 [%- user = target.0.usr -%]
88 From: [%- params.sender_email || default_sender %]
89 Date: [%- date.format(date.now, ''%a, %d %b %Y %T -0000'', gmt => 1) %]
90 To: [%- params.recipient_email || helpers.get_sms_gateway_email(target.0.sms_carrier,target.0.sms_notify) %]
91 Subject: [% target.size %] subscription hold(s) placed for you
92 Auto-Submitted: auto-generated
94 [% FOR hold IN target %][%-
95 bibxml = helpers.xml_doc( hold.current_copy.call_number.record.marc );
97 FOR part IN bibxml.findnodes(''//*[@tag="245"]/*[@code="a"]'');
98 title = title _ part.textContent;
100 author = bibxml.findnodes(''//*[@tag="100"]/*[@code="a"]'').textContent;
101 %][% hold.usr.first_given_name %]:[% title %] @ [% hold.pickup_lib.name %]
106 INSERT INTO action_trigger.environment (
110 currval('action_trigger.event_definition_id_seq'),
111 'current_copy.call_number.record.simple_record'
113 currval('action_trigger.event_definition_id_seq'),
116 currval('action_trigger.event_definition_id_seq'),
117 'pickup_lib.billing_address'
120 INSERT INTO action_trigger.event_params (event_def, param, value)
121 VALUES (currval('action_trigger.event_definition_id_seq'), 'check_sms_notify', 1);