[BUGFIX] Search also in translated records 26/49826/2
authorFrans Saris <franssaris@gmail.com>
Tue, 30 Aug 2016 21:10:20 +0000 (23:10 +0200)
committerFrans Saris <franssaris@gmail.com>
Sat, 3 Sep 2016 10:23:11 +0000 (12:23 +0200)
When localisation view is enabled in the list view make sure
also the translated records are searched.

Resolves: #77664
Releases: master, 7.6
Change-Id: Ica285db7b410b703b968bcf9f4db1fd797f6b171
Reviewed-on: https://review.typo3.org/49826
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index c3e0c5d..8747a1e 100644 (file)
@@ -543,11 +543,14 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
         if ($this->localizationView && $l10nEnabled) {
             $this->fieldArray[] = '_LOCALIZATION_';
             $this->fieldArray[] = '_LOCALIZATION_b';
-            $addWhere .= ' AND (
-                               ' . $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '<=0
-                               OR
-                               ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . ' = 0
-                       )';
+            // Only restrict to the default language if no search request is in place
+            if ($this->searchString === '') {
+                $addWhere .= ' AND (
+                    ' . $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '<=0
+                    OR
+                    ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . ' = 0
+                )';
+            }
         }
         // Cleaning up:
         $this->fieldArray = array_unique(array_merge($this->fieldArray, $rowListArray));
@@ -762,10 +765,10 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                         $cc++;
                         $this->translations = false;
                         $rowOutput .= $this->renderListRow($table, $row, $cc, $titleCol, $thumbsCol);
-                        // If localization view is enabled it means that the selected records are
-                        // either default or All language and here we will not select translations
+                        // If localization view is enabled and no search happened it means that the selected
+                        // records are either default or All language and here we will not select translations
                         // which point to the main record:
-                        if ($this->localizationView && $l10nEnabled) {
+                        if ($this->localizationView && $l10nEnabled && $this->searchString === '') {
                             // For each available translation, render the record:
                             if (is_array($this->translations)) {
                                 foreach ($this->translations as $lRow) {