my $retrieve = ($type eq 'bib') ?
'retrieve_vandelay_queued_bib_record' : 'retrieve_vandelay_queued_authority_record';
+ my $search = ($type eq 'bib') ?
+ 'search_vandelay_queued_bib_record' : 'search_vandelay_queued_authority_record';
if ($self->api_name =~ /export/) {
+ my $rec_list = $e->$search({id => [map { $_->{id} } @$record_ids]});
if ($self->api_name =~ /print/) {
$e->rollback;
return $U->fire_object_event(
undef,
'vandelay.queued_'.$type.'_record.print',
- [map {$_->{id}} @$record_ids],
+ $rec_list,
$e->requestor->ws_ou
);
return $U->fire_object_event(
undef,
'vandelay.queued_'.$type.'_record.csv',
- [map {$_->{id}} @$record_ids],
+ $rec_list,
$e->requestor->ws_ou
);
$conn->respond_complete(1);
- for my $rec_id (@$record_ids) {
+ for my $rec (@$rec_list) {
$U->create_events_for_hook(
'vandelay.queued_'.$type.'_record.email',
- $rec_id->{id},
+ $rec,
$e->requestor->home_ou,
undef,
undef,
if $$options{with_import_error};
my $items = $e->json_query($query);
+ my $item_list = $e->search_vandelay_import_item({id => [map { $_->{id} } @$items]});
if ($self->api_name =~ /export/) {
if ($self->api_name =~ /print/) {
return $U->fire_object_event(
undef,
'vandelay.import_items.print',
- [map {$_->{id}} @$items],
+ $item_list,
$e->requestor->ws_ou
);
return $U->fire_object_event(
undef,
'vandelay.import_items.csv',
- [map {$_->{id}} @$items],
+ $item_list,
$e->requestor->ws_ou
);
$conn->respond_complete(1);
- for my $item (@$items) {
+ for my $item (@$item_list) {
$U->create_events_for_hook(
'vandelay.import_items.email',
- $item->{id},
+ $item,
$e->requestor->home_ou,
undef,
undef,
}
} else {
- for my $item (@$items) {
- $conn->respond($e->retrieve_vandelay_import_item($item->{id}));
+ for my $item (@$item_list) {
+ $conn->respond($item);
}
}
--- /dev/null
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('test'); -- phasefx
+
+INSERT INTO action_trigger.hook (key,core_type,description,passive) VALUES (
+ 'vandelay.queued_bib_record.print',
+ 'vqbr',
+ oils_i18n_gettext(
+ 'vandelay.queued_bib_record.print',
+ 'Print output has been requested for records in an Importer Bib Queue.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+ ,(
+ 'vandelay.queued_bib_record.csv',
+ 'vqbr',
+ oils_i18n_gettext(
+ 'vandelay.queued_bib_record.csv',
+ 'CSV output has been requested for records in an Importer Bib Queue.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+ ,(
+ 'vandelay.queued_bib_record.email',
+ 'vqbr',
+ oils_i18n_gettext(
+ 'vandelay.queued_bib_record.email',
+ 'An email has been requested for records in an Importer Bib Queue.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+ ,(
+ 'vandelay.queued_auth_record.print',
+ 'vqar',
+ oils_i18n_gettext(
+ 'vandelay.queued_auth_record.print',
+ 'Print output has been requested for records in an Importer Authority Queue.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+ ,(
+ 'vandelay.queued_auth_record.csv',
+ 'vqar',
+ oils_i18n_gettext(
+ 'vandelay.queued_auth_record.csv',
+ 'CSV output has been requested for records in an Importer Authority Queue.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+ ,(
+ 'vandelay.queued_auth_record.email',
+ 'vqar',
+ oils_i18n_gettext(
+ 'vandelay.queued_auth_record.email',
+ 'An email has been requested for records in an Importer Authority Queue.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+ ,(
+ 'vandelay.import_items.print',
+ 'vii',
+ oils_i18n_gettext(
+ 'vandelay.import_items.print',
+ 'Print output has been requested for Import Items from records in an Importer Bib Queue.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+ ,(
+ 'vandelay.import_items.csv',
+ 'vii',
+ oils_i18n_gettext(
+ 'vandelay.import_items.csv',
+ 'CSV output has been requested for Import Items from records in an Importer Bib Queue.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+ ,(
+ 'vandelay.import_items.email',
+ 'vii',
+ oils_i18n_gettext(
+ 'vandelay.import_items.email',
+ 'An email has been requested for Import Items from records in an Importer Bib Queue.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+;
+
+INSERT INTO action_trigger.event_definition (
+ id,
+ active,
+ owner,
+ name,
+ hook,
+ validator,
+ reactor,
+ group_field,
+ granularity,
+ template
+ ) VALUES (
+ 38,
+ TRUE,
+ 1,
+ 'Print Output for Queued Bib Records',
+ 'vandelay.queued_bib_record.print',
+ 'NOOP_True',
+ 'ProcessTemplate',
+ 'usr',
+ 'print-on-demand',
+$$
+[%- USE date -%]
+<pre>
+Queue ID: [% target.0.queue.id %]
+Queue Name: [% target.0.queue.name %]
+Queue Type: [% target.0.queue.queue_type %]
+Complete? [% target.0.queue.complete %]
+
+ [% FOR vqbr IN target %]
+=-=-=
+ Title of work | [% helpers.get_queued_bib_attr('title',vqbr.attributes) %]
+ Author of work | [% helpers.get_queued_bib_attr('author',vqbr.attributes) %]
+ Language of work | [% helpers.get_queued_bib_attr('language',vqbr.attributes) %]
+ Pagination | [% helpers.get_queued_bib_attr('pagination',vqbr.attributes) %]
+ ISBN | [% helpers.get_queued_bib_attr('isbn',vqbr.attributes) %]
+ ISSN | [% helpers.get_queued_bib_attr('issn',vqbr.attributes) %]
+ Price | [% helpers.get_queued_bib_attr('price',vqbr.attributes) %]
+ Accession Number | [% helpers.get_queued_bib_attr('rec_identifier',vqbr.attributes) %]
+ TCN Value | [% helpers.get_queued_bib_attr('eg_tcn',vqbr.attributes) %]
+ TCN Source | [% helpers.get_queued_bib_attr('eg_tcn_source',vqbr.attributes) %]
+ Internal ID | [% helpers.get_queued_bib_attr('eg_identifier',vqbr.attributes) %]
+ Publisher | [% helpers.get_queued_bib_attr('publisher',vqbr.attributes) %]
+ Publication Date | [% helpers.get_queued_bib_attr('pubdate',vqbr.attributes) %]
+ Edition | [% helpers.get_queued_bib_attr('edition',vqbr.attributes) %]
+ Item Barcode | [% helpers.get_queued_bib_attr('item_barcode',vqbr.attributes) %]
+
+ [% END %]
+</pre>
+$$
+ )
+;
+
+INSERT INTO action_trigger.environment ( event_def, path) VALUES (
+ 38, 'attributes')
+ ,( 38, 'queue')
+;
+
+COMMIT;
+-- DELETE FROM action_trigger.event WHERE event_def IN (38); DELETE FROM action_trigger.environment WHERE event_def IN (38); DELETE FROM action_trigger.event_definition WHERE id IN (38); DELETE FROM action_trigger.hook WHERE key IN ('vandelay.queued_bib_record.print','vandelay.queued_bib_record.csv','vandelay.queued_bib_record.email','vandelay.queued_auth_record.print','vandelay.queued_auth_record.csv','vandelay.queued_auth_record.email','vandelay.import_items.print','vandelay.import_items.csv','vandelay.import_items.email'); DELETE FROM config.upgrade_log WHERE version = 'test';