[BUGFIX] getProcessedValue ignores sorting of select field values 82/2882/12
authorJohannes Feustel <s@feustel.eu>
Sat, 10 Nov 2012 20:34:39 +0000 (21:34 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 10 Nov 2013 13:28:14 +0000 (14:28 +0100)
Keep sorting of select field values which is lost during database select.

Change-Id: If0347f6c92e71a3855a00fd24bbbada7c15af386
Fixes: #27519
Releases: 6.2, 6.1, 6.0, 4.7, 4.5
Reviewed-on: https://review.typo3.org/2882
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index c5f2535..d66c660 100644 (file)
@@ -2040,9 +2040,13 @@ class BackendUtility {
                                                        if (is_array($selectUids) && count($selectUids) > 0) {
                                                                $MMres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, ' . $MMfield, $theColConf['foreign_table'], 'uid IN (' . implode(',', $selectUids) . ')' . self::deleteClause($theColConf['foreign_table']));
                                                                while ($MMrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($MMres)) {
-                                                                       $mmlA[] = $noRecordLookup ? $MMrow['uid'] : self::getRecordTitle($theColConf['foreign_table'], $MMrow, FALSE, $forceResult);
+                                                                       // Keep sorting of $selectUids
+                                                                       $mmlA[array_search($MMrow['uid'], $selectUids)] = $noRecordLookup ?
+                                                                               $MMrow['uid'] :
+                                                                               self::getRecordTitle($theColConf['foreign_table'], $MMrow, FALSE, $forceResult);
                                                                }
                                                                $GLOBALS['TYPO3_DB']->sql_free_result($MMres);
+                                                               ksort($mmlA);
                                                                if (is_array($mmlA)) {
                                                                        $l = implode('; ', $mmlA);
                                                                } else {