some more utility methods
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 16 Feb 2006 15:13:03 +0000 (15:13 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 16 Feb 2006 15:13:03 +0000 (15:13 +0000)
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
Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm

index d4593d8..2cd1ae0 100644 (file)
@@ -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);
index fa29732..240472d 100644 (file)
@@ -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 } );
 }
 
index 8f32a52..2a431f2 100644 (file)
@@ -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');