From: Dan Wells Date: Thu, 25 Feb 2016 16:44:23 +0000 (-0500) Subject: LP#1548147 Quick Export Feature for Vandelay Queues X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=212cf48a0b07843b675da8a1e623052d61921e04;p=evergreen%2Ftadl.git LP#1548147 Quick Export Feature for Vandelay Queues When we import records into Vandelay, sometimes some of the records are not what we expected, so they get rejected. These records often need to be loaded using a different set of options, so this link makes it convenient to get a new file of just the rejects. Signed-off-by: Dan Wells Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm index 058f7a3649..bf2fa367ca 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm @@ -105,9 +105,50 @@ sub handler { @records = map { ($_->target_biblio_record_entry) } @$recs; } + my $type = $cgi->param('rectype') || 'biblio'; + my $retrieve_func; + # STILL no records ... + my $queue_id = $cgi->param('queueid'); + if ($queue_id) { + # check that we're logged in -- XXX necessary? conservative for now + my $authid = $cgi->cookie('ses') || $cgi->param('ses'); + my $auth = verify_login($authid); + if (!$auth) { + return 403; + } + + # validate type + my $queue_type; + if ($type eq 'biblio') { + $queue_type = 'bib'; + } elsif ($type eq 'authority') { + $queue_type = $type; + } else { + return 400; + } + + # does queue exist? This check is really just for better error logging + my $queue = $ses->request( "open-ils.cstore.direct.vandelay.${queue_type}_queue.retrieve", $queue_id )->gather(1); + unless($queue) { + $r->log->error("No such queue $queue_id"); + $logger->error("No such queue $queue_id"); + return Apache2::Const::NOT_FOUND; + } + + # fetch the records + my $query = {queue => $queue_id}; + if ($cgi->param('nonimported')) { + $query->{import_time} = undef; + } + $retrieve_func = "vandelay.queued_${queue_type}_record"; + my $recs = $ses->request( "open-ils.cstore.direct.${retrieve_func}.id_list.atomic", $query )->gather(1); + @records = @$recs; + } else { + $retrieve_func = "$type.record_entry"; + } + return show_template($r) unless (@records); - my $type = $cgi->param('rectype') || 'biblio'; if ($type ne 'biblio' && $type ne 'authority') { return 400; } @@ -197,7 +238,7 @@ sub handler { try { local $SIG{ALRM} = sub { die "TIMEOUT\n" }; alarm(1); - $bib = $ses->request( "open-ils.cstore.direct.$type.record_entry.retrieve", $i, $flesh )->gather(1); + $bib = $ses->request( "open-ils.cstore.direct.$retrieve_func.retrieve", $i, $flesh )->gather(1); alarm(0); } otherwise { warn "\n!!!!!! Timed out trying to read record $i\n"; diff --git a/Open-ILS/src/templates/vandelay/inc/queue.tt2 b/Open-ILS/src/templates/vandelay/inc/queue.tt2 index cce9a7351b..b2c8655456 100644 --- a/Open-ILS/src/templates/vandelay/inc/queue.tt2 +++ b/Open-ILS/src/templates/vandelay/inc/queue.tt2 @@ -15,6 +15,7 @@ [% l('Import Selected Records') %] [% l('Import All Records') %] [% l('View Import Items') %] + [% l('Export Non-Imported Records') %]