From fffb89aef4f77628e45b3d08fbf4281736e70880 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 19 May 2003 14:55:32 +0000 Subject: [PATCH] fixing strange bug when cardnumber not set and borrower does not exists : sometimes finded value anyway ! --- C4/Search.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index e192de5cf5..16eab9479c 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1785,6 +1785,7 @@ the C table in the Koha database. #' sub borrdata { my ($cardnumber,$bornum)=@_; + warn "bornum $bornum"; $cardnumber = uc $cardnumber; my $dbh = C4::Context->dbh; my $query; @@ -1801,12 +1802,15 @@ sub borrdata { if ($data) { return($data); } else { # try with firstname - my $sth=$dbh->prepare("select * from borrowers where firstname='$cardnumber'"); - $sth->execute; - my $data=$sth->fetchrow_hashref; - $sth->finish; - return($data); + if ($cardnumber) { + my $sth=$dbh->prepare("select * from borrowers where firstname='$cardnumber'"); + $sth->execute; + my $data=$sth->fetchrow_hashref; + $sth->finish; + return($data); + } } + return undef; } =item borrissues -- 2.39.5