[BUGFIX] Search also in translated records 68/49668/5
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:08:30 +0000 (12:08 +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/49668
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Daniel Maier <dani-maier@gmx.de>
Tested-by: Daniel Maier <dani-maier@gmx.de>
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf <andreas.wolf@typo3.org>
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index 578246f..68b1019 100644 (file)
@@ -544,10 +544,13 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
         if ($this->localizationView && $l10nEnabled) {
             $this->fieldArray[] = '_LOCALIZATION_';
             $this->fieldArray[] = '_LOCALIZATION_b';
-            $addWhere = (string)$queryBuilder->expr()->orX(
-                $queryBuilder->expr()->lte($GLOBALS['TCA'][$table]['ctrl']['languageField'], 0),
-                $queryBuilder->expr()->eq($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], 0)
-            );
+            // Only restrict to the default language if no search request is in place
+            if ($this->searchString === '') {
+                $addWhere = (string)$queryBuilder->expr()->orX(
+                    $queryBuilder->expr()->lte($GLOBALS['TCA'][$table]['ctrl']['languageField'], 0),
+                    $queryBuilder->expr()->eq($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], 0)
+                );
+            }
         }
         // Cleaning up:
         $this->fieldArray = array_unique(array_merge($this->fieldArray, $rowListArray));
@@ -763,10 +766,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) {