BEGIN; INSERT INTO config.upgrade_log (version) VALUES ('0208'); UPDATE action_trigger.event_definition SET name = 'Lineitem Worksheet', template = $$ [%- USE date -%] [%- SET li = target; -%]
Title: [% helpers.get_li_attr("title", "", li.attributes) %]
Author: [% helpers.get_li_attr("author", "", li.attributes) %]
Item Count: [% li.lineitem_details.size %]
Lineitem ID: [% li.id %]
[% IF li.distribution_formulas.size > 0 %] [% SET forms = [] %] [% FOREACH form IN li.distribution_formulas; forms.push(form.formula.name); END %]
Distribution Formulas: [% forms.join(',') %]
[% END %] [% IF li.lineitem_notes.size > 0 %] Lineitem Notes: [% END %]

[% FOREACH detail IN li.lineitem_details.sort('owning_lib') %] [% IF copy.eg_copy_id; SET copy = copy.eg_copy_id; SET cn_label = copy.call_number.label; ELSE; SET copy = detail; SET cn_label = detail.cn_label; END %] [% END %]
Branch Barcode Call Number Fund Recd. Notes
[% detail.owning_lib.shortname %] [% IF copy.barcode %][% detail.barcode %][% END %] [% IF cn_label %][% cn_label %][% END %] [% IF detail.fund %][% detail.fund.code %] ([% detail.fund.year %])[% END %] [% IF detail.recv_time %][% detail.recv_time %][% END %] [% detail.note %]
$$ WHERE id = 14; INSERT INTO action_trigger.environment (event_def, path) VALUES ( 14, 'lineitem_notes.alert_text' ), ( 14, 'distribution_formulas.formula' ), ( 14, 'lineitem_details.fund' ), ( 14, 'lineitem_details.eg_copy_id' ), ( 14, 'lineitem_details.eg_copy_id.call_number' ) ; COMMIT;