* Fixed bug regarding MM-relations to same table in befunc::getProcessedValues
authorChristian Jul Jensen <christian.jensen@typo3.org>
Wed, 21 Dec 2005 22:05:06 +0000 (22:05 +0000)
committerChristian Jul Jensen <christian.jensen@typo3.org>
Wed, 21 Dec 2005 22:05:06 +0000 (22:05 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@921 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_befunc.php

index c765601..a0a8189 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-12-21  Christian Jul Jensen  <julle@typo3.org>
+
+       * Fixed bug regarding MM-relations to same table in befunc::getProcessedValues
+
 2005-12-19  Michael Scharkow <michael@underused.org>
        * Fixed bug #1915: trigger 404 with bogus aliases
 
index 9c232ce..5bc42b4 100755 (executable)
@@ -1844,16 +1844,17 @@ class t3lib_BEfunc      {
                                case 'select':
                                        if ($theColConf['MM'])  {
                                                        // Display the title of MM related records in lists
-                                               $MMres = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
-                                                               $theColConf['foreign_table'].'.'.$TCA[$theColConf['foreign_table']]['ctrl']['label'],
-                                                               $table,
+                                                       $MMfield = $noRecordLookup?'uid':$TCA[$theColConf['foreign_table']]['ctrl']['label'];
+                                                       $MMres = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
+                                                               $theColConf['foreign_table'].'.'.$MMfield,
+                                                               ($table!=$theColConf['foreign_table']?$table:''),
                                                                $theColConf['MM'],
                                                                $theColConf['foreign_table'],
-                                                               'AND '.$table.'.uid ='.intval($uid).t3lib_BEfunc::deleteClause($theColConf['foreign_table'])
+                                                               'AND '.$theColConf['MM'].'.uid_local ='.intval($uid).t3lib_BEfunc::deleteClause($theColConf['foreign_table'])
                                                        );
                                                if ($MMres) {
                                                        while($MMrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($MMres))   {
-                                                               $mmlA[] = $MMrow[$TCA[$theColConf['foreign_table']]['ctrl']['label']];
+                                                               $mmlA[] = $MMrow[$MMfield];
                                                        }
                                                        if (is_array($mmlA)) {
                                                                $l=implode(', ',$mmlA);