[BUGFIX] Add sorting to group by for SQL compatibility 74/53674/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:19:13 +0000 (11:19 +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/53674
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Tested-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
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 82fa866..b6daa5e 100644 (file)
@@ -1700,7 +1700,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 0610165..effd5c3 100644 (file)
@@ -346,7 +346,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 45de79c..83af9e6 100644 (file)
@@ -340,7 +340,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();