LP1744341 Hold targeter --retarget-frozen fix
authorBill Erickson <berickxx@gmail.com>
Wed, 1 Mar 2023 20:40:03 +0000 (15:40 -0500)
committerJosh Stompro <stomproj@larl.org>
Thu, 2 Mar 2023 14:45:14 +0000 (08:45 -0600)
Perform the actual copy map updates then exit targeting the frozen hold.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Josh Stompro <stomproj@larl.org>
Open-ILS/src/perlmods/lib/OpenILS/Utils/HoldTargeter.pm

index 317780d..7c343b3 100644 (file)
@@ -1404,7 +1404,7 @@ sub target {
         if $hold->capture_time     ||
            $hold->cancel_time      ||
            $hold->fulfillment_time ||
-           $U->is_true($hold->frozen);
+           ($U->is_true($hold->frozen) && !$self->parent->{retarget_frozen});
 
     $self->hold($hold);
 
@@ -1412,8 +1412,16 @@ sub target {
     return unless $self->get_hold_copies;
     return unless $self->update_copy_maps;
 
-    # Hopeless Date logic based on copy map
+    # We may have updated the hold copy maps for a frozen hold in
+    # the presence of retarget_frozen.  We don't, however, want to
+    # actually find a current_copy (target) or perform any other
+    # actions on the hold if it's frozen.
+    if ($U->is_true($hold->frozen)) {
+        $self->editor->commit;
+        return $self->exit_targeter("Frozen hold remapped;  all done");
+    }
 
+    # Hopeless Date logic based on copy map
     $self->handle_hopeless_date;
 
     # Confirm that we have something to work on.  If we have no