AFTER INSERT OR UPDATE ON action.circulation
FOR EACH ROW EXECUTE PROCEDURE action.maintain_usr_circ_history();
+UPDATE action_trigger.hook
+ SET core_type = 'auch'
+ WHERE key ~ '^circ.format.history.';
+
+-- avoid TT undef date errors
+UPDATE action_trigger.event_definition SET template =
+$$
+[%- USE date -%]
+<div>
+ <style> li { padding: 8px; margin 5px; }</style>
+ <div>[% date.format %]</div>
+ <br/>
+
+ [% user.family_name %], [% user.first_given_name %]
+ <ol>
+ [% FOR circ IN target %]
+ <li>
+ <div>[% helpers.get_copy_bib_basics(circ.target_copy.id).title %]</div>
+ <div>Barcode: [% circ.target_copy.barcode %]</div>
+ <div>Checked Out: [% date.format(helpers.format_date(circ.xact_start), '%Y-%m-%d') %]</div>
+ <div>Due Date: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]</div>
+ <div>Returned: [%-
+ date.format(
+ helpers.format_date(circ.checkin_time), '%Y-%m-%d')
+ IF circ.checkin_time; -%]
+ </div>
+ </li>
+ [% END %]
+ </ol>
+</div>
+$$
+WHERE id = 26 AND template = -- only replace template if it matches stock
+$$
+[%- USE date -%]
+<div>
+ <style> li { padding: 8px; margin 5px; }</style>
+ <div>[% date.format %]</div>
+ <br/>
+
+ [% user.family_name %], [% user.first_given_name %]
+ <ol>
+ [% FOR circ IN target %]
+ <li>
+ <div>[% helpers.get_copy_bib_basics(circ.target_copy.id).title %]</div>
+ <div>Barcode: [% circ.target_copy.barcode %]</div>
+ <div>Checked Out: [% date.format(helpers.format_date(circ.xact_start), '%Y-%m-%d') %]</div>
+ <div>Due Date: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]</div>
+ <div>Returned: [% date.format(helpers.format_date(circ.checkin_time), '%Y-%m-%d') %]</div>
+ </li>
+ [% END %]
+ </ol>
+</div>
+$$;
+
+
COMMIT;
/* REVERT -- */