From 0618a3af6ccd4494d513f8926fd3518b1fae64de Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 10 Mar 2020 09:02:22 -0400 Subject: [PATCH] Bug 24860: Skip non-matching volume holds in CheckReserves Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Rebecca Coert --- C4/Reserves.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index c0eb35291e..2e6982b0ba 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -859,6 +859,7 @@ sub CheckReserves { # See if this item is more important than what we've got so far if ( ( $res->{'priority'} && $res->{'priority'} < $priority ) || $local_hold_match ) { $item ||= Koha::Items->find($itemnumber); + next if $res->{volume_id} && ( !$item->volume || $item->volume->id != $res->{volume_id} ); next if $res->{itemtype} && $res->{itemtype} ne $item->effective_itemtype; $patron ||= Koha::Patrons->find( $res->{borrowernumber} ); my $branch = GetReservesControlBranch( $item->unblessed, $patron->unblessed ); @@ -1651,7 +1652,8 @@ sub _Findgroupreserve { biblioitems.biblioitemnumber AS biblioitemnumber, reserves.itemnumber AS itemnumber, reserves.reserve_id AS reserve_id, - reserves.itemtype AS itemtype + reserves.itemtype AS itemtype, + reserves.volume_id AS volume_id FROM reserves JOIN biblioitems USING (biblionumber) JOIN hold_fill_targets USING (biblionumber, borrowernumber, itemnumber) @@ -1686,7 +1688,8 @@ sub _Findgroupreserve { biblioitems.biblioitemnumber AS biblioitemnumber, reserves.itemnumber AS itemnumber, reserves.reserve_id AS reserve_id, - reserves.itemtype AS itemtype + reserves.itemtype AS itemtype, + reserves.volume_id AS volume_id FROM reserves JOIN biblioitems USING (biblionumber) JOIN hold_fill_targets USING (biblionumber, borrowernumber) @@ -1720,7 +1723,8 @@ sub _Findgroupreserve { reserves.timestamp AS timestamp, reserves.itemnumber AS itemnumber, reserves.reserve_id AS reserve_id, - reserves.itemtype AS itemtype + reserves.itemtype AS itemtype, + reserves.volume_id AS volume_id FROM reserves WHERE reserves.biblionumber = ? AND (reserves.itemnumber IS NULL OR reserves.itemnumber = ?) -- 2.24.1 (Apple Git-126)