[BUGFIX] Allow overlaying of records for all languages again 41/44941/4
authorMathias Schreiber <mathias.schreiber@wmdb.de>
Wed, 25 Nov 2015 15:44:58 +0000 (16:44 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 1 Dec 2015 11:47:51 +0000 (12:47 +0100)
Return records with sys_language_uid=-1 untouched instead of
completely dropping them.

This is actually a problem up higher in the calling stack but
should be fixed properly in the near future.

Resolves: #71621
Releases: master
Change-Id: Ib39f200d4a4cb6ee538f45e0bccca845f10e1e16
Reviewed-on: https://review.typo3.org/44941
Reviewed-by: Joschi Kuphal <joschi@tollwerk.de>
Tested-by: Joerg Kummer <service@enobe.de>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/frontend/Classes/Page/PageRepository.php

index 462ec0c..47b185b 100644 (file)
@@ -472,7 +472,9 @@ class PageRepository
         }
         if ($row['uid'] > 0 && ($row['pid'] > 0 || in_array($table, $this->tableNamesAllowedOnRootLevel, true))) {
             if ($GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) {
-                if (!$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable']) {
+                // Return record for ALL languages untouched
+                // TODO: Fix call stack to prevent this situation in the first place
+                if (!$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'] && (int)$row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] !== -1) {
                     // Will not be able to work with other tables (Just didn't implement it yet;
                     // Requires a scan over all tables [ctrl] part for first FIND the table that
                     // carries localization information for this table (which could even be more
@@ -480,7 +482,7 @@ class PageRepository
                     // takes a little more....) Will try to overlay a record only if the
                     // sys_language_content value is larger than zero.
                     if ($sys_language_content > 0) {
-                        // Must be default language or [All], otherwise no overlaying:
+                        // Must be default language, otherwise no overlaying
                         if ((int)$row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] === 0) {
                             // Select overlay record:
                             $res = $this->getDatabaseConnection()->exec_SELECTquery('*', $table, 'pid=' . (int)$row['pid'] . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '=' . (int)$sys_language_content . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . (int)$row['uid'] . $this->enableFields($table), '', '', '1');