From 22c69454db089b1887773267aaa0d0d726771a39 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 16 Feb 2006 15:13:03 +0000 Subject: [PATCH] some more utility methods more small circ updates git-svn-id: svn://svn.open-ils.org/ILS/trunk@3096 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm | 7 ++++++- Open-ILS/src/perlmods/OpenILS/Application/Circ.pm | 4 ++-- .../src/perlmods/OpenILS/Application/Circ/Circulate.pm | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm index d4593d837b..2cd1ae0854 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm @@ -484,6 +484,7 @@ sub fetch_hold_transit_by_hold { return ($transit, $evt ); } +# fetches the captured, but not fulfilled hold attached to a given copy sub fetch_open_hold_by_copy { my( $self, $copyid ) = @_; $logger->debug("Searching for active hold for copy $copyid"); @@ -491,7 +492,11 @@ sub fetch_open_hold_by_copy { $hold = $self->storagereq( 'open-ils.storage.direct.action.hold_request.search_where', - { current_copy => $copyid , fulfillment_time => undef } ); + { + current_copy => $copyid , + capture_time => { "!=" => undef }, + fulfillment_time => undef + } ); $evt = OpenILS::Event->new('HOLD_NOT_FOUND', copyid => $copyid) unless $hold; return ($hold, $evt); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm index fa297328ef..240472dd87 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm @@ -56,7 +56,7 @@ sub checkouts_by_user { my $circs = $apputils->simplereq( 'open-ils.storage', "open-ils.storage.direct.action.open_circulation.search.atomic", - { usr => $target->id, stop_fines => undef } ); + { usr => $target->id, checkin_time => undef } ); # { usr => $target->id } ); my @results; @@ -104,7 +104,7 @@ sub checkouts_by_user_slim { return $apputils->simplereq( 'open-ils.storage', "open-ils.storage.direct.action.open_circulation.search.atomic", - { usr => $target->id, stop_fines => undef } ); + { usr => $target->id, checkin_time => undef } ); # { usr => $target->id } ); } diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm index 8f32a529bb..2a431f2c2f 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm @@ -836,7 +836,9 @@ sub _handle_related_holds { $U->logmark; my @fulfilled; - # XXX should we fulfill all the holds or just the first + # XXX We should only fulfill one hold here... + # XXX If a hold was transited to the user who is checking out + # the item, we need to make sure that hold is what's grabbed if(ref($holds) && @$holds) { # for now, just sort by id to get what should be the oldest hold @@ -848,6 +850,7 @@ sub _handle_related_holds { $logger->debug("Related hold found in checkout: " . $hold->id ); + $hold->current_copy($copy->id); # just make sure it's set # if the hold was never officially captured, capture it. $hold->capture_time('now') unless $hold->capture_time; $hold->fulfillment_time('now'); -- 2.43.2