[BUGFIX] Display correct list of file ids in BE module list 45/36445/2
authoralinafleser <afleser@arxia.com>
Thu, 29 Jan 2015 19:42:23 +0000 (21:42 +0200)
committerFrans Saris <franssaris@gmail.com>
Fri, 30 Jan 2015 16:26:43 +0000 (17:26 +0100)
TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue is now
considering foreign_match_fields when processing IRRE fields

Resolves: #62755
Releases: master, 6.2
Change-Id: I45c742bca0b3a2822411f5693d8b9129bb101b24
Reviewed-on: http://review.typo3.org/36445
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index 184eda5..e790986 100644 (file)
@@ -2141,7 +2141,13 @@ class BackendUtility {
                                                        } else {
                                                                $rParts = array();
                                                                if ($uid && isset($theColConf['foreign_field']) && $theColConf['foreign_field'] !== '') {
-                                                                       $records = self::getRecordsByField($theColConf['foreign_table'], $theColConf['foreign_field'], $uid);
+                                                                       $whereClause = '';
+                                                                       // Add additional where clause if foreign_match_fields are defined
+                                                                       $foreignMatchFields = is_array($theColConf['foreign_match_fields']) ? $theColConf['foreign_match_fields'] : array();
+                                                                       foreach ($foreignMatchFields as $matchField => $matchValue) {
+                                                                               $whereClause .= ' AND ' . $matchField . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($matchValue, $theColConf['foreign_table']);
+                                                                       }
+                                                                       $records = self::getRecordsByField($theColConf['foreign_table'], $theColConf['foreign_field'], $uid, $whereClause);
                                                                        if (!empty($records)) {
                                                                                foreach ($records as $record) {
                                                                                        $rParts[] = $record['uid'];