3 INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1235', :eg_version);
5 CREATE TABLE action.curbside (
7 patron INT NOT NULL REFERENCES actor.usr (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
8 org INT NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
11 stage_staff INT REFERENCES actor.usr (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
13 delivered TIMESTAMPTZ,
14 delivery_staff INT REFERENCES actor.usr (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
18 INSERT INTO config.org_unit_setting_type (name, label, grp, description, datatype)
21 'Enable curbside pickup functionality at library.',
23 'When set to TRUE, enable staff and public interfaces to schedule curbside pickup of holds that become available for pickup.',
27 INSERT INTO config.org_unit_setting_type (name, label, grp, description, datatype)
29 'circ.curbside.granularity',
30 'Time interval between curbside appointments',
32 'Time interval between curbside appointments',
36 INSERT INTO config.org_unit_setting_type (name, label, grp, description, datatype)
38 'circ.curbside.max_concurrent',
39 'Maximum number of patrons that may select a particular curbside pickup time',
41 'Maximum number of patrons that may select a particular curbside pickup time',
45 INSERT INTO config.org_unit_setting_type (name, label, grp, description, datatype)
47 'circ.curbside.disable_patron_input',
48 'Disable patron modification of curbside appointments in public catalog',
50 'When set to TRUE, patrons cannot use the My Account interface to select curbside pickup times',
54 INSERT INTO actor.org_unit_setting (org_unit, name, value)
55 SELECT id, 'circ.curbside', 'false' FROM actor.org_unit WHERE parent_ou IS NULL
57 SELECT id, 'circ.curbside.max_concurrent', '10' FROM actor.org_unit WHERE parent_ou IS NULL
59 SELECT id, 'circ.curbside.granularity', '"15 minutes"' FROM actor.org_unit WHERE parent_ou IS NULL
62 INSERT INTO action_trigger.hook (key, core_type, description, passive)
64 'hold.offer_curbside',
67 'hold.offer_curbside',
68 'Hook used to trigger the notification of an offer of curbside pickup',
75 INSERT INTO action_trigger.hook (key, core_type, description, passive)
77 'hold.confirm_curbside',
80 'hold.confirm_curbside',
81 'Hook used to trigger the notification of the creation or update of a curbside pickup appointment with an arrival URL',
88 INSERT INTO action_trigger.reactor (module, description) VALUES (
89 'CurbsideSlot', 'Create a curbside pickup appointment slot when necessary'
92 INSERT INTO action_trigger.validator (module, description) VALUES (
93 'Curbside', 'Confirm that curbside pickup is enabled for the hold pickup library'
96 ------------------- Disabled example A/T defintions ------------------------------
98 -- Create a "dummy" slot when applicable, and trigger the "offer curbside" events
99 INSERT INTO action_trigger.event_definition (
110 'Trigger curbside offer events and create a placeholder for the patron, where applicable',
118 INSERT INTO action_trigger.event_definition (
132 'Curbside offer Email notification, triggered by CurbsideSlot reactor on a definition attached to the hold.available hook',
133 'hold.offer_curbside',
141 [%- user = target.0.usr -%]
142 To: [%- params.recipient_email || user.email %]
143 From: [%- params.sender_email || default_sender %]
144 Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
145 Subject: Curbside Pickup
146 Auto-Submitted: auto-generated
148 [% target.0.pickup_lib.name %] is now offering curbside delivery
149 service. Please call [% target.0.pickup_lib.phone %] or visit the
150 link below to schedule a pickup time.
152 https://example.org/eg/opac/myopac/holds_curbside
154 Stay safe! Wash your hands!
157 INSERT INTO action_trigger.environment (
161 currval('action_trigger.event_definition_id_seq'),
164 currval('action_trigger.event_definition_id_seq'),
168 INSERT INTO action_trigger.event_params (event_def, param, value)
169 VALUES (currval('action_trigger.event_definition_id_seq'), 'check_email_notify', 1);
172 INSERT INTO action_trigger.event_definition (
186 'Curbside offer SMS notification, triggered by CurbsideSlot reactor on a definition attached to the hold.available hook',
187 'hold.offer_curbside',
194 [%- user = target.0.usr -%]
195 From: [%- params.sender_email || default_sender %]
196 Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
197 To: [%- params.recipient_email || helpers.get_sms_gateway_email(target.0.sms_carrier,target.0.sms_notify) %]
198 Subject: Curbside Pickup
199 Auto-Submitted: auto-generated
201 [% target.0.pickup_lib.name %] offers curbside pickup.
202 Call [% target.0.pickup_lib.phone %] or visit https://example.org/eg/opac/myopac/holds_curbside
206 INSERT INTO action_trigger.environment (
210 currval('action_trigger.event_definition_id_seq'),
213 currval('action_trigger.event_definition_id_seq'),
217 INSERT INTO action_trigger.event_params (event_def, param, value)
218 VALUES (currval('action_trigger.event_definition_id_seq'), 'check_sms_notify', 1);
220 -- Email confirmation
221 INSERT INTO action_trigger.event_definition (
233 'Curbside confirmation Email notification',
234 'hold.confirm_curbside',
240 [%- user = target.patron -%]
241 To: [%- params.recipient_email || user.email %]
242 From: [%- params.sender_email || default_sender %]
243 Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
244 Subject: Curbside Pickup Confirmed
245 Auto-Submitted: auto-generated
247 This email is to confirm that you have scheduled a curbside item
248 pickup at [% target.org.name %] for [% date.format(helpers.format_date(target.slot), '%a, %d %b %Y %T') %].
250 You can cancel or change to your appointment, add vehicle description
251 notes, and alert staff to your arrival by going to the link below.
253 When you arrive, please call [% target.org.phone %] or visit the
254 link below to let us know you are here.
256 https://example.org/eg/opac/myopac/holds_curbside
258 Stay safe! Wash your hands!
261 INSERT INTO action_trigger.environment (
265 currval('action_trigger.event_definition_id_seq'),
268 currval('action_trigger.event_definition_id_seq'),
272 -- We do /not/ add this by default, treating curbside request as implicit opt-in
274 INSERT INTO action_trigger.event_params (event_def, param, value)
275 VALUES (currval('action_trigger.event_definition_id_seq'), 'check_email_notify', 1);
279 INSERT INTO action_trigger.event_definition (
291 'Curbside confirmation SMS notification',
292 'hold.confirm_curbside',
297 [%- user = target.patron -%]
298 From: [%- params.sender_email || default_sender %]
299 Date: [%- date.format(date.now, '%a, %d %b %Y %T -0000', gmt => 1) %]
300 To: [%- params.recipient_email || helpers.get_sms_gateway_email(helpers.get_user_setting(user.id, 'opac.default_sms_carrier'), helpers.get_user_setting(user.id, 'opac.default_sms_notify')) %]
301 Subject: Curbside Pickup Confirmed
302 Auto-Submitted: auto-generated
304 Location: [% target.org.name %]
305 Time: [% date.format(helpers.format_date(target.slot), '%a, %d %b %Y %T') %]
306 Make changes at https://example.org/eg/opac/myopac/holds_curbside
310 INSERT INTO action_trigger.environment (
314 currval('action_trigger.event_definition_id_seq'),
317 currval('action_trigger.event_definition_id_seq'),
321 -- We do /not/ add this by default, treating curbside request as implicit opt-in
323 INSERT INTO action_trigger.event_params (event_def, param, value)
324 VALUES (currval('action_trigger.event_definition_id_seq'), 'check_sms_notify', 1);