diff --git a/Classes/Hooks/Datahandler/DatamapPreProcessFieldArrayHook.php b/Classes/Hooks/Datahandler/DatamapPreProcessFieldArrayHook.php index c0d84669..30fbb5ec 100644 --- a/Classes/Hooks/Datahandler/DatamapPreProcessFieldArrayHook.php +++ b/Classes/Hooks/Datahandler/DatamapPreProcessFieldArrayHook.php @@ -64,6 +64,9 @@ protected function newElementAfterContainer(array $incomingFieldArray): array if ((int)$record['uid'] === (int)($incomingFieldArray['tx_container_parent'] ?? 0)) { return $incomingFieldArray; } + if (($record['l10n_source'] ?? 0) > 0 && (int)$record['l10n_source'] === (int)($incomingFieldArray['tx_container_parent'] ?? 0)) { + return $incomingFieldArray; + } if ((int)($incomingFieldArray['tx_container_parent'] ?? 0) > 0 && (GeneralUtility::makeInstance(DatahandlerProcess::class))->isContainerInProcess((int)$incomingFieldArray['tx_container_parent']) ) { diff --git a/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php b/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php index cbf73dc0..dce9d221 100644 --- a/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php +++ b/Tests/Functional/Datahandler/Localization/CopyToLanguageSortingTest.php @@ -84,4 +84,22 @@ public function localizeChildAfterContainerChild(): void $this->dataHandler->process_cmdmap(); self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeChildAfterContainerChildResult.csv'); } + + /** + * @test + */ + public function localizeWithNestedElements(): void + { + $this->importCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElements.csv'); + $cmdmap = [ + 'tt_content' => [ + 1 => [ + 'copyToLanguage' => 4, + ], + ], + ]; + $this->dataHandler->start([], $cmdmap, $this->backendUser); + $this->dataHandler->process_cmdmap(); + self::assertCSVDataSet(__DIR__ . '/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElementsResult.csv'); + } } diff --git a/Tests/Functional/Datahandler/Localization/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElements.csv b/Tests/Functional/Datahandler/Localization/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElements.csv new file mode 100644 index 00000000..12355e6c --- /dev/null +++ b/Tests/Functional/Datahandler/Localization/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElements.csv @@ -0,0 +1,11 @@ +"tt_content" +,"uid","pid","CType","header","sorting","sys_language_uid","colPos","tx_container_parent","l18n_parent","l10n_source" +,"1","1","b13-2cols-with-header-container","container-1","256","0","0","0","0","0" +,"2","1","b13-2cols-with-header-container","container-2","512","0","201","1","0","0" +,"3","1","header","child-2-1","768","0","201","2","0","0" +,"4","1","header","child-2-2","1024","0","201","2","0","0" +"pages" +,"uid","pid","title","sys_language_uid","l10n_parent" +,"1","0","page-1","0","0" +,"2","0","page-1-language-1","1","1" + diff --git a/Tests/Functional/Datahandler/Localization/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElementsResult.csv b/Tests/Functional/Datahandler/Localization/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElementsResult.csv new file mode 100644 index 00000000..6ad78fb1 --- /dev/null +++ b/Tests/Functional/Datahandler/Localization/Fixtures/CopyToLanguageSorting/LocalizeWithNestedElementsResult.csv @@ -0,0 +1,11 @@ +"tt_content" +,"uid","pid","CType","header","sorting","sys_language_uid","colPos","tx_container_parent","l18n_parent","l10n_source" +,"1","1","b13-2cols-with-header-container","container-1","256","0","0","0","0","0" +,"2","1","b13-2cols-with-header-container","container-2","512","0","201","1","0","0" +,"3","1","header","child-2-1","768","0","201","2","0","0" +,"4","1","header","child-2-2","1024","0","201","2","0","0" +,"5","1","b13-2cols-with-header-container","[Translate to English-Free:] container-1","1280","4","0","0","0","1" +,"6","1","b13-2cols-with-header-container","[Translate to English-Free:] container-2","1536","4","201","5","0","2" +,"8","1","header","[Translate to English-Free:] child-2-1","1664","4","201","6","0","3" +,"7","1","header","[Translate to English-Free:] child-2-2","1792","4","201","6","0","4" +