diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index 09506bfbb286d0b65778013d9947a81c791dde93..f64d834330a417f31e7df26b0734a02e8866b308 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -6060,6 +6060,10 @@ class DataHandler { if ($lookForLiveVersion = BackendUtility::getLiveVersionOfRecord($table, $row['uid'], $sortRow . ',pid,uid')) { $row = $lookForLiveVersion; } + // Fetch move placeholder, since it might point to a new page in the current workspace + if ($movePlaceholder = BackendUtility::getMovePlaceholder($table, $row['uid'], 'uid,pid,' . $sortRow)) { + $row = $movePlaceholder; + } // If the record should be inserted after itself, keep the current sorting information: if ($row['uid'] == $uid) { $sortNumber = $row[$sortRow]; diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts b/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts index 35e76d093f7352c692fa4b9c4a2b81eb8b2c1e3f..4e1ff319b921cf554cd9d1e553d5594fca87db7a 100644 --- a/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts +++ b/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts @@ -26,6 +26,15 @@ page = PAGE page { 10 = CONTENT 10 { + watcher.parentRecordField = __pages + table = pages + select { + orderBy = sorting + pidInList = this + } + } + 20 = CONTENT + 20 { watcher.parentRecordField = __contents table = tt_content select { @@ -103,4 +112,4 @@ page { [globalVar = GP:L = 1] config.sys_language_uid = 1 -[end] \ No newline at end of file +[end] diff --git a/typo3/sysext/version/Classes/Hook/DataHandlerHook.php b/typo3/sysext/version/Classes/Hook/DataHandlerHook.php index 912b69446f448b081e68bd08769e934bc05c3a17..3c7b019e8a3c730c2c3bb4bf6c0c7f0562f2ac04 100644 --- a/typo3/sysext/version/Classes/Hook/DataHandlerHook.php +++ b/typo3/sysext/version/Classes/Hook/DataHandlerHook.php @@ -142,32 +142,6 @@ class DataHandlerHook { } } - /** - * Hook that is called after tcemain made most of its decisions. - * - * NOTE: This fixes an issue related to moving/creating initial-placeholders - if such a new page - * is intended to be place behind a move-placeholder tcemain handles the movement/creation, - * but does not respect the wsPlaceholder, which leads the new page to be located at the old location of the - * page where it was intended to be placed behind. - * - * @param string $command - * @param string $table - * @param integer $id - * @param mixed $value - * @param DataHandler $tcemain - */ - public function processCmdmap_postProcess($command, $table, $id, $value, DataHandler $tcemain) { - if ($command === 'move') { - if ($value < 0) { - $movePlaceHolder = BackendUtility::getMovePlaceholder($table, abs($value), 'uid'); - if ($movePlaceHolder !== FALSE) { - $destPid = -$movePlaceHolder['uid']; - $tcemain->moveRecord_raw($table, $id, $destPid); - } - } - } - } - /** * hook that is called AFTER all commands of the commandmap was * executed diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/AbstractActionTestCase.php b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/AbstractActionTestCase.php index f18135c97ab523f3f2c95ea437b21e5cfd7cd7fe..1729d452c31bcaff3193a29bbfdc71353ed86077 100644 --- a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/AbstractActionTestCase.php +++ b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/AbstractActionTestCase.php @@ -154,7 +154,6 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D * @test */ public function moveContentRecordToDifferentPageAndChangeSorting() { - $this->markTestSkipped('Something seems to be wrong here...'); $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget); $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast); $this->assertAssertionDataSet('moveContentRecordToDifferentPageAndChangeSorting'); @@ -171,7 +170,7 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D * @test */ public function createPageRecord() { - $newTableIds = $this->actionService->createNewRecord(self::TABLE_Page, self::VALUE_PageId, array('title' => 'Testing #1')); + $newTableIds = $this->actionService->createNewRecord(self::TABLE_Page, self::VALUE_PageId, array('title' => 'Testing #1', 'hidden' => 0)); $this->assertAssertionDataSet('createPageRecord'); $newPageId = $newTableIds[self::TABLE_Page][0]; @@ -256,9 +255,31 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, -self::VALUE_PageIdTarget); $this->assertAssertionDataSet('movePageRecordToDifferentPageAndChangeSorting'); - $responseContent = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseContent(); - $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Relations'); - $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2')); + $responseContentPage = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseContent(); + $this->assertResponseContentHasRecords($responseContentPage, self::TABLE_Page, 'title', 'Relations'); + $this->assertResponseContentHasRecords($responseContentPage, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2')); + $responseContentWebsite = $this->getFrontendResponse(self::VALUE_PageIdWebsite, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseContent(); + $this->assertResponseContentStructureHasRecords( + $responseContentWebsite, self::TABLE_Page . ':' . self::VALUE_PageIdWebsite, '__pages', + self::TABLE_Page, 'title', array('Target', 'Relations', 'DataHandlerTest') + ); + } + + /** + * @test + * @see http://forge.typo3.org/issues/33104 + * @see http://forge.typo3.org/issues/55573 + */ + public function movePageRecordToDifferentPageAndCreatePageRecordAfterMovedPageRecord() { + $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageIdTarget, self::VALUE_PageIdWebsite); + $this->actionService->createNewRecord(self::TABLE_Page, -self::VALUE_PageIdTarget, array('title' => 'Testing #1', 'hidden' => 0)); + $this->assertAssertionDataSet('movePageRecordToDifferentPageAndCreatePageRecordAfterMovedPageRecord'); + + $responseContent = $this->getFrontendResponse(self::VALUE_PageIdWebsite, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseContent(); + $this->assertResponseContentStructureHasRecords( + $responseContent, self::TABLE_Page . ':' . self::VALUE_PageIdWebsite, '__pages', + self::TABLE_Page, 'title', array('Target', 'Testing #1', 'DataHandlerTest') + ); } } diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/DataSet/Assertion/movePageRecordToDifferentPageAndChangeSorting.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/DataSet/Assertion/movePageRecordToDifferentPageAndChangeSorting.csv index 1dc21dea6885329cf619e2a5fb51615d3193649f..e47a5fc2311248c22fad57ae37ddee47929abc8c 100644 --- a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/DataSet/Assertion/movePageRecordToDifferentPageAndChangeSorting.csv +++ b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/DataSet/Assertion/movePageRecordToDifferentPageAndChangeSorting.csv @@ -2,7 +2,7 @@ pages ,uid,pid,sorting,deleted,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title ,1,0,256,0,0,0,0,0,0,FunctionalTest ,88,1,256,0,0,0,0,0,0,DataHandlerTest -,89,1,160,0,0,0,0,0,0,Relations +,89,88,256,0,0,0,0,0,0,Relations ,90,88,512,0,0,0,0,0,0,Target ,91,-1,512,0,1,4,0,90,0,Target ,92,1,128,0,1,3,0,0,90,"[MOVE-TO PLACEHOLDER for #90, WS#1]" diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/DataSet/Assertion/movePageRecordToDifferentPageAndCreatePageRecordAfterMovedPageRecord.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/DataSet/Assertion/movePageRecordToDifferentPageAndCreatePageRecordAfterMovedPageRecord.csv new file mode 100644 index 0000000000000000000000000000000000000000..4b88eaa02e12b597718a2acc24c69b7aa523ac0d --- /dev/null +++ b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/DataSet/Assertion/movePageRecordToDifferentPageAndCreatePageRecordAfterMovedPageRecord.csv @@ -0,0 +1,10 @@ +pages +,uid,pid,sorting,deleted,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title +,1,0,256,0,0,0,0,0,0,FunctionalTest +,88,1,256,0,0,0,0,0,0,DataHandlerTest +,89,88,256,0,0,0,0,0,0,Relations +,90,88,512,0,0,0,0,0,0,Target +,91,-1,512,0,1,4,0,90,0,Target +,92,1,128,0,1,3,0,0,90,"[MOVE-TO PLACEHOLDER for #90, WS#1]" +,93,1,192,0,1,1,0,0,0,"Testing #1" +,94,-1,192,0,1,-1,0,93,0,"Testing #1"