[BUGFIX] Use correct field `fe_group` instead of non-existent `fe_groups` 45/52645/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 27 Apr 2017 17:41:43 +0000 (19:41 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 27 Apr 2017 19:25:14 +0000 (21:25 +0200)
Since #80317, `BackendUtility::ADMCMD_previewCmds()` uses the field
`fe_groups` for the `pages` table, which does not exist. This patch
fixes the regression by using `fe_group` again.

Resolves: #81052
Related: #80317
Releases: master, 8.7
Change-Id: I08106704589fcab7607a9448b2eae646c611de93
Reviewed-on: https://review.typo3.org/52645
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index 237226e..45c917d 100644 (file)
@@ -4845,12 +4845,13 @@ class BackendUtility
      */
     public static function ADMCMD_previewCmds($pageInfo)
     {
-        $tableNameFeGroup = 'fe_groups';
         $simUser = '';
         $simTime = '';
-        if ($pageInfo[$tableNameFeGroup] > 0) {
-            $simUser = '&ADMCMD_simUser=' . $pageInfo[$tableNameFeGroup];
-        } elseif ((int)$pageInfo[$tableNameFeGroup] === -2) {
+        if ($pageInfo['fe_group'] > 0) {
+            $simUser = '&ADMCMD_simUser=' . $pageInfo['fe_group'];
+        } elseif ((int)$pageInfo['fe_group'] === -2) {
+            $tableNameFeGroup = 'fe_groups';
+
             // -2 means "show at any login". We simulate first available fe_group.
             /** @var PageRepository $sysPage */
             $sysPage = GeneralUtility::makeInstance(PageRepository::class);
@@ -4862,7 +4863,7 @@ class BackendUtility
             $activeFeGroupRow = $queryBuilder->select('uid')
                 ->from($tableNameFeGroup)
                 ->where(
-                    QueryHelper::stripLogicalOperatorPrefix('1=1' . $sysPage->enableFields('fe_groups'))
+                    QueryHelper::stripLogicalOperatorPrefix('1=1' . $sysPage->enableFields($tableNameFeGroup))
                 )
                 ->execute()
                 ->fetch();