Bug 31112: (QA follow-up) Fetch patrons with reserves

Previously we fetched all in a single call using biblionumbers

Fetching each individually could be a performance hit on systems
with large numbers of holds

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2eb053603d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2022-08-19 13:23:05 +00:00 committed by Lucas Gass
parent ce478da6ab
commit 9ee11b302f
1 changed files with 4 additions and 1 deletions

View File

@ -2948,7 +2948,10 @@ sub CanBookBeRenewed {
)
{
my $biblio = Koha::Biblios->find($item->biblionumber);
my @possible_holds = $biblio->current_holds->unfilled->search({non_priority => 0})->as_list;
my @possible_holds = $biblio->current_holds->unfilled->search(
{non_priority => 0},
{ prefetch => 'patron' }
)->as_list;
# Get all other items that could possibly fill reserves
# FIXME We could join reserves (or more tables) here to eliminate some checks later