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 <jcamins@cpbibliography.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Mark Tompsett 2012-08-30 15:06:07 +08:00 committed by Paul Poulain
parent 813c744008
commit 514b32898e
1 changed files with 4 additions and 4 deletions

View File

@ -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%");
}