[open-ils-commits] r11290 - branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Circ
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Nov 20 16:15:38 EST 2008
Author: erickson
Date: 2008-11-20 16:15:34 -0500 (Thu, 20 Nov 2008)
New Revision: 11290
Modified:
branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
optimized on-shelf holds retrieval. only grab the IDs up front and flesh transit/notices within same request
Modified: branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2008-11-20 21:15:14 UTC (rev 11289)
+++ branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2008-11-20 21:15:34 UTC (rev 11290)
@@ -935,11 +935,10 @@
}
-
-
__PACKAGE__->register_method(
method => 'fetch_captured_holds',
api_name => 'open-ils.circ.captured_holds.on_shelf.retrieve',
+ stream => 1,
signature => q/
Returns a list of un-fulfilled holds for a given title id
@param authtoken The login session key
@@ -950,6 +949,7 @@
__PACKAGE__->register_method(
method => 'fetch_captured_holds',
api_name => 'open-ils.circ.captured_holds.id_list.on_shelf.retrieve',
+ stream => 1,
signature => q/
Returns a list ids of un-fulfilled holds for a given title id
@param authtoken The login session key
@@ -966,36 +966,50 @@
$org ||= $e->requestor->ws_ou;
- my $holds = $e->search_action_hold_request(
- {
- capture_time => { "!=" => undef },
- current_copy => { "!=" => undef },
- fulfillment_time => undef,
- pickup_lib => $org,
- cancel_time => undef,
- }
- );
+ my $hold_ids = $e->json_query(
+ {
+ select => { ahr => ['id'] },
+ from => {
+ ahr => {
+ acp => {
+ field => 'id',
+ fkey => 'current_copy'
+ },
+ }
+ },
+ where => {
+ '+acp' => { status => OILS_COPY_STATUS_ON_HOLDS_SHELF },
+ '+ahr' => {
+ capture_time => { "!=" => undef },
+ current_copy => { "!=" => undef },
+ fulfillment_time => undef,
+ pickup_lib => $org,
+ cancel_time => undef,
+ }
+ }
+ },
+ );
- my @res;
- for my $h (@$holds) {
- my $copy = $e->retrieve_asset_copy($h->current_copy)
- or return $e->event;
- push( @res, $h ) if
- $copy->status == OILS_COPY_STATUS_ON_HOLDS_SHELF;
- }
+ for my $hold_id (@$hold_ids) {
+ if($self->api_name =~ /id_list/) {
+ $conn->respond($hold_id->{id});
+ next;
+ } else {
+ $conn->respond(
+ $e->retrieve_action_hold_request([
+ $hold_id->{id},
+ {
+ flesh => 1,
+ flesh_fields => {ahr => ['notifications', 'transit']},
+ order_by => {anh => 'notify_time desc'}
+ }
+ ])
+ );
+ }
+ }
- if( ! $self->api_name =~ /id_list/ ) {
- flesh_hold_transits(\@res);
- flesh_hold_notices(\@res, $e);
- }
-
- if( $self->api_name =~ /id_list/ ) {
- return [ map { $_->id } @res ];
- } else {
- return \@res;
- }
+ return undef;
}
-
__PACKAGE__->register_method(
method => "check_title_hold",
api_name => "open-ils.circ.title_hold.is_possible",
More information about the open-ils-commits
mailing list