3 SELECT evergreen.upgrade_deps_block_check('1173', :eg_version);
5 CREATE TABLE config.print_template (
7 name TEXT NOT NULL, -- programatic name
8 label TEXT NOT NULL, -- i18n
9 owner INT NOT NULL REFERENCES actor.org_unit (id),
10 active BOOLEAN NOT NULL DEFAULT FALSE,
11 locale TEXT REFERENCES config.i18n_locale(code)
12 ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
13 content_type TEXT NOT NULL DEFAULT 'text/html',
14 template TEXT NOT NULL,
15 CONSTRAINT name_once_per_lib UNIQUE (owner, name),
16 CONSTRAINT label_once_per_lib UNIQUE (owner, label)
19 INSERT INTO config.print_template
20 (id, name, locale, active, owner, label, template)
22 1, 'patron_address', 'en-US', FALSE,
23 (SELECT id FROM actor.org_unit WHERE parent_ou IS NULL),
24 oils_i18n_gettext(1, 'Address Label', 'cpt', 'label'),
27 SET patron = template_data.patron;
28 SET addr = template_data.address;
32 [% patron.first_given_name %]
33 [% patron.second_given_name %]
34 [% patron.family_name %]
36 <div>[% addr.street1 %]</div>
37 [% IF addr.street2 %]<div>[% addr.street2 %]</div>[% END %]
39 [% addr.city %], [% addr.state %] [% addr.post_code %]
45 INSERT INTO config.print_template
46 (id, name, locale, active, owner, label, template)
48 2, 'holds_for_bib', 'en-US', FALSE,
49 (SELECT id FROM actor.org_unit WHERE parent_ou IS NULL),
50 oils_i18n_gettext(2, 'Holds for Bib Record', 'cpt', 'label'),
54 SET holds = template_data;
55 # template_data is an arry of wide_hold hashes.
58 <div>Holds for record: [% holds.0.title %]</div>
60 <style>#holds-for-bib-table td { padding: 5px; }</style>
61 <table id="holds-for-bib-table">
65 <th>Patron Barcode</th>
72 [% FOR hold IN holds %]
75 date.format(helpers.format_date(
76 hold.request_time, staff_org_timezone), '%x %r', locale)
78 <td>[% hold.ucard_barcode %]</td>
79 <td>[% hold.usr_family_name %]</td>
80 <td>[% hold.usr_alias %]</td>
81 <td>[% hold.cp_barcode %]</td>
88 [% staff_org.shortname %]
89 [% date.format(helpers.current_date(client_timezone), '%x %r', locale) %]
91 <div>Printed by [% staff.first_given_name %]</div>
98 -- Allow for 1k stock templates
99 SELECT SETVAL('config.print_template_id_seq'::TEXT, 1000);
101 INSERT INTO permission.perm_list (id, code, description)
102 VALUES (611, 'ADMIN_PRINT_TEMPLATE',
103 oils_i18n_gettext(611, 'Modify print templates', 'ppl', 'description'));