Commit 0e6faf76 authored by Georg Ringer's avatar Georg Ringer Committed by Andreas Wolf
Browse files

[FEATURE] Make sys_language records sortable.

To improve the usability, the sys_language records are now sortable.

Resolves: #77652
Releases: master
Change-Id: I4225da82a172175b36a04772d9eacf0a8fc863f4
Reviewed-on: https://review.typo3.org/49610

Tested-by: default avatarBamboo TYPO3com <info@typo3.com>
Reviewed-by: Philipp Gampe's avatarPhilipp Gampe <philipp.gampe@typo3.org>
Tested-by: Philipp Gampe's avatarPhilipp Gampe <philipp.gampe@typo3.org>
Reviewed-by: Andreas Wolf's avatarAndreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf's avatarAndreas Wolf <andreas.wolf@typo3.org>
parent 2c54946f
......@@ -69,6 +69,7 @@ class TranslationConfigurationProvider
$languageRecords = $queryBuilder
->select('*')
->from('sys_language')
->orderBy('sorting')
->execute()
->fetchAll();
foreach ($languageRecords as $languageRecord) {
......
......@@ -1707,7 +1707,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')
->orderBy('s.title');
->orderBy('s.sorting');
if ($id) {
$queryBuilder->getRestrictions()
......
......@@ -417,7 +417,7 @@ 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')
->orderBy('sys_language.title');
->orderBy('sys_language.sorting');
if (!$this->getBackendUser()->isAdmin()) {
$queryBuilder->andWhere($queryBuilder->expr()->eq('sys_language.hidden', 0));
}
......@@ -426,7 +426,7 @@ class PageLayoutController
$queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(HiddenRestriction::class));
$statement = $queryBuilder->select('uid', 'title')
->from('sys_language')
->orderBy('title')
->orderBy('sorting')
->execute();
}
while ($lRow = $statement->fetch()) {
......@@ -469,6 +469,7 @@ class PageLayoutController
$count = $queryBuilder
->count('uid')
->from('sys_language')
->orderBy('sorting')
->execute()
->fetchColumn(0);
......
......@@ -123,7 +123,7 @@ class LocalizationRepository
->from('sys_language')
->where(...$constraints)
->groupBy('sys_language.uid')
->orderBy('sys_language.title');
->orderBy('sys_language.sorting');
$result = $queryBuilder->execute()->fetchAll();
......
......@@ -77,6 +77,7 @@ class DatabaseSystemLanguageRows implements FormDataProviderInterface
->select('uid', 'title', 'language_isocode', 'flag')
->from('sys_language')
->where($queryBuilder->expr()->eq('pid', 0))
->orderBy('sorting')
->execute();
while ($row = $queryResult->fetch()) {
......
......@@ -2038,7 +2038,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
$queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(HiddenRestriction::class));
$statement = $queryBuilder->select('uid', 'title')
->from('sys_language')
->orderBy('title')
->orderBy('sorting')
->execute();
$langSelItems = [];
$langSelItems[0] = '
......@@ -2071,7 +2071,7 @@ 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')
->orderBy('sys_language.title');
->orderBy('sys_language.sorting');
if (!$this->getBackendUser()->isAdmin()) {
$queryBuilder->andWhere($queryBuilder->expr()->eq('sys_language.hidden', 0));
}
......
......@@ -100,6 +100,7 @@ class DatabaseSystemLanguageRowsTest extends UnitTestCase
$queryBuilderProphecy->getRestrictions()->shouldBeCalled()->willReturn($queryRestrictionContainerRevelation);
$queryBuilderProphecy->select('uid', 'title', 'language_isocode', 'flag')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->from('sys_language')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->orderBy('sorting')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->expr()->shouldBeCalled()->willReturn($expressionBuilderProphecy->reveal());
$expressionBuilderProphecy->eq('pid', 0)->shouldBeCalled()->willReturn('pid = 0');
$queryBuilderProphecy->where('pid = 0')->shouldBeCalled()->willReturn($queryBuilderRevelation);
......@@ -142,6 +143,7 @@ class DatabaseSystemLanguageRowsTest extends UnitTestCase
$queryBuilderProphecy->getRestrictions()->shouldBeCalled()->willReturn($queryRestrictionContainerRevelation);
$queryBuilderProphecy->select('uid', 'title', 'language_isocode', 'flag')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->from('sys_language')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->orderBy('sorting')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->expr()->shouldBeCalled()->willReturn($expressionBuilderProphecy->reveal());
$expressionBuilderProphecy->eq('pid', 0)->shouldBeCalled()->willReturn('pid = 0');
$queryBuilderProphecy->where('pid = 0')->shouldBeCalled()->willReturn($queryBuilderRevelation);
......@@ -199,6 +201,7 @@ class DatabaseSystemLanguageRowsTest extends UnitTestCase
$queryBuilderProphecy->getRestrictions()->shouldBeCalled()->willReturn($queryRestrictionContainerRevelation);
$queryBuilderProphecy->select('uid', 'title', 'language_isocode', 'flag')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->from('sys_language')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->orderBy('sorting')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->expr()->shouldBeCalled()->willReturn($expressionBuilderProphecy->reveal());
$expressionBuilderProphecy->eq('pid', 0)->shouldBeCalled()->willReturn('pid = 0');
$queryBuilderProphecy->where('pid = 0')->shouldBeCalled()->willReturn($queryBuilderRevelation);
......@@ -251,6 +254,7 @@ class DatabaseSystemLanguageRowsTest extends UnitTestCase
// Simulate method call flow on database objects and verify correct query is built
$connectionPoolProphecy->getQueryBuilderForTable('sys_language')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryRestrictionContainerProphecy->removeAll()->shouldBeCalled()->willReturn($queryRestrictionContainerRevelation);
$queryBuilderProphecy->orderBy('sorting')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->getRestrictions()->shouldBeCalled()->willReturn($queryRestrictionContainerRevelation);
$queryBuilderProphecy->select('uid', 'title', 'language_isocode', 'flag')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->from('sys_language')->shouldBeCalled()->willReturn($queryBuilderRevelation);
......@@ -317,6 +321,7 @@ class DatabaseSystemLanguageRowsTest extends UnitTestCase
$queryBuilderProphecy->getRestrictions()->shouldBeCalled()->willReturn($queryRestrictionContainerRevelation);
$queryBuilderProphecy->select('uid', 'title', 'language_isocode', 'flag')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->from('sys_language')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->orderBy('sorting')->shouldBeCalled()->willReturn($queryBuilderRevelation);
$queryBuilderProphecy->expr()->shouldBeCalled()->willReturn($expressionBuilderProphecy->reveal());
$expressionBuilderProphecy->eq('pid', 0)->shouldBeCalled()->willReturn('pid = 0');
$queryBuilderProphecy->where('pid = 0')->shouldBeCalled()->willReturn($queryBuilderRevelation);
......
......@@ -79,7 +79,7 @@ class SysLanguageViewHelper extends AbstractViewHelper
GeneralUtility::intExplode(',', $uids)
)
)
->orderBy('title', 'ASC')
->orderBy('sorting')
->execute();
while ($row = $res->fetch()) {
......
......@@ -3,7 +3,8 @@ return [
'ctrl' => [
'label' => 'title',
'tstamp' => 'tstamp',
'default_sortby' => 'ORDER BY title',
'default_sortby' => 'ORDER BY sorting',
'sortby' => 'sorting',
'title' => 'LLL:EXT:lang/locallang_tca.xlf:sys_language',
'adminOnly' => true,
'rootLevel' => 1,
......
====================================================
Feature: #77652 - Make sys_language records sortable
====================================================
Description
===========
To improve the usability, the sys_language records are now sortable.
Impact
======
The languages can now be manually sorted instead of an ordering by its name.
\ No newline at end of file
......@@ -636,6 +636,7 @@ CREATE TABLE sys_language (
flag varchar(20) DEFAULT '' NOT NULL,
language_isocode varchar(2) DEFAULT '' NOT NULL,
static_lang_isocode int(11) unsigned DEFAULT '0' NOT NULL,
sorting int(11) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (uid),
KEY parent (pid)
);
......
......@@ -347,7 +347,8 @@ class TranslationStatusController extends \TYPO3\CMS\Backend\Module\AbstractFunc
->removeAll();
$queryBuilder
->select('*')
->from('sys_language');
->from('sys_language')
->orderBy('sorting');
$res = $queryBuilder->execute();
$outputArray = [];
if (is_array($allowed_languages) && !empty($allowed_languages)) {
......
......@@ -287,7 +287,7 @@ class ViewModuleController extends ActionController
)
->where($queryBuilder->expr()->eq('o.pid', (int)$pageIdToShow))
->groupBy('sys_language.uid', 'sys_language.title')
->orderBy('sys_language.title')
->orderBy('sys_language.sorting')
->execute();
while ($row = $result->fetch()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment