[open-ils-commits] r18125 - in branches/rel_2_0/Open-ILS: examples/apache src/perlmods/OpenILS/Application/Circ web/opac/extras web/opac/locale/en-US xul/staff_client/server/patron (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Oct 1 15:46:23 EDT 2010


Author: senator
Date: 2010-10-01 15:46:18 -0400 (Fri, 01 Oct 2010)
New Revision: 18125

Added:
   branches/rel_2_0/Open-ILS/web/opac/extras/circ/
Modified:
   branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf
   branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
   branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd
   branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds.js
   branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul
Log:
Backport r18124 from trunk: another pull list printing pathway


Modified: branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf
===================================================================
--- branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf	2010-10-01 19:45:27 UTC (rev 18124)
+++ branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf	2010-10-01 19:46:18 UTC (rev 18125)
@@ -395,6 +395,17 @@
     allow from all
 </Location>
 
+<Location /opac/extras/circ>
+    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
+</Location>
+
 # ----------------------------------------------------------------------------------
 # Reporting output lives here
 # ----------------------------------------------------------------------------------

Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2010-10-01 19:45:27 UTC (rev 18124)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2010-10-01 19:46:18 UTC (rev 18125)
@@ -1310,10 +1310,124 @@
         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;
+}
+
+
+
 __PACKAGE__->register_method(
     method        => 'fetch_hold_notify',
     api_name      => 'open-ils.circ.hold_notification.retrieve_by_hold',

Copied: branches/rel_2_0/Open-ILS/web/opac/extras/circ (from rev 18124, trunk/Open-ILS/web/opac/extras/circ)

Modified: branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-10-01 19:45:27 UTC (rev 18124)
+++ branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-10-01 19:46:18 UTC (rev 18125)
@@ -2987,6 +2987,8 @@
 <!ENTITY staff.patron.holds_overlay.print.accesskey "P">
 <!ENTITY staff.patron.holds_overlay.print_full_pull_list.label "Print Full Pull List">
 <!ENTITY staff.patron.holds_overlay.print_full_pull_list.accesskey "u">
+<!ENTITY staff.patron.holds_overlay.print_alt_pull_list.label "Print Full Pull List (Alternate strategy)">
+<!ENTITY staff.patron.holds_overlay.print_alt_pull_list.accesskey "y">
 <!ENTITY staff.patron.holds_overlay.place_hold.label "Place Hold">
 <!ENTITY staff.patron.holds_overlay.place_hold.accesskey "H">
 <!ENTITY staff.patron.holds_overlay.show_cancelled_holds.label "Show Cancelled Holds">

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds.js	2010-10-01 19:45:27 UTC (rev 18124)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds.js	2010-10-01 19:46:18 UTC (rev 18125)
@@ -327,6 +327,43 @@
                             }
                         }
                     ],
+                    '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() {

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul	2010-10-01 19:45:27 UTC (rev 18124)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul	2010-10-01 19:46:18 UTC (rev 18125)
@@ -19,6 +19,7 @@
         <command id="cmd_csv_to_file" />
         <command id="cmd_holds_print" />
         <command id="cmd_holds_print_full" />
+        <command id="cmd_holds_print_alt" />
         <command id="cmd_show_catalog" />
         <command id="cmd_retrieve_patron" />
         <command id="cmd_holds_edit_desire_mint_condition" />
@@ -188,6 +189,7 @@
 
         <button id="holds_print" label="&staff.patron.holds_overlay.print.label;" command="cmd_holds_print" accesskey="&staff.patron.holds_overlay.print.accesskey;" />
         <button id="print_full_btn" hidden="true" label="&staff.patron.holds_overlay.print_full_pull_list.label;" command="cmd_holds_print_full" accesskey="&staff.patron.holds_overlay.print_full_pull_list.accesskey;" />
+        <button id="print_alt_btn" label="&staff.patron.holds_overlay.print_alt_pull_list.label;" command="cmd_holds_print_alt" accesskey="&staff.patron.holds_overlay.print_alt_pull_list.accesskey;" />
         <spacer flex="1"/>
     </hbox>
 



More information about the open-ils-commits mailing list