[BUGFIX] Make filter in workspace module work again 99/60499/3
authorBenni Mack <benni@typo3.org>
Wed, 17 Apr 2019 19:15:52 +0000 (21:15 +0200)
committerBenni Mack <benni@typo3.org>
Thu, 25 Apr 2019 09:23:08 +0000 (11:23 +0200)
If no additional fields have been defined, the workspace
module search should use default columns that are shown
by TYPO3 Core.

Resolves: #86766
Releases: master, 9.5
Change-Id: I1d9ddb17b87c87ce07ebbf2ae20d6b5d0da59b06
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60499
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Achim Fritz <af@achimfritz.de>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Achim Fritz <af@achimfritz.de>
Reviewed-by: Benni Mack <benni@typo3.org>
typo3/sysext/workspaces/Classes/Service/GridDataService.php

index f599279..91cc85c 100644 (file)
@@ -476,25 +476,36 @@ class GridDataService implements LoggerAwareInterface
     protected function isFilterTextInVisibleColumns($filterText, array $versionArray)
     {
         if (is_array($GLOBALS['BE_USER']->uc['moduleData']['Workspaces'][$GLOBALS['BE_USER']->workspace]['columns'])) {
-            foreach ($GLOBALS['BE_USER']->uc['moduleData']['Workspaces'][$GLOBALS['BE_USER']->workspace]['columns'] as $column => $value) {
-                if (isset($value['hidden']) && isset($column) && isset($versionArray[$column])) {
-                    if ($value['hidden'] == 0) {
-                        switch ($column) {
-                            case 'workspace_Tstamp':
-                                if (stripos($versionArray['workspace_Formated_Tstamp'], $filterText) !== false) {
-                                    return true;
-                                }
-                                break;
-                            case 'change':
-                                if (stripos(strval($versionArray[$column]), str_replace('%', '', $filterText)) !== false) {
-                                    return true;
-                                }
-                                break;
-                            default:
-                                if (stripos(strval($versionArray[$column]), $filterText) !== false) {
-                                    return true;
-                                }
-                        }
+            $visibleColumns = $GLOBALS['BE_USER']->uc['moduleData']['Workspaces'][$GLOBALS['BE_USER']->workspace]['columns'];
+        } else {
+            $visibleColumns = [
+                'workspace_Formated_Tstamp' => ['hidden' => 0],
+                'change' => ['hidden' => 0],
+                'path_Workspace' => ['hidden' => 0],
+                'path_Live' => ['hidden' => 0],
+                'label_Live' => ['hidden' => 0],
+                'label_Stage' => ['hidden' => 0],
+                'label_Workspace' => ['hidden' => 0],
+            ];
+        }
+        foreach ($visibleColumns as $column => $value) {
+            if (isset($value['hidden']) && isset($column) && isset($versionArray[$column])) {
+                if ($value['hidden'] == 0) {
+                    switch ($column) {
+                        case 'workspace_Tstamp':
+                            if (stripos($versionArray['workspace_Formated_Tstamp'], $filterText) !== false) {
+                                return true;
+                            }
+                            break;
+                        case 'change':
+                            if (stripos(strval($versionArray[$column]), str_replace('%', '', $filterText)) !== false) {
+                                return true;
+                            }
+                            break;
+                        default:
+                            if (stripos(strval($versionArray[$column]), $filterText) !== false) {
+                                return true;
+                            }
                     }
                 }
             }