[BUGFIX] Consider `translationSource` for fetching localized records 94/56894/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 9 May 2018 08:07:03 +0000 (10:07 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Thu, 10 May 2018 13:25:13 +0000 (15:25 +0200)
Using `transOrigPointerField` to fetch localized records does not work
for records that were copied into a different language via DataHandler's
`copyLanguage` command.

`BackendUtility::getRecordLocalization()` now takes `translationSource`
into consideration to fetch the appropriate localization of a record.

Resolves: #84951
Releases: master, 8.7
Change-Id: I8fc9ea3c1fdaf3e54110196c6a27411e0c66b366
Reviewed-on: https://review.typo3.org/56894
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Tests/Functional/Controller/Page/LocalizationControllerTest.php

index 7cf227b..90cffa2 100644 (file)
@@ -322,7 +322,7 @@ class BackendUtility
                 ->from($table)
                 ->where(
                     $queryBuilder->expr()->eq(
-                        $tcaCtrl['transOrigPointerField'],
+                        $tcaCtrl['translationSource'] ?? $tcaCtrl['transOrigPointerField'],
                         $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)
                     ),
                     $queryBuilder->expr()->eq(
index 640db39..7be2bdf 100644 (file)
@@ -351,13 +351,13 @@ class LocalizationControllerTest extends \TYPO3\TestingFramework\Core\Functional
                 'pid' => 1,
                 'sys_language_uid' => 1,
                 'l18n_parent' => 0,
-                'header' => '[Translate to Dansk:] Test content 2.5',
+                'header' => '[Translate to Dansk:] Test content 2',
             ],
             [
                 'pid' => 1,
                 'sys_language_uid' => 1,
                 'l18n_parent' => 0,
-                'header' => '[Translate to Dansk:] Test content 2',
+                'header' => '[Translate to Dansk:] Test content 2.5',
             ],
             [
                 'pid' => 1,