From f61bc73bb2058e40cb3d75432f70f9af56d80edb Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 8 Aug 2006 02:06:13 +0000 Subject: [PATCH] fleshing hold transits on more hold retrieval methods git-svn-id: svn://svn.open-ils.org/ILS/trunk@5357 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Circ/Holds.pm | 61 ++++++++++++---------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index 810923b799..859e8bc01c 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -273,8 +273,7 @@ __PACKAGE__->register_method( method => "retrieve_holds_by_id", api_name => "open-ils.circ.holds.retrieve_by_id", notes => <simplereq( 'open-ils.cstore', "open-ils.cstore.direct.action.hold_request.search.atomic", - { id => $hold_id , fulfillment_time => undef }, { order_by => { ahr => "request_time" } }); - - for my $hold ( @$holds ) { - $hold->transit( - $apputils->simplereq( - 'open-ils.cstore', - "open-ils.cstore.direct.action.hold_transit_copy.search.atomic", - { hold => $hold->id }, - { order_by => { ahtc => 'id desc' }, limit => 1 } - )->[0] - ); - } + { id => $hold_id , fulfillment_time => undef }, + { order_by => { ahr => "request_time" } } + ); + flesh_hold_transits($holds); return $holds; } @@ -375,18 +366,9 @@ sub retrieve_holds_by_pickup_lib { cancel_time => undef }, { order_by => { ahr => "request_time" } }); - - for my $hold ( @$holds ) { - $hold->transit( - $apputils->simplereq( - 'open-ils.cstore', - "open-ils.cstore.direct.action.hold_transit_copy.search.atomic", - { hold => $hold->id }, - { order_by => { ahtc => 'id desc' }, limit => 1 } - )->[0] - ); - } + + flesh_hold_transits($holds); return $holds; } @@ -832,8 +814,32 @@ sub fetch_open_title_holds { # { target => $id, hold_type => $type, fulfillment_time => undef }, {idlist=>1}); # XXX make me return IDs in the future ^-- - return $e->search_action_hold_request( - { target => $id, cancel_time => undef, hold_type => $type, fulfillment_time => undef }); + my $holds = $e->search_action_hold_request( + { + target => $id, + cancel_time => undef, + hold_type => $type, + fulfillment_time => undef + } + ); + + flesh_hold_transits($holds); + return $holds; +} + + +sub flesh_hold_transits { + my $holds = shift; + for my $hold ( @$holds ) { + $hold->transit( + $apputils->simplereq( + 'open-ils.cstore', + "open-ils.cstore.direct.action.hold_transit_copy.search.atomic", + { hold => $hold->id }, + { order_by => { ahtc => 'id desc' }, limit => 1 } + )->[0] + ); + } } @@ -875,6 +881,7 @@ sub fetch_captured_holds { $copy->status == OILS_COPY_STATUS_ON_HOLDS_SHELF; } + flesh_hold_transits(\@res); return \@res; } -- 2.11.0