From c4812fb57418e42fb92baa98cea627336a5cb28f Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Thu, 30 Aug 2012 15:06:07 +0800 Subject: [PATCH] Bug 8350: warning in logs when searching for nonexistent ISBN Content-Type: text/plain; charset="UTF-8" Searching for a 10 or 13 digit numeric string that does not exist in one's catalog will fail to affect SQL statement correctly in C4::Breeding. Moved string substitution, which was triggering error when search was undefined, and fixed if statements accordingly. Signed-off-by: Jared Camins-Esakov --- C4/Breeding.pm | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 19bb7e2..ea3e902 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -179,16 +179,16 @@ sub BreedingSearch { $query .= "z3950random = ?"; @bind=($z3950random); } else { - $search =~ s/(\s+)/\%/g; @bind=(); - if ($search) { + if (defined($search) && length($search)>0) { + $search =~ s/(\s+)/\%/g; $query .= "title like ? OR author like ?"; push(@bind,"%$search%", "%$search%"); } - if ($search && $isbn) { + if ($#bind!=-1 && defined($isbn) && length($isbn)>0) { $query .= " and "; } - if ($isbn) { + if (defined($isbn) && length($isbn)>0) { $query .= "isbn like ?"; push(@bind,"$isbn%"); } -- 1.7.2.5