diff --git a/Koha/Item.pm b/Koha/Item.pm index dc9395a0aa..5dc28c59d8 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1971,7 +1971,7 @@ sub can_be_waiting_recall { # Check the circulation rule for each relevant itemtype for this item my $rule = Koha::CirculationRules->get_effective_rules({ branchcode => $branchcode, - categorycode => undef, + categorycode => $self->check_recalls ? $self->check_recalls->patron->categorycode : undef, itemtype => $self->effective_itemtype, rules => [ 'recalls_allowed', diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index 5be387cf00..609ac47748 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -1947,8 +1947,8 @@ subtest 'Recalls tests' => sub { # Patron2 has Item1 checked out. Patron1 has placed a biblio-level recall on Biblio1, so check if Item1 can fulfill Patron1's recall. Koha::CirculationRules->set_rules({ - branchcode => undef, - categorycode => undef, + branchcode => $branchcode, + categorycode => $patron1->categorycode, itemtype => $item1->effective_itemtype, rules => { recalls_allowed => 0, @@ -1959,8 +1959,8 @@ subtest 'Recalls tests' => sub { is( $item1->can_be_waiting_recall, 0, "Recalls not allowed for this itemtype" ); Koha::CirculationRules->set_rules({ - branchcode => undef, - categorycode => undef, + branchcode => $branchcode, + categorycode => $patron1->categorycode, itemtype => $item1->effective_itemtype, rules => { recalls_allowed => 1,