[BUGFIX] IRRE records are listed comma separated 67/30967/3
authorThomas Löffler <loeffler@spooner-web.de>
Fri, 20 Jun 2014 19:15:14 +0000 (21:15 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 1 Jul 2014 22:01:40 +0000 (00:01 +0200)
IRRE records with foreign_field instead of MM table
are now listed as a comma separated list instead
of wrongly using the number of records as the UID.

Change-Id: Ib1434561ee823d931cc983e103fb58490ca83719
Resolves: #59671
Releases: 6.3,6.2
Reviewed-on: https://review.typo3.org/30967
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index cc05a32..46b8c5f 100644 (file)
@@ -2072,7 +2072,18 @@ class BackendUtility {
                                                        if ($noRecordLookup) {
                                                                $l = $value;
                                                        } else {
-                                                               $rParts = GeneralUtility::trimExplode(',', $value, TRUE);
+                                                               $rParts = array();
+                                                               if (isset($theColConf['foreign_field']) && $theColConf['foreign_field'] !== '') {
+                                                                       $records = self::getRecordsByField($theColConf['foreign_table'], $theColConf['foreign_field'], $uid);
+                                                                       if (!empty($records)) {
+                                                                               foreach ($records as $record) {
+                                                                                       $rParts[] = $record['uid'];
+                                                                               }
+                                                                       }
+                                                               }
+                                                               if (empty($rParts)) {
+                                                                       $rParts = GeneralUtility::trimExplode(',', $value, TRUE);
+                                                               }
                                                                $lA = array();
                                                                foreach ($rParts as $rVal) {
                                                                        $rVal = (int)$rVal;