[open-ils-commits] r9870 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jun 19 11:30:39 EDT 2008


Author: miker
Date: 2008-06-19 11:30:35 -0400 (Thu, 19 Jun 2008)
New Revision: 9870

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
Log:
honor expire time on holds

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm	2008-06-19 13:52:49 UTC (rev 9869)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm	2008-06-19 15:30:35 UTC (rev 9870)
@@ -63,6 +63,7 @@
 		  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 @@
 		  	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 @@
 		  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 @@
 			#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



More information about the open-ils-commits mailing list