]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0111.data.selfcheck-holds-receipt-template.sql
Add default Vandelay match set to schema
[working/Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0111.data.selfcheck-holds-receipt-template.sql
1 BEGIN;
2
3 INSERT INTO config.upgrade_log (version) VALUES ('0111');
4
5 INSERT INTO action_trigger.hook (key, core_type, description, passive) 
6     VALUES (
7         'format.selfcheck.holds',
8         'ahr',
9         'Formats holds for self-checkout receipt',
10         TRUE
11     );
12
13 INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, group_field, granularity, template )
14     VALUES (
15         12,
16         TRUE,
17         1,
18         'Self-Checkout Holds Receipt',
19         'format.selfcheck.holds',
20         'NOOP_True',
21         'ProcessTemplate',
22         'usr',
23         'print-on-demand',
24 $$
25 [%- USE date -%]
26 [%- SET user = target.0.usr -%]
27 <div>
28     <style> li { padding: 8px; margin 5px; }</style>
29     <div>[% date.format %]</div>
30     <br/>
31
32     [% user.family_name %], [% user.first_given_name %]
33     <ol>
34     [% FOR hold IN target %]
35         [%-
36             SET idx = loop.count - 1;
37             SET udata =  user_data.$idx
38         -%]
39         <li>
40             <div>Title: [% hold.bib_rec.bib_record.simple_record.title %]</div>
41             <div>Author: [% hold.bib_rec.bib_record.simple_record.author %]</div>
42             <div>Pickup Location: [% hold.pickup_lib.name %]</div>
43             <div>Status: 
44                 [%- IF udata.ready -%]
45                     Ready for pickup
46                 [% ELSE %]
47                     #[% udata.queue_position %] of [% udata.potential_copies %] copies.
48                 [% END %]
49             </div>
50         </li>
51     [% END %]
52     </ol>
53 </div>
54 $$
55 );
56
57
58 INSERT INTO action_trigger.environment ( event_def, path) VALUES
59     ( 12, 'bib_rec.bib_record.simple_record'),
60     ( 12, 'pickup_lib'),
61     ( 12, 'usr');
62
63 COMMIT;