From 8d1dc167d5bd0854b8972b86b6550daf04297c02 Mon Sep 17 00:00:00 2001
From: Susanne Moog <susanne.moog@typo3.com>
Date: Fri, 11 Aug 2017 12:31:02 +0200
Subject: [PATCH] [BUGFIX] Allow translating content on MSSQL

Translating content on MSSQL installations has
been impossible due to SQL errors.

The GROUP BY statements in page module and
localizationRepository have been fixed.

Change-Id: I20a4778e3c0858aca80060ba333ce6a47e42ce38
Resolves: #82085
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/53679
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
---
 .../Domain/Repository/Localization/LocalizationRepository.php  | 2 +-
 typo3/sysext/backend/Classes/View/PageLayoutView.php           | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Domain/Repository/Localization/LocalizationRepository.php b/typo3/sysext/backend/Classes/Domain/Repository/Localization/LocalizationRepository.php
index 05dd5d716f3a..54746afda8bd 100644
--- a/typo3/sysext/backend/Classes/Domain/Repository/Localization/LocalizationRepository.php
+++ b/typo3/sysext/backend/Classes/Domain/Repository/Localization/LocalizationRepository.php
@@ -155,7 +155,7 @@ class LocalizationRepository
             ->from('tt_content')
             ->from('sys_language')
             ->where(...$constraints)
-            ->groupBy('sys_language.uid')
+            ->groupBy('sys_language.uid', 'sys_language.sorting')
             ->orderBy('sys_language.sorting');
 
         $result = $queryBuilder->execute()->fetchAll();
diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php
index 65d5e329e3ef..b31396801ddc 100644
--- a/typo3/sysext/backend/Classes/View/PageLayoutView.php
+++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php
@@ -2111,7 +2111,8 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                 )
                 ->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(
-- 
GitLab