diff --git a/Koha/Item.pm b/Koha/Item.pm index 7e14cc8693..18b47e0c55 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1609,7 +1609,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 2a895e5caa..1fe63226fe 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -1425,8 +1425,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, @@ -1437,8 +1437,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,