Bug #92198

Updated by Jo Hasenau about 1 year ago

Marked for CMS 11 - but happens in any supported version as well. 

 If translations have been done in the so called "free mode" aka "copy mode", you can move around the translated elements after the actual localize actions. 

 If you move those elements    to another page now, they still point to the record of the default language via the field configured as "translationSource". 

 Unfortunately this information will again be used for upcoming localize actions, since the destination PID will be either a real PID or a negative value pointing to a record after which to position the translation copy. 

 This will lead to problems in lines 7249 to 7255 of \TYPO3\CMS\Core\DataHandling\DataHandler 

 <pre><code class="php"> 
 // If there is an element, find its localized record in specified localization language 
 if ($previousRow = $queryBuilder->execute()->fetch()) { 
     $previousLocalizedRecord = BackendUtility::getRecordLocalization($table, $previousRow['uid'], $language); 
     if (is_array($previousLocalizedRecord[0])) { 
         $previousLocalizedRecordUid = $previousLocalizedRecord[0]['uid']; 
     } 
 } 
 </code></pre> 

 *BackendUtility::getRecordLocalization* will just use the UID of the record but not check the PID, so it might return a record from a different page based on the translationSource field. 
 Now this will lead to a wrong PID for each of the following records, since they will be copied "after" the first one with the wrong PID. 

 The result is a mixed up set of elements with different PID values which actually should be on the same page after the localize action. 

 Of course they could be moved around in free mode after that action, but for the actual localization only records from the same PID should be taken into account. 

 People noticed that behaviour when dealing with nested Gridelements structures, but even without any additional Gridelements methods activated the problem stayed the same. 
 Should be similar with any other localize action that involves translated elements which have been moved to another page before. 
 

Back