[BUGFIX] getRecordLocalization() must respect transForeignTable 92/11092/8
authorMartin Tepper <martintepper@arcor.de>
Wed, 9 May 2012 07:36:28 +0000 (09:36 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 18 Jan 2015 22:21:05 +0000 (23:21 +0100)
Function BackendUtility::getRecordLocalization() needs to respect
TCA['ctrl']['transForeignTable'] in order to work with pages table.

Change-Id: I4c1c9f0faf6de499fe094846874848c611af7cdd
Resolves: #36971
Releases: master
Reviewed-on: http://review.typo3.org/11092
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index 241901a..26334bf 100644 (file)
@@ -290,6 +290,12 @@ class BackendUtility {
         */
        static public function getRecordLocalization($table, $uid, $language, $andWhereClause = '') {
                $recordLocalization = FALSE;
+
+               // Check if translations are stored in other table
+               if (isset($GLOBALS['TCA'][$table]['ctrl']['transForeignTable'])) {
+                       $table = $GLOBALS['TCA'][$table]['ctrl']['transForeignTable'];
+               }
+
                if (self::isTableLocalizable($table)) {
                        $tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
                        $recordLocalization = self::getRecordsByField($table, $tcaCtrl['transOrigPointerField'], $uid, 'AND ' . $tcaCtrl['languageField'] . '=' . (int)$language . ($andWhereClause ? ' ' . $andWhereClause : ''), '', '', '1');