BEGIN;
INSERT INTO config.upgrade_log (version) VALUES ('0111');
INSERT INTO action_trigger.hook (key, core_type, description, passive)
VALUES (
'format.selfcheck.holds',
'ahr',
'Formats holds for self-checkout receipt',
TRUE
);
INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, group_field, granularity, template )
VALUES (
12,
TRUE,
1,
'Self-Checkout Holds Receipt',
'format.selfcheck.holds',
'NOOP_True',
'ProcessTemplate',
'usr',
'print-on-demand',
$$
[%- USE date -%]
[%- SET user = target.0.usr -%]
[% date.format %]
[% user.family_name %], [% user.first_given_name %]
[% FOR hold IN target %]
[%-
SET idx = loop.count - 1;
SET udata = user_data.$idx
-%]
-
Title: [% hold.bib_rec.bib_record.simple_record.title %]
Author: [% hold.bib_rec.bib_record.simple_record.author %]
Pickup Location: [% hold.pickup_lib.name %]
Status:
[%- IF udata.ready -%]
Ready for pickup
[% ELSE %]
#[% udata.queue_position %] of [% udata.potential_copies %] copies.
[% END %]
[% END %]
$$
);
INSERT INTO action_trigger.environment ( event_def, path) VALUES
( 12, 'bib_rec.bib_record.simple_record'),
( 12, 'pickup_lib'),
( 12, 'usr');
COMMIT;