From ec42d4dfba2c803ddaf10f84d6771fbea93ebd06 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Sun, 28 Jan 2018 01:41:01 -0500 Subject: [PATCH] Bug 13990: Followup: silence warnings on testing prove t/db_dependent/ILSDI_Services.t Signed-off-by: Mark Tompsett 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 c0af05c..c9069af 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.1.4