From 53646b3187465bdb51bfb02f3222c63aa27f6cfc Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Fri, 4 Jun 2010 00:28:29 +0000 Subject: [PATCH] BUGFIX: fix query error when image search doesn't use legacy search git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@106183 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/ThumbnailStripField.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/ThumbnailStripField.php b/code/ThumbnailStripField.php index 0481f030..97141e7e 100755 --- a/code/ThumbnailStripField.php +++ b/code/ThumbnailStripField.php @@ -81,11 +81,13 @@ class ThumbnailStripField extends FormField { } else { if (!self::$use_legacy_image_search) { - $whereSQL = "\"ParentID\" = 0 AND "; + $whereSQL = "\"ParentID\" = 0"; } else { $whereSQL = ''; } + if($searchText) { + if (!empty($whereSQL)) $whereSQL .= " AND"; $whereSQL .= " \"Filename\" LIKE '%$searchText%'"; }