From 9ee11b302f4a0b74688d85f18657c02a407a8a01 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 19 Aug 2022 13:23:05 +0000 Subject: [PATCH] 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 Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 2eb053603d9df3b03f4ee0ec54f84a697aab8716) Signed-off-by: Lucas Gass --- C4/Circulation.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index add037af3a..b8ff965c3c 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -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 -- 2.39.5