@@ -, +, @@ current item/patron --- C4/Reserves.pm | 2 +- t/db_dependent/Reserves.t | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -1685,7 +1685,7 @@ sub _Findgroupreserve { FROM reserves JOIN biblioitems USING (biblionumber) JOIN hold_fill_targets USING (biblionumber, borrowernumber) - WHERE ( ( found IS NULL AND priority > 0 ) OR found='T' ) + WHERE ( ( found IS NULL AND priority > 0 ) OR found IN ('T','W') ) AND item_level_request = 0 AND hold_fill_targets.itemnumber = ? AND reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) --- a/t/db_dependent/Reserves.t +++ a/t/db_dependent/Reserves.t @@ -1080,7 +1080,7 @@ subtest 'RevertWaitingStatus' => sub { subtest 'CheckReserves additional test' => sub { - plan tests => 3; + plan tests => 6; my $biblio = $builder->build_sample_biblio(); my $itype = $builder->build_object({ class => "Koha::ItemTypes", value => { notforloan => 0 } }); @@ -1134,6 +1134,7 @@ subtest 'CheckReserves additional test' => sub { } }); + # We set one reserve in transit - equivalent to checking it in at another branch and confirming transfer ModReserveAffect( $item_1->itemnumber, $reserve1->borrowernumber, 1, $reserve1->reserve_id ); my ($status, $matched_reserve, $possible_reserves) = CheckReserves($item_1->itemnumber); @@ -1141,6 +1142,15 @@ subtest 'CheckReserves additional test' => sub { is( $matched_reserve->{reserve_id}, $reserve1->reserve_id, "We got the Transit reserve"); is( scalar @$possible_reserves, 1, 'We only get the one matched'); + + # We set the reserve to waiting - equivalent to checking it in at pickup location and confirming + ModReserveAffect( $item_1->itemnumber, $reserve1->borrowernumber, 0, $reserve1->reserve_id ); + ($status, $matched_reserve, $possible_reserves) = CheckReserves($item_1->itemnumber); + + is( $status, 'Waiting', "We found a reserve" ); + is( $matched_reserve->{reserve_id}, $reserve1->reserve_id, "We got the Waiting reserve"); + is( scalar @$possible_reserves, 1, 'We only get the one matched'); + }; sub count_hold_print_messages { --