Fixed bug #11917: TCEforms suggest fails with empty label or label_alt field (thanks...
authorRupert Germann <rupi@gmx.li>
Sat, 19 Sep 2009 14:13:54 +0000 (14:13 +0000)
committerRupert Germann <rupi@gmx.li>
Sat, 19 Sep 2009 14:13:54 +0000 (14:13 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5987 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/tceforms/class.t3lib_tceforms_suggest_defaultreceiver.php

index 81efa9f..70b66e4 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-09-19  Rupert Germann  <rupi@gmx.li>
+
+       * Fixed bug #11917: TCEforms suggest fails with empty label or label_alt field (thanks to Andreas Wolf)
+
 2009-09-18  Sebastian Kurfuerst  <sebastian@typo3.org>
 
        * Raised Extbase version to 0.9.7 so it works with the caching framework adjustments.
index cac992a..a83f4cc 100644 (file)
@@ -243,18 +243,15 @@ class t3lib_TCEforms_Suggest_DefaultReceiver {
                        $likeCondition = ' LIKE \'' . ($searchWholePhrase ? '%' : '') .
                                $GLOBALS['TYPO3_DB']->escapeStrForLike($searchString, $this->table).'%\'';
 
-                       $selectFields = array();
-                       if (isset($GLOBALS['TCA'][$this->table]['ctrl']['label_alt'])) {
-                                       // Search in all fields given by label or label_alt
-                               $selectFields = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$this->table]['ctrl']['label_alt']);
-                       }
-                       $selectFields[] = $GLOBALS['TCA'][$this->table]['ctrl']['label'];
+                               // Search in all fields given by label or label_alt
+                       $selectFieldsList = $GLOBALS['TCA'][$this->table]['ctrl']['label'] . ',' . $GLOBALS['TCA'][$this->table]['ctrl']['label_alt'];
+                       $selectFields = t3lib_div::trimExplode(',', $selectFieldsList, TRUE);
 
                        $selectParts = array();
                        foreach ($selectFields as $field) {
                                $selectParts[] = $field . $likeCondition;
                        }
-                       $this->selectClause = implode(' OR ', $selectParts);
+                       $this->selectClause = '(' . implode(' OR ', $selectParts) . ')';
 
                        if ($searchUid > 0 && $searchUid == $searchString) {
                                $this->selectClause = '(' . $this->selectClause . ' OR uid = ' . $searchUid . ')';