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 <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 64ec35b2a5)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Nick Clemens 2025-05-16 12:51:21 +00:00 committed by Paul Derscheid
parent 71f601dabb
commit 8b044defb5
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 1 additions and 1 deletions

View File

@ -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