[BUGFIX] Add sorting to group by for SQL compatibility 76/53676/2
authorSusanne Moog <susanne.moog@typo3.com>
Fri, 11 Aug 2017 08:16:01 +0000 (10:16 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Fri, 11 Aug 2017 09:31:24 +0000 (11:31 +0200)
Page module, view module and edit document selected data
with an incomplete group by statement, missing the sorting
column. This resulted in an error on mssql servers.

The sorting field was added to the relevant queries.

Change-Id: If1fb314542e0f27cdf18989fa2b8427c1e31e2d3
Resolves: #79298
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/53676
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/PageLayoutController.php
typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php

index a17f13e..b28b92b 100644 (file)
@@ -1706,7 +1706,7 @@ class EditDocumentController extends AbstractModule
 
         $queryBuilder->select('s.uid', 's.pid', 's.hidden', 's.title', 's.flag')
             ->from('sys_language', 's')
-            ->groupBy('s.uid', 's.pid', 's.hidden', 's.title', 's.flag')
+            ->groupBy('s.uid', 's.pid', 's.hidden', 's.title', 's.flag', 's.sorting')
             ->orderBy('s.sorting');
 
         if ($id) {
index 4d03ce9..1e84f20 100644 (file)
@@ -399,7 +399,8 @@ class PageLayoutController
                 )
                 ->groupBy('pages_language_overlay.sys_language_uid', 'sys_language.uid', 'sys_language.pid',
                     'sys_language.tstamp', 'sys_language.hidden', 'sys_language.title',
-                    'sys_language.language_isocode', 'sys_language.static_lang_isocode', 'sys_language.flag')
+                    'sys_language.language_isocode', 'sys_language.static_lang_isocode', 'sys_language.flag',
+                    'sys_language.sorting')
                 ->orderBy('sys_language.sorting');
             if (!$this->getBackendUser()->isAdmin()) {
                 $queryBuilder->andWhere(
index cc8d6a8..319bfb1 100644 (file)
@@ -284,7 +284,7 @@ class ViewModuleController extends ActionController
                     $queryBuilder->createNamedParameter($pageIdToShow, \PDO::PARAM_INT)
                 )
             )
-            ->groupBy('sys_language.uid', 'sys_language.title')
+            ->groupBy('sys_language.uid', 'sys_language.title', 'sys_language.sorting')
             ->orderBy('sys_language.sorting')
             ->execute();