From edb493feaae12e27339c677fb6952878d5eca341 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 16 May 2025 12:51:21 +0000 Subject: [PATCH] Bug 39920: Update query for check previous checkout to use IN This patch alters the query for checking previous checkouts to use IN instead of a list of OR for itemnumbers. To test: 1 - On the command line: export DBIC_TRACE=1 2 - perl -e 'use Koha::Patrons;my $patron = Koha::Patrons->find(5);my $item = Koha::Items->find(54);warn $item->itemnumber;$patron->do_check_for_previous_checkout( $item->unblessed );' 3 - Note the query 4 - Apply patch 5 - Repeat 2 6 - Note the shorter query Signed-off-by: David Nind Signed-off-by: Martin Renvoize --- Koha/Patron.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index d9f08197d4b..f849510a662 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -876,7 +876,7 @@ sub do_check_for_previous_checkout { # Create (old)issues search criteria my $criteria = { borrowernumber => $self->borrowernumber, - itemnumber => \@item_nos, + itemnumber => { -in => \@item_nos }, }; # Check current issues table -- 2.49.0