From 29e6bf6b891c8470bae1bf33d9d38b7697638d94 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 26 Jan 2011 08:39:22 -0500 Subject: [PATCH] for listing holds, taking advantage of batch retrieve args to reduce data size; added limit/offset to holds list for paging --- Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm index 676781f266..213f4cb618 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm @@ -408,6 +408,9 @@ sub load_myopac_holds { my $e = $self->editor; my $ctx = $self->ctx; + my $limit = $self->cgi->param('limit') || 10; + my $offset = $self->cgi->param('offset') || 0; + my $circ = OpenSRF::AppSession->create('open-ils.circ'); my $hold_ids = $circ->request( 'open-ils.circ.holds.id_list.retrieve', @@ -415,20 +418,30 @@ sub load_myopac_holds { $e->requestor->id )->gather(1); + $hold_ids = [ @$hold_ids[$offset..($offset + $limit - 1)] ]; + my $req = $circ->request( 'open-ils.circ.hold.details.batch.retrieve', $e->authtoken, - $hold_ids + $hold_ids, + { + suppress_notices => 1, + suppress_transits => 1, + suppress_mvr => 1, + suppress_patron_details => 1, + include_bre => 1 + } ); # any requests we can fire off here? - # XXX use marc attrs instead of the mvr's returned by hold.details $ctx->{holds} = []; while(my $resp = $req->recv) { my $hold = $resp->content; - # need to fetch anything else? - push(@{$ctx->{holds}}, $hold); + push(@{$ctx->{holds}}, { + hold => $hold, + marc_xml => XML::LibXML->new->parse_string($hold->{bre}->marc) + }); } $circ->kill_me; -- 2.11.0