From bab2028e341a8600fd703596af97a6ae778c01fe Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 13 Oct 2021 08:22:54 -0400 Subject: [PATCH] Bug 29219: Suppress warning when building holds queue where hold fulfillment policy is 'patrongroup' When building the holds queue with rules where the hold fulfillment policy is 'patrongroup', you may see the following warning: Use of uninitialized value in string eq at /usr/share/koha/lib/C4/HoldsQueue.pm line 728. because there is not such thing as a 'patrongroup' key for the item hash. Test Plan: 1) Set hold rules to use patrongroup 2) Build the holds queue 3) Note the warning 4) Apply this patch 5) Build the holds queue again 6) No warning! --- C4/HoldsQueue.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index b4d2b026f2..c74c397e44 100644 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -616,8 +616,10 @@ sub MapItemsToHoldRequests { next unless $items_by_itemnumber{ $item->{itemnumber} }->{_object}->can_be_transferred( { to => $libraries->{ $request->{branchcode} } } ); # Don't fill item level holds that contravene the hold pickup policy at this time - next unless $item->{hold_fulfillment_policy} eq 'any' - || $request->{branchcode} eq $item->{ $item->{hold_fulfillment_policy} }; + next + unless $item->{hold_fulfillment_policy} eq 'any' + || ( defined $item->{ $item->{hold_fulfillment_policy} } + && $request->{branchcode} eq $item->{ $item->{hold_fulfillment_policy} } ); # If hold itemtype is set, item's itemtype must match next unless ( !$request->{itemtype} -- 2.30.1 (Apple Git-130)