X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FMembers.pm;h=7ee9eb3bbe0adc5d07cbe8f984e90a16c96cdcf1;hb=ebe04d8446b446913f66eaff687f513198b16d19;hp=e756ffb7fbe6fbb47febd2d2af7c45b3dc171c9e;hpb=e41cf34933b3e88e41b20e8fd3d21bcba77e69d9;p=koha.git diff --git a/C4/Members.pm b/C4/Members.pm index e756ffb7fb..7ee9eb3bbe 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -527,7 +527,7 @@ SELECT borrowers.*, categories.category_type, categories.description FROM borrowers LEFT JOIN categories on borrowers.categorycode=categories.categorycode "; - if ( defined $type && ( $type eq 'cardnumber' || $type eq 'firstname'|| $type eq 'userid'|| $type eq 'borrowernumber' ) ){ + if (defined($type) and ( $type eq 'cardnumber' || $type eq 'firstname'|| $type eq 'userid'|| $type eq 'borrowernumber' ) ){ $information = uc $information; $sth = $dbh->prepare("$select WHERE $type=?"); } else { @@ -535,14 +535,12 @@ LEFT JOIN categories on borrowers.categorycode=categories.categorycode } $sth->execute($information); my $data = $sth->fetchrow_hashref; - $sth->finish; ($data) and return ($data); - if ($type eq 'cardnumber' || $type eq 'firstname') { # otherwise, try with firstname + if (defined($type) and ($type eq 'cardnumber' || $type eq 'firstname')) { # otherwise, try with firstname $sth = $dbh->prepare("$select WHERE firstname like ?"); $sth->execute($information); $data = $sth->fetchrow_hashref; - $sth->finish; ($data) and return ($data); } return undef;