From 514b32898e8169c9bb4e3e7d683fdbf7ed8fe55d 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 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 Signed-off-by: Paul Poulain --- C4/Breeding.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 19bb7e2223..ea3e90215f 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%"); } -- 2.39.5