hold targeter reify : circ tie-ins
authorBill Erickson <berickxx@gmail.com>
Thu, 16 Jun 2016 21:17:47 +0000 (17:17 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 16 Jun 2016 21:17:47 +0000 (17:17 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm

index befe1bc..31e5d76 100644 (file)
@@ -7,6 +7,7 @@ use OpenSRF::Utils::SettingsClient;
 use OpenSRF::Utils::Logger qw(:logger);
 use OpenILS::Const qw/:const/;
 use OpenILS::Application::AppUtils;
+use OpenILS::Utils::HoldTargeter;
 use DateTime;
 my $U = "OpenILS::Application::AppUtils";
 
@@ -2299,7 +2300,10 @@ sub checkin_retarget {
                 next if ($_->{hold_type} eq 'P');
             }
             # So much for easy stuff, attempt a retarget!
-            my $tresult = $U->storagereq('open-ils.storage.action.hold_request.copy_targeter', undef, $_->{id}, $self->copy->id);
+            my $tresult = OpenILS::Utils::HoldTargeter->new->target(
+                hold => $_->{id}, 
+                find_copy => $self->copy->id
+            );
             if(ref $tresult eq "ARRAY" and scalar @$tresult) {
                 last if(exists $tresult->[0]->{found_copy} and $tresult->[0]->{found_copy});
             }
index 65c3a6f..a99847e 100644 (file)
@@ -27,6 +27,7 @@ use OpenSRF::Utils;
 use OpenSRF::Utils::Logger qw(:logger);
 use OpenILS::Utils::CStoreEditor q/:funcs/;
 use OpenILS::Utils::PermitHold;
+use OpenILS::Utils::HoldTargeter;
 use OpenSRF::Utils::SettingsClient;
 use OpenILS::Const qw/:const/;
 use OpenILS::Application::Circ::Transit;
@@ -380,9 +381,8 @@ sub create_hold {
 
     $conn->respond_complete($hold->id);
 
-    $U->storagereq(
-        'open-ils.storage.action.hold_request.copy_targeter',
-        undef, $hold->id ) unless $U->is_true($hold->frozen);
+    OpenILS::Utils::HoldTargeter->new->target(hold => $hold->id) 
+        unless $U->is_true($hold->frozen);
 
     return undef;
 }
@@ -746,7 +746,7 @@ sub uncancel_hold {
     $e->update_action_hold_request($hold) or return $e->die_event;
     $e->commit;
 
-    $U->storagereq('open-ils.storage.action.hold_request.copy_targeter', undef, $hold_id);
+    OpenILS::Utils::HoldTargeter->new->target(hold => $hold_id) 
 
     return 1;
 }
@@ -1064,15 +1064,14 @@ sub update_hold_impl {
 
     if(!$U->is_true($hold->frozen) && $U->is_true($orig_hold->frozen)) {
         $logger->info("Running targeter on activated hold ".$hold->id);
-        $U->storagereq( 'open-ils.storage.action.hold_request.copy_targeter', undef, $hold->id );
+        OpenILS::Utils::HoldTargeter->new->target(hold => $hold->id) 
     }
 
     # a change to mint-condition changes the set of potential copies, so retarget the hold;
     if($U->is_true($hold->mint_condition) and !$U->is_true($orig_hold->mint_condition)) {
         _reset_hold($self, $e->requestor, $hold)
     } elsif($need_retarget && !defined $hold->capture_time()) { # If needed, retarget the hold due to changes
-        $U->storagereq(
-            'open-ils.storage.action.hold_request.copy_targeter', undef, $hold->id );
+        OpenILS::Utils::HoldTargeter->new->target(hold => $hold->id) 
     }
 
     return $hold->id;
@@ -1160,7 +1159,7 @@ sub update_hold_if_frozen {
     } else {
         if($U->is_true($orig_hold->frozen)) {
             $logger->info("Running targeter on activated hold ".$hold->id);
-            $U->storagereq( 'open-ils.storage.action.hold_request.copy_targeter', undef, $hold->id );
+            OpenILS::Utils::HoldTargeter->new->target(hold => $hold->id) 
         }
     }
 }
@@ -1989,8 +1988,7 @@ sub _reset_hold {
     $e->update_action_hold_request($hold) or return $e->die_event;
     $e->commit;
 
-    $U->storagereq(
-        'open-ils.storage.action.hold_request.copy_targeter', undef, $hold->id );
+    OpenILS::Utils::HoldTargeter->new->target(hold => $hold->id) 
 
     return undef;
 }