Bug 13990: (follow-up) silence warnings on testing
authorMark Tompsett <mtompset@hotmail.com>
Sun, 28 Jan 2018 06:41:01 +0000 (01:41 -0500)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 30 Jan 2018 17:21:19 +0000 (14:21 -0300)
prove t/db_dependent/ILSDI_Services.t

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

C4/ILSDI/Services.pm

index c0af05c..c9069af 100644 (file)
@@ -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' };