[BUGFIX] Filename sorting in filelist is broken 81/27881/2
authorFrans Saris <franssaris@gmail.com>
Wed, 26 Feb 2014 20:25:11 +0000 (21:25 +0100)
committerFrans Saris <franssaris@gmail.com>
Thu, 27 Feb 2014 15:00:20 +0000 (16:00 +0100)
The sorting by filename in the filelist is broken since the
introduction of sys_file_metadata. It tries to sort the file list
by property file. Before sys_file_metadata it couldn't find this
property and sorted by the default value name. But after introduction
of sys_file_metadata it has an property file, his own sys_file uid.

This patch fixes the sorting behaviour when sorting by filename.

Resolves: #56128
Releases: 6.2
Change-Id: Icd25bc2aafed4baafbaa7d9f87ce755fe9e64579
Reviewed-on: https://review.typo3.org/27881
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Stefan Froemken
Tested-by: Stefan Froemken
Reviewed-by: Frans Saris
Tested-by: Frans Saris
typo3/sysext/filelist/Classes/FileList.php

index 54328d1..3b9ab55 100644 (file)
@@ -291,6 +291,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                        $this->sort = trim($this->sort);
                        if ($this->sort !== '') {
                                $filesToSort = array();
+                               /** @var $fileObject \TYPO3\CMS\Core\Resource\File */
                                foreach ($files as $fileObject) {
                                        switch ($this->sort) {
                                                case 'size':
@@ -305,6 +306,9 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                                                case 'tstamp':
                                                        $sortingKey = $fileObject->getModificationTime();
                                                        break;
+                                               case 'file':
+                                                       $sortingKey = $fileObject->getName();
+                                                       break;
                                                default:
                                                        if ($fileObject->hasProperty($this->sort)) {
                                                                $sortingKey = $fileObject->getProperty($this->sort);