Bugzilla – Attachment 10624 Details for
Bug 8350
Searching for a 10 or 13 digit string (with a number in it) that does not exist in one's catalog will fail to affect SQL statement correctly in C4::Breeding
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixed string substitution bug (8349) and better SQL building
0001-Bug-8350-search-0-or-0-will-fail-to-affect-SQL-state.patch (text/plain), 1.51 KB, created by
Mark Tompsett
on 2012-07-03 12:30:23 UTC
(
hide
)
Description:
Fixed string substitution bug (8349) and better SQL building
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2012-07-03 12:30:23 UTC
Size:
1.51 KB
patch
obsolete
>From a6a9a169441da317f63c9f1c3b51a0f3ec366ac2 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Tue, 3 Jul 2012 20:22:41 +0800 >Subject: [PATCH] Bug 8350 - $search = '0' or 0 will fail to affect SQL > statement correctly in C4::Breeding Included moving the > substitution into the if statement from Bug 8349 as well. > The corrected statement only differs in the case of '' > which clearly has no whitespace to substitute. Modified if > statements to check defined and length to ensure a cleaner > SQL statement. It makes no sense to 'title like %%' on the > query. >Content-Type: text/plain; charset="utf-8" > >--- > C4/Breeding.pm | 8 ++++---- > 1 file 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.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8350
:
10624
|
11888
|
11889
|
11890
|
11891