4 INSERT INTO action_trigger.hook (key, core_type, description, passive)
6 'circ.format.history.csv',
9 'circ.format.history.csv',
10 'Produce CSV of circulation history',
17 INSERT INTO action_trigger.event_definition (
18 active, owner, name, hook, reactor, validator, group_field, template)
20 TRUE, 1, 'Circ History CSV', 'circ.format.history.csv', 'ProcessTemplate', 'NOOP_True', 'usr',
22 Title,Author,Call Number,Barcode,Format
25 bibxml = helpers.unapi_bre(circ.target_copy.call_number.record, {flesh => '{mra}'});
27 FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
28 title = title _ part.textContent;
30 author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
31 item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value') %]
33 [%- helpers.csv_datum(title) -%],
34 [%- helpers.csv_datum(author) -%],
35 [%- helpers.csv_datum(circ.target_copy.call_number.label) -%],
36 [%- helpers.csv_datum(circ.target_copy.barcode) -%],
37 [%- helpers.csv_datum(item_type) %]
42 INSERT INTO action_trigger.environment (event_def, path)
44 currval('action_trigger.event_definition_id_seq'),
45 'target_copy.call_number'
51 DELETE FROM action_trigger.event WHERE event_def = (
52 SELECT id FROM action_trigger.event_definition WHERE hook = 'circ.format.history.csv');
53 DELETE FROM action_trigger.event_definition WHERE hook = 'circ.format.history.csv');
54 DELETE FROM action_trigger.hook WHERE key = 'circ.format.history.csv';