Skip to content

Commit 2f28578

Browse files
committed
[BUGFIX] copy container
Fixes: #614 Relates to: #610
1 parent 1fce97b commit 2f28578

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

Classes/Hooks/Datahandler/CommandMapPostProcessingHook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ protected function copyOrMoveChildren(int $origUid, int $newId, int $containerId
151151
if (!isset($origCmdMap['tt_content'][$origUid][$command]['update']['sys_language_uid'])) {
152152
continue;
153153
}
154-
if ($origCmdMap['tt_content'][$origUid][$command]['update']['sys_language_uid'] === $record['sys_language_uid']) {
154+
if ((int)$origCmdMap['tt_content'][$origUid][$command]['update']['sys_language_uid'] === $record['sys_language_uid']) {
155155
continue;
156156
}
157157
$target = -$record['uid'];

Tests/Functional/Datahandler/DefaultLanguage/ContainerTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,4 +367,29 @@ public function copyContainerWithDataHandlerLoggingDisabled(): void
367367
$dataHandler->process_cmdmap();
368368
self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerWithDataHandlerLoggingDisabledSysLogResult.csv');
369369
}
370+
371+
/**
372+
* @test
373+
*/
374+
public function copyContainerWithLanguageAsStringKeepsCopiedChildrenSorting(): void
375+
{
376+
$this->importCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerKeepsSortingOfChildren.csv');
377+
$cmdmap = [
378+
'tt_content' => [
379+
1 => [
380+
'copy' => [
381+
'action' => 'paste',
382+
'target' => 3,
383+
'update' => [
384+
'colPos' => 0,
385+
'sys_language_uid' => '0',
386+
],
387+
],
388+
],
389+
],
390+
];
391+
$this->dataHandler->start([], $cmdmap, $this->backendUser);
392+
$this->dataHandler->process_cmdmap();
393+
self::assertCSVDataSet(__DIR__ . '/Fixtures/Container/CopyContainerKeepsSortingOfChildrenResult.csv');
394+
}
370395
}

0 commit comments

Comments
 (0)