From a62a31df745143edf8fe2b9b2a47342d5e822f4d Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 19 Jun 2008 15:30:35 +0000 Subject: [PATCH] honor expire time on holds git-svn-id: svn://svn.open-ils.org/ILS/trunk@9870 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../OpenILS/Application/Storage/Publisher/action.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm index 7af61273d9..8b919cc40d 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm @@ -63,6 +63,7 @@ sub ou_hold_requests { WHERE ou.id = ? AND h.capture_time IS NULL AND h.cancel_time IS NULL + AND (h.expire_time IS NULL OR h.expire_time > NOW()) ORDER BY h.request_time SQL @@ -218,6 +219,7 @@ sub nearest_hold { AND (AGE(NOW(),h.request_time) >= CAST(? AS INTERVAL) OR p.prox = 0) AND h.capture_time IS NULL AND h.cancel_time IS NULL + AND (h.expire_time IS NULL OR h.expire_time > NOW()) AND h.frozen IS FALSE ORDER BY p.prox, @@ -368,6 +370,7 @@ sub hold_pull_list { WHERE a.circ_lib = ? AND h.capture_time IS NULL AND h.cancel_time IS NULL + AND (h.expire_time IS NULL OR h.expire_time > NOW()) $status_filter ORDER BY h.request_time ASC LIMIT $limit @@ -821,13 +824,19 @@ sub new_hold_copy_targeter { #first, re-fetch the hold, to make sure it's not captured already $hold->remove_from_object_index(); $hold = action::hold_request->retrieve( $hold->id ); - die "OK\n" if (!$hold or $hold->capture_time); # remove old auto-targeting maps my @oldmaps = action::hold_copy_map->search( hold => $hold->id ); $_->delete for (@oldmaps); - + if ($hold->expire_time) { + my $ex_time = $parser->parse_datetime( clense_ISO8601( $hold->expire_time ) ); + $hold->update( { cancel_time => 'now' } ) if ( DateTime->compare($ex_time, DateTime->now) < 0 ); + $self->method_lookup('open-ils.storage.transaction.commit')->run; + } + + die "OK\n" if (!$hold or $hold->capture_time or $hold->cancel_time); + my $all_copies = []; # find filters for MR holds -- 2.43.2