From 5bdeeda457205cb11d02bc4d615cd75044b57702 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Sun, 28 Jan 2018 01:41:01 -0500 Subject: [PATCH] Bug 13990: (follow-up) silence warnings on testing prove t/db_dependent/ILSDI_Services.t Signed-off-by: Mark Tompsett Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens --- C4/ILSDI/Services.pm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index bfe48fffde..e1aadddb3c 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -310,20 +310,21 @@ Parameters: sub LookupPatron { my ($cgi) = @_; - my $patrons; - - if(!$cgi->param('id')) { - return { message => 'PatronNotFound' }; + my $id = $cgi->param('id'); + if(!$id) { + return { message => 'PatronNotFound' }; } - if($cgi->param('id_type')) { - $patrons = Koha::Patrons->search( { $cgi->param('id_type') => $cgi->param('id') } ); + my $patrons; + my $passed_id_type = $cgi->param('id_type'); + if($passed_id_type) { + $patrons = Koha::Patrons->search( { $passed_id_type => $id } ); } else { - foreach my $id_type ('cardnumber', 'userid', 'email', 'borrowernumber', + foreach my $id_type ('cardnumber', 'userid', 'email', 'borrowernumber', 'surname', 'firstname') { - $patrons = Koha::Patrons->search( { $id_type => $cgi->param('id') } ); - last if($patrons->count); - } + $patrons = Koha::Patrons->search( { $id_type => $id } ); + last if($patrons->count); + } } unless ( $patrons->count ) { return { message => 'PatronNotFound' }; -- 2.39.5