LP#1596595 Targeter accepts a list of hold ID's
authorBill Erickson <berickxx@gmail.com>
Thu, 2 Feb 2017 22:00:24 +0000 (17:00 -0500)
committerBill Erickson <berickxx@gmail.com>
Tue, 14 Feb 2017 16:22:03 +0000 (11:22 -0500)
Allow the caller to pass a list of hold ID's (consistent with the
current hold targeter).  This resolves the issue where the checkin
process attempts to retarget a set of holds via a single targeter call.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/src/perlmods/lib/OpenILS/Utils/HoldTargeter.pm

index 125b395..75b8e84 100644 (file)
@@ -47,8 +47,9 @@ sub new {
 #
 # Optional parameters:
 #
-# hold => <id>
-#  (Re)target a specific hold.
+# hold => <id> / [<id>, <id>, ...]
+#  (Re)target one or more specific holds.  Specified as a single hold ID
+#  or an array ref of hold IDs.
 #
 # return_count => 1
 #   Return the total number of holds processed instead of a result
@@ -105,7 +106,11 @@ sub target {
 sub find_holds_to_target {
     my $self = shift;
 
-    return ($self->{hold}) if $self->{hold};
+    if ($self->{hold}) {
+        # $self->{hold} can be a single hold ID or an array ref of hold IDs
+        return @{$self->{hold}} if ref $self->{hold} eq 'ARRAY';
+        return ($self->{hold});
+    }
 
     my $query = {
         select => {ahr => ['id']},