From 7aa575be73d35f7e09f072041d6f41f6c4eebc8a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 29 Sep 2021 15:06:19 +0200 Subject: [PATCH] Bug 29134: [ALTERNATIVE patch] Keep filter_by_attribute_value And build the IN using the existing @matching_borrowernumbers. We have a method for that, we should not use raw SQL. --- C4/Utils/DataTables/Members.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm index 3d677b8e010..5bd81ed2caa 100644 --- a/C4/Utils/DataTables/Members.pm +++ b/C4/Utils/DataTables/Members.pm @@ -162,9 +162,8 @@ sub search { if ( $searchfieldstype eq 'standard' and C4::Context->preference('ExtendedPatronAttributes') and $searchmember ) { my @matching_borrowernumbers = Koha::Patrons->filter_by_attribute_value($searchmember)->get_column('borrowernumber'); - for my $borrowernumber ( @matching_borrowernumbers ) { - push @where_strs_or, "borrowers.borrowernumber = ?"; - push @where_args, $borrowernumber; + if ( @matching_borrowernumbers ) { + push @where_strs_or, " borrowers.borrowernumber IN (" . join(', ', @matching_borrowernumbers ) . ")"; } } -- 2.25.1