[BUGFIX] Localize command must preserve type
authorFrancois Suter <francois@typo3.org>
Thu, 29 Mar 2012 11:16:42 +0000 (13:16 +0200)
committerFrancois Suter <francois@typo3.org>
Mon, 23 Apr 2012 08:10:11 +0000 (10:10 +0200)
When the TCEmain command "localize" is used on a table that has
a type attribute, this type is not copied automatically. This
may lead to a discrepancy between the parent record and its
translations. The type must be copied when localizing.

Change-Id: I6432b11253f97dccee48d26de45861c4f3742aa3
Fixes: #35361
Releases: 6.0, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/10705
Reviewed-by: Francois Suter
Tested-by: Francois Suter
t3lib/class.t3lib_tcemain.php

index e951604..05f830e 100644 (file)
@@ -3861,6 +3861,10 @@ class t3lib_TCEmain {
                                                                                        // Set override values:
                                                                                $overrideValues[$TCA[$Ttable]['ctrl']['languageField']] = $langRec['uid'];
                                                                                $overrideValues[$TCA[$Ttable]['ctrl']['transOrigPointerField']] = $uid;
+                                                                                       // Copy the type (if defined in both tables) from the original record so that translation has same type as original record
+                                                                               if (isset($TCA[$table]['ctrl']['type']) && isset($TCA[$Ttable]['ctrl']['type'])) {
+                                                                                       $overrideValues[$TCA[$Ttable]['ctrl']['type']] = $row[$TCA[$table]['ctrl']['type']];
+                                                                               }
 
                                                                                        // Set exclude Fields:
                                                                                foreach ($TCA[$Ttable]['columns'] as $fN => $fCfg) {