[BUGFIX] Flaky child references handling for pages_language_overlay 59/50859/2
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 17:07:26 +0000 (18:07 +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/50859
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
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 c7a0ff0..81eb3c0 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
+            && (isset($uidOfDefaultRecord[0]) ? $uidOfDefaultRecord[0] : $uidOfDefaultRecord) > 0
             && MathUtility::canBeInterpretedAsInteger($row['uid']);
         $numberOfFullLocalizedChildren = 0;
         $numberOfNotYetLocalizedChildren = 0;
index b282b81..3210f74 100644 (file)
@@ -182,9 +182,13 @@ class TcaInline extends AbstractDatabaseRecordProvider implements FormDataProvid
             }
             $result['databaseRow'][$fieldName] = implode(',', $connectedUidsOfLocalizedOverlay);
             if ($result['inlineCompileExistingChildren']) {
+                $tableNameWithDefaultRecords = $result['tableName'];
+                if (!empty($GLOBALS['TCA'][$tableNameWithDefaultRecords]['ctrl']['transOrigPointerTable'])) {
+                    $tableNameWithDefaultRecords = $GLOBALS['TCA'][$tableNameWithDefaultRecords]['ctrl']['transOrigPointerTable'];
+                }
                 $connectedUidsOfDefaultLanguageRecord = $this->resolveConnectedRecordUids(
                     $result['processedTca']['columns'][$fieldName]['config'],
-                    $result['tableName'],
+                    $tableNameWithDefaultRecords,
                     $result['defaultLanguageRow']['uid'],
                     $result['defaultLanguageRow'][$fieldName]
                 );