From c11d57de96cd43681bbc8ab4a0697a2dfeb7b4f9 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 30 Oct 2024 17:10:11 +0100 Subject: [PATCH] Fix incorrect alphabetical sorting of the package list ref https://www.woltlab.com/community/thread/309253-paketliste-sortierung-nach-namen/ --- .../files/acp/templates/packageList.tpl | 2 +- .../lib/acp/page/PackageListPage.class.php | 10 +++--- .../data/package/I18nPackageList.class.php | 32 +++++++++++++++++++ 3 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 wcfsetup/install/files/lib/data/package/I18nPackageList.class.php diff --git a/wcfsetup/install/files/acp/templates/packageList.tpl b/wcfsetup/install/files/acp/templates/packageList.tpl index 732d60a2a3..b7d94374bd 100644 --- a/wcfsetup/install/files/acp/templates/packageList.tpl +++ b/wcfsetup/install/files/acp/templates/packageList.tpl @@ -84,7 +84,7 @@ {lang}wcf.global.objectID{/lang} - {lang}wcf.acp.package.name{/lang} + {lang}wcf.acp.package.name{/lang} {lang}wcf.acp.package.author{/lang} {lang}wcf.acp.package.version{/lang} {lang}wcf.acp.package.updateDate{/lang} diff --git a/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php b/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php index 5a3386243a..0c693ec7ce 100644 --- a/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php @@ -2,7 +2,7 @@ namespace wcf\acp\page; -use wcf\data\package\PackageList; +use wcf\data\package\I18nPackageList; use wcf\data\package\update\server\PackageUpdateServer; use wcf\page\SortablePage; use wcf\system\application\ApplicationHandler; @@ -16,7 +16,7 @@ use wcf\system\WCF; * @copyright 2001-2019 WoltLab GmbH * @license GNU Lesser General Public License * - * @property PackageList $objectList + * @property I18nPackageList $objectList */ class PackageListPage extends SortablePage { @@ -55,7 +55,7 @@ class PackageListPage extends SortablePage 'packageID', 'package', 'packageDir', - 'packageName', + 'packageNameI18n', 'packageDescription', 'packageDate', 'packageURL', @@ -69,7 +69,7 @@ class PackageListPage extends SortablePage /** * @inheritDoc */ - public $objectListClassName = PackageList::class; + public $objectListClassName = I18nPackageList::class; /** * @inheritDoc @@ -106,7 +106,7 @@ class PackageListPage extends SortablePage */ protected function readObjects() { - $this->sqlOrderBy = 'package.' . ($this->sortField == 'packageType' ? 'isApplication ' . $this->sortOrder : $this->sortField . ' ' . $this->sortOrder) . ($this->sortField != 'packageName' ? ', package.packageName ASC' : ''); + $this->sqlOrderBy = ($this->sortField == 'packageNameI18n' ? '' : 'package.') . ($this->sortField == 'packageType' ? 'isApplication ' . $this->sortOrder : $this->sortField . ' ' . $this->sortOrder) . ($this->sortField != 'packageNameI18n' ? ', packageNameI18n ASC' : ''); parent::readObjects(); } diff --git a/wcfsetup/install/files/lib/data/package/I18nPackageList.class.php b/wcfsetup/install/files/lib/data/package/I18nPackageList.class.php new file mode 100644 index 0000000000..e9bd024965 --- /dev/null +++ b/wcfsetup/install/files/lib/data/package/I18nPackageList.class.php @@ -0,0 +1,32 @@ + + * @since 6.1 + * + * @method Package current() + * @method Package[] getObjects() + * @method Package|null getSingleObject() + * @method Package|null search($objectID) + * @property Package[] $objects + */ +class I18nPackageList extends I18nDatabaseObjectList +{ + /** + * @inheritDoc + */ + public $i18nFields = ['packageName' => 'packageNameI18n']; + + /** + * @inheritDoc + */ + public $className = Package::class; +} -- 2.20.1