From c16648318a6beb56844d4d32f89f79100e6ede82 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 10 May 2023 14:26:52 +0200 Subject: [PATCH] Bug 32985: Do not search on cardnumber if not in DefaultPatronSearchFields --- circ/circulation.pl | 2 ++ members/member.pl | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 7b35a8c8608..24798093ee2 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -29,6 +29,7 @@ use CGI qw ( -utf8 ); use URI::Escape qw( uri_escape_utf8 ); use DateTime; use DateTime::Duration; +use List::MoreUtils qw( any ); use Scalar::Util qw( looks_like_number ); use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers ); use C4::Auth qw( get_session get_template_and_user ); @@ -217,6 +218,7 @@ if ( @$barcodes == 0 && $charges eq 'yes' ) { # if there is a list of find borrowers.... # my $message; +$findborrower &&= any { $_ eq 'cardnumber' } split ',', C4::Context->preference('DefaultPatronSearchFields'); if ($findborrower) { Koha::Plugins->call( 'patron_barcode_transform', \$findborrower ); my $patron = Koha::Patrons->find( { cardnumber => $findborrower } ); diff --git a/members/member.pl b/members/member.pl index 54c3e81ac1e..66857f8bde4 100755 --- a/members/member.pl +++ b/members/member.pl @@ -24,9 +24,11 @@ # along with Koha; if not, see . use Modern::Perl; +use CGI qw( -utf8 ); +use List::MoreUtils qw( any ); + use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_html_with_http_headers ); -use CGI qw( -utf8 ); use Koha::List::Patron qw( GetPatronLists ); use Koha::Patrons; use Koha::Patron::Attribute::Types; @@ -46,6 +48,8 @@ my $searchmember = $input->param('searchmember'); my $quicksearch = $input->param('quicksearch') // 0; my $circsearch = $input->param('circsearch') // 0; +$quicksearch &&= any { $_ eq 'cardnumber' } split ',', C4::Context->preference('DefaultPatronSearchFields'); + if ( $quicksearch and $searchmember && !$circsearch ) { my $branchcode; if ( C4::Context::only_my_library ) { -- 2.25.1