[BUGFIX] Flaky child references handling for pages_language_overlay 95/48495/5
authorAndreas Allacher <andreas@allacher.com>
Wed, 8 Jun 2016 05:47:17 +0000 (07:47 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Fri, 2 Dec 2016 16:41:30 +0000 (17:41 +0100)
IRRE records have to point to their specific localized parent record.
This works in general for tables containing records of the default
language as well as localizations. For the "pages" table this look-up
has to be extended to query from "pages_language_overlay".

Change-Id: I84b6ee9304f85222430a5bdf62bd2271aae68fd5
Resolves: #76174
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/48495
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInline.php

index b909a23..2ac0fd3 100644 (file)
@@ -217,8 +217,9 @@ class InlineControlContainer extends AbstractContainer
         $resultArray['inlineData'] = $this->inlineData;
 
         // @todo: It might be a good idea to have something like "isLocalizedRecord" or similar set by a data provider
+        $uidOfDefaultRecord = $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']];
         $isLocalizedParent = $language > 0
-            && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']][0] > 0
+            && ($uidOfDefaultRecord[0] ?? $uidOfDefaultRecord) > 0
             && MathUtility::canBeInterpretedAsInteger($row['uid']);
         $numberOfFullLocalizedChildren = 0;
         $numberOfNotYetLocalizedChildren = 0;
index c9c27a0..fc95703 100644 (file)
@@ -182,9 +182,13 @@ class TcaInline extends AbstractDatabaseRecordProvider implements FormDataProvid
             }
             $result['databaseRow'][$fieldName] = implode(',', $connectedUidsOfLocalizedOverlay);
             if ($result['inlineCompileExistingChildren']) {
+                $tableNameWithDefaultRecords = $result['tableName'];
+                if ($tableNameWithDefaultRecords === 'pages_language_overlay') {
+                    $tableNameWithDefaultRecords = 'pages';
+                }
                 $connectedUidsOfDefaultLanguageRecord = $this->resolveConnectedRecordUids(
                     $result['processedTca']['columns'][$fieldName]['config'],
-                    $result['tableName'],
+                    $tableNameWithDefaultRecords,
                     $result['defaultLanguageRow']['uid'],
                     $result['defaultLanguageRow'][$fieldName]
                 );