BEGIN; -- SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version); CREATE TABLE config.print_template ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, -- programatic name label TEXT NOT NULL, -- i18n owner INT NOT NULL REFERENCES actor.org_unit (id), active BOOLEAN NOT NULL DEFAULT FALSE, locale TEXT REFERENCES config.i18n_locale(code) ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, content_type TEXT NOT NULL DEFAULT 'text/html', template TEXT NOT NULL, CONSTRAINT name_once_per_lib UNIQUE (owner, name), CONSTRAINT label_once_per_lib UNIQUE (owner, label) ); INSERT INTO config.print_template (id, name, locale, active, owner, label, template) VALUES ( 1, 'patron_address', 'en-US', FALSE, (SELECT id FROM actor.org_unit WHERE parent_ou IS NULL), oils_i18n_gettext(1, 'Address Label', 'cpt', 'label'), $TEMPLATE$ [%- SET patron = template_data.patron; SET addr = template_data.address; -%]
[% patron.first_given_name %] [% patron.second_given_name %] [% patron.family_name %]
[% addr.street1 %]
[% IF addr.street2 %]
[% addr.street2 %]
[% END %]
[% addr.city %], [% addr.state %] [% addr.post_code %]
$TEMPLATE$ ); INSERT INTO config.print_template (id, name, locale, active, owner, label, template) VALUES ( 2, 'holds_for_bib', 'en-US', FALSE, (SELECT id FROM actor.org_unit WHERE parent_ou IS NULL), oils_i18n_gettext(2, 'Holds for Bib Record', 'cpt', 'label'), $TEMPLATE$ [%- USE date; SET holds = template_data; # template_data is an arry of wide_hold hashes. -%]
Holds for record: [% holds.0.title %]

[% FOR hold IN holds %] [% END %]
Request Date Patron Barcode Patron Last Patron Alias Current Item
[% date.format(helpers.format_date( hold.request_time, staff_org_timezone), '%x %r', locale) %] [% hold.ucard_barcode %] [% hold.usr_family_name %] [% hold.usr_alias %] [% hold.cp_barcode %]

[% staff_org.shortname %] [% date.format(helpers.current_date(client_timezone), '%x %r', locale) %]
Printed by [% staff.first_given_name %]

$TEMPLATE$ ); -- Allow for 1k stock templates SELECT SETVAL('config.print_template_id_seq'::TEXT, 1000); INSERT INTO permission.perm_list (id, code, description) VALUES (611, 'ADMIN_PRINT_TEMPLATE', oils_i18n_gettext(611, 'Modify print templates', 'ppl', 'description')); COMMIT;