[open-ils-commits] r7962 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Nov 1 16:40:50 EDT 2007


Author: erickson
Date: 2007-11-01 16:25:56 -0400 (Thu, 01 Nov 2007)
New Revision: 7962

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
returning a boolean retarget flag from the nearest_hold method to indicate whether a hold was reset during opportunistic capture.  if so, after the current transaction is commited and we have responded complete to the client, we kick off the hold targeter to process untargeted holds

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2007-11-01 18:32:50 UTC (rev 7961)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2007-11-01 20:25:56 UTC (rev 7962)
@@ -211,6 +211,7 @@
     unless($circulator->bail_out) {
         $circulator->do_hold_notify($circulator->notify_hold)
             if $circulator->notify_hold;
+        $circulator->retarget_holds if $circulator->retarget;
     }
 }
 
@@ -333,11 +334,11 @@
     dummy_author
     circ_lib
     barcode
-   duration_level
-   recurring_fines_level
-   duration_rule
-   recurring_fines_rule
-   max_fine_rule
+    duration_level
+    recurring_fines_level
+    duration_rule
+    recurring_fines_rule
+    max_fine_rule
     renewal_remaining
     due_date
     fulfilled_holds
@@ -351,6 +352,7 @@
     opac_renewal
     phone_renewal
     desk_renewal
+    retarget
 /;
 
 
@@ -1537,7 +1539,7 @@
     my $copy = $self->copy;
 
     # See if this copy can fulfill any holds
-    my ($hold) = $holdcode->find_nearest_permitted_hold( 
+    my ($hold, undef, $retarget) = $holdcode->find_nearest_permitted_hold( 
         $self->editor, $copy, $self->editor->requestor );
 
     if(!$hold) {
@@ -1546,6 +1548,7 @@
         return undef;
     }
 
+    $self->retarget($retarget);
 
     $logger->info("circulator: found permitted hold ".
         $hold->id . " for copy, capturing...");
@@ -1624,6 +1627,13 @@
     }
 }
 
+sub retarget_holds {
+    $logger->info("retargeting prev_check_time=null holds after opportunistic capture");
+    my $ses = OpenSRF::AppSession->create('open-ils.storage');
+    $ses->request('open-ils.storage.action.hold_request.copy_targeter');
+    # no reason to wait for the return value
+    return;
+}
 
 sub checkin_build_hold_transit {
     my $self = shift;

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2007-11-01 18:32:50 UTC (rev 7961)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2007-11-01 20:25:56 UTC (rev 7962)
@@ -1323,6 +1323,8 @@
 		or return (undef, $editor->event);
 
 
+    my $retarget = 0;
+
 	# re-target any other holds that already target this copy
 	for my $old_hold (@$old_holds) {
 		next if $old_hold->id eq $best_hold->id; # don't re-target the hold we want
@@ -1332,9 +1334,10 @@
         $old_hold->clear_prev_check_time;
         $editor->update_action_hold_request($old_hold) 
             or return (undef, $editor->event);
+        $retarget = 1;
 	}
 
-	return ($best_hold);
+	return ($best_hold, undef, $retarget);
 }
 
 



More information about the open-ils-commits mailing list