hold targeter reify experiment
authorBill Erickson <berickxx@gmail.com>
Fri, 10 Jun 2016 21:18:18 +0000 (17:18 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 10 Jun 2016 21:18:18 +0000 (17:18 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Utils/HoldTargeter.pm

index 4a3ea9c..03e579a 100644 (file)
@@ -367,7 +367,6 @@ sub get_hold_copies {
             fkey => 'status'
         };
 
-        $query->{where}->{'+acp'}->{circulate} = 't';
         $query->{where}->{'+acp'}->{holdable} = 't';
         $query->{where}->{'+acp'}->{mint_condition} = 't'
             if $U->is_true($hold->mint_condition);
@@ -466,13 +465,17 @@ sub update_copy_maps {
     my $self = shift;
     my $e = $self->editor;
 
-    $e->json_query({from => [
+    my $resp = $e->json_query({from => [
         'action.hold_request_regen_copy_maps', 
         $self->hold_id, 
         '{' . join(',', map {$_->{id}} @{$self->copies}) . '}'
     ]});
 
-    return 1;
+    # The above call can fail if another process is updating
+    # copy maps for this hold at the same time.
+    return 1 if $resp && @$resp;
+
+    return $self->exit_targeter("Error creating hold copy maps");
 }
 
 # Returns a map of proximity values to arrays of copy hashes.