@@ -, +, @@ --- t/db_dependent/Reserves.t | 49 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) --- a/t/db_dependent/Reserves.t +++ a/t/db_dependent/Reserves.t @@ -918,7 +918,7 @@ subtest 'ChargeReserveFee tests' => sub { }; subtest 'reserves.item_level_hold' => sub { - plan tests => 3; + plan tests => 4; my $item = $builder->build_sample_item; my $patron = $builder->build_object( @@ -1074,6 +1074,53 @@ subtest 'reserves.item_level_hold' => sub { is( $canreserve->{status}, 'OK', 'item-level holds should be possible with opacitemholds set to "Yes"' ); }; + + subtest 'test opacitemholds rules in staff context' => sub { + plan tests => 2; + + Koha::CirculationRules->set_rules( + { + branchcode => undef, + categorycode => undef, + itemtype => undef, + rules => { + reservesallowed => 25, + opacitemholds => 'N', + } + } + ); + + my $canreserve = C4::Reserves::CanBookBeReserved( + $patron->borrowernumber, + $item->biblionumber, + undef, + { context => 'staff' } + ); + + is( $canreserve->{status}, 'OK', + 'record-level holds should be possible with opacitemholds set to "No"' ); + + $canreserve = C4::Reserves::CanItemBeReserved( + $patron->borrowernumber, + $item->itemnumber, + undef, + { context => 'staff' } + ); + + is( $canreserve->{status}, 'OK', + 'item-level holds should still be possible in staff context, even with opacitemholds set to "No"' ); + }; + + Koha::CirculationRules->set_rules( + { + branchcode => undef, + categorycode => undef, + itemtype => undef, + rules => { + opacitemholds => undef, + } + } + ); }; subtest 'MoveReserve additional test' => sub { --