From 48035900f3fe1394c36be523bfcb899f859fcca9 Mon Sep 17 00:00:00 2001 From: senator Date: Fri, 1 Oct 2010 19:45:27 +0000 Subject: [PATCH] Offer yet another pull list printing pathway If you have pull lists long enough to make A/T groan, perhaps this will work better for you. git-svn-id: svn://svn.open-ils.org/ILS/trunk@18124 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/apache/eg_vhost.conf | 11 ++ .../src/perlmods/OpenILS/Application/Circ/Holds.pm | 114 +++++++++++++++++ Open-ILS/web/opac/extras/circ/alt_pull_list.html | 139 +++++++++++++++++++++ Open-ILS/web/opac/locale/en-US/lang.dtd | 2 + Open-ILS/xul/staff_client/server/patron/holds.js | 37 ++++++ .../staff_client/server/patron/holds_overlay.xul | 2 + 6 files changed, 305 insertions(+) create mode 100644 Open-ILS/web/opac/extras/circ/alt_pull_list.html diff --git a/Open-ILS/examples/apache/eg_vhost.conf b/Open-ILS/examples/apache/eg_vhost.conf index 1f93a21df3..da947e0b45 100644 --- a/Open-ILS/examples/apache/eg_vhost.conf +++ b/Open-ILS/examples/apache/eg_vhost.conf @@ -395,6 +395,17 @@ RewriteRule - - [E=locale:en-US] [L] allow from all + + SetHandler perl-script + PerlSetVar OILSProxyTitle "Circ Extras Login" + PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to export records" + PerlSetVar OILSProxyPermissions "STAFF_LOGIN" + PerlHandler OpenILS::WWW::Proxy + Options +ExecCGI + PerlSendHeader On + allow from all + + # ---------------------------------------------------------------------------------- # Reporting output lives here # ---------------------------------------------------------------------------------- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index 2073ce2378..143caeb417 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -1310,6 +1310,120 @@ sub print_hold_pull_list { undef, "ahr.format.pull_list", $sorted_holds, $org_id, undef, undef, $client ); + +} + +__PACKAGE__->register_method( + method => "print_hold_pull_list_stream", + stream => 1, + api_name => "open-ils.circ.hold_pull_list.print.stream", + signature => { + desc => 'Returns a stream of fleshed holds', + params => [ + { desc => 'Authtoken', type => 'string'}, + { desc => 'Hash of optional param: Org unit ID (defaults to workstation org unit), limit, offset, sort (array of: acplo.position, call_number, request_time)', + type => 'object' + }, + ], + return => { + desc => 'A stream of fleshed holds', + type => 'object' + } + } +); + +sub print_hold_pull_list_stream { + my($self, $client, $auth, $params) = @_; + + my $e = new_editor(authtoken=>$auth); + return $e->die_event unless $e->checkauth; + + delete($$params{org_id}) unless (int($$params{org_id})); + delete($$params{limit}) unless (int($$params{limit})); + delete($$params{offset}) unless (int($$params{offset})); + + $$params{org_id} = (defined $$params{org_id}) ? $$params{org_id}: $e->requestor->ws_ou; + return $e->die_event unless $e->allowed('VIEW_HOLD', $$params{org_id }); + + my $sort = []; + if ($$params{sort} && @{ $$params{sort} }) { + for my $s (@{ $$params{sort} }) { + if ($s eq 'acplo.position') { + push @$sort, { + "class" => "acplo", "field" => "position", + "transform" => "coalesce", "params" => [999] + }; + } elsif ($s eq 'call_number') { + push @$sort, {"class" => "acn", "field" => "label"}; + } elsif ($s eq 'request_time') { + push @$sort, {"class" => "ahr", "field" => "request_time"}; + } + } + } else { + push @$sort, {"class" => "ahr", "field" => "request_time"}; + } + + my $holds_ids = $e->json_query( + { + "select" => {"ahr" => ["id"]}, + "from" => { + "ahr" => { + "acp" => { + "field" => "id", + "fkey" => "current_copy", + "filter" => { + "circ_lib" => $$params{org_id}, "status" => [0,7] + }, + "join" => { + "acn" => { + "field" => "id", + "fkey" => "call_number" + }, + "acplo" => { + "field" => "org", + "fkey" => "circ_lib", + "type" => "left", + "filter" => { + "location" => {"=" => {"+acp" => "location"}} + } + } + } + } + } + }, + "where" => { + "+ahr" => { + "capture_time" => undef, + "cancel_time" => undef, + "-or" => [ + {"expire_time" => undef }, + {"expire_time" => {">" => "now"}} + ] + } + }, + (@$sort ? (order_by => $sort) : ()), + ($$params{limit} ? (limit => $$params{limit}) : ()), + ($$params{offset} ? (offset => $$params{offset}) : ()) + }, {"subquery" => 1} + ) or return $e->die_event; + + $logger->info("about to stream back " . scalar(@$holds_ids) . " holds"); + + $client->respond( + $e->retrieve_action_hold_request([ + $_->{"id"}, { + "flesh" => 3, + "flesh_fields" => { + "ahr" => ["usr", "current_copy"], + "acp" => ["location", "call_number"], + "acn" => ["record"] + } + } + ]) + ) foreach @$holds_ids; + + $e->disconnect; + undef; } diff --git a/Open-ILS/web/opac/extras/circ/alt_pull_list.html b/Open-ILS/web/opac/extras/circ/alt_pull_list.html new file mode 100644 index 0000000000..6302ac2704 --- /dev/null +++ b/Open-ILS/web/opac/extras/circ/alt_pull_list.html @@ -0,0 +1,139 @@ + + + Printable Pull List + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
TitleAuthorShelving LocationCall NumberBarcode
${current_copy.location.name}${current_copy.call_number.label}${current_copy.barcode}
+ + + + + + diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index d1a0a0980a..8b2b60645f 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2993,6 +2993,8 @@ + + diff --git a/Open-ILS/xul/staff_client/server/patron/holds.js b/Open-ILS/xul/staff_client/server/patron/holds.js index b1ae0b1100..678d87e9cd 100644 --- a/Open-ILS/xul/staff_client/server/patron/holds.js +++ b/Open-ILS/xul/staff_client/server/patron/holds.js @@ -327,6 +327,43 @@ patron.holds.prototype = { } } ], + 'cmd_holds_print_alt' : [ + ['command'], + function() { + try { + var content_params = { + "session": ses(), + "authtime": ses("authtime"), + "no_xulG": false, + "show_nav_buttons": true, + "show_print_button": false + }; + ["url_prefix", "new_tab", "set_tab", + "close_tab", "new_patron_tab", + "set_patron_tab", "volume_item_creator", + "get_new_session", + "holdings_maintenance_tab", "set_tab_name", + "open_chrome_window", "url_prefix", + "network_meter", "page_meter", + "set_statusbar", "set_help_context" + ].forEach(function(k) { + content_params[k] = xulG[k]; + }); + + var loc = urls.XUL_BROWSER + "?url=" + window.escape( + xulG.url_prefix("/opac/extras/circ/alt_pull_list.html") + ); + xulG.new_tab( + loc, { + "tab_name": "Printable Pull List", /* XXX i18n */ + "browser": false + }, content_params + ); + } catch (E) { + g.error.sdump("D_ERROR", E); + } + } + ], 'cmd_holds_print' : [ ['command'], function() { diff --git a/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul b/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul index df101453fb..7b2accd214 100644 --- a/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul +++ b/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul @@ -19,6 +19,7 @@ + @@ -188,6 +189,7 @@