diff --git a/Koha/Item.pm b/Koha/Item.pm index 7251a8a094..849f436a5a 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1977,7 +1977,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 75edcb4275..73208a67b4 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -1968,8 +1968,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, @@ -1980,8 +1980,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,