[BUGFIX] Failing cascaded delete action of localized elements 42/31142/4
authorOliver Hader <oliver@typo3.org>
Wed, 25 Jun 2014 13:50:02 +0000 (15:50 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Wed, 13 Aug 2014 14:25:38 +0000 (16:25 +0200)
Having a record in live workspace with an accordant localization
leads to the fact that actions to the default language also have
an impact to all localizations.

In a workspace, first deleting the localization, then deleting
the record of the default language, ends up in actually having
reverted the previous deletion of the localization.

The solution is to check for delete placeholders in
DataHandler::deleteL10nOverlayRecords().

Resolves: #59113
Releases: master, 6.2
Change-Id: I888c83a58d591f57bc2ea75a49fa603a56a7f722
Reviewed-on: http://review.typo3.org/31142
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/deleteLocalizedContentNDeleteContent.csv
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Publish/ActionTest.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Publish/DataSet/deleteLocalizedContentNDeleteContent.csv
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/PublishAll/DataSet/deleteLocalizedContentNDeleteContent.csv

index 6d469cf..7a1f3cf 100644 (file)
@@ -4720,6 +4720,14 @@ class DataHandler {
                $l10nRecords = BackendUtility::getRecordsByField($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], $uid, $where);
                if (is_array($l10nRecords)) {
                        foreach ($l10nRecords as $record) {
+                               // Ignore workspace delete placeholders. Those records have been marked for
+                               // deletion before - deleting them again in a workspace would revert that state.
+                               if ($this->BE_USER->workspace > 0 && BackendUtility::isTableWorkspaceEnabled($table)) {
+                                       BackendUtility::workspaceOL($table, $record);
+                                       if (VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
+                                               continue;
+                                       }
+                               }
                                $this->deleteAction($table, (int)$record['t3ver_oid'] > 0 ? (int)$record['t3ver_oid'] : (int)$record['uid']);
                        }
                }
index 58d9e0a..2bc857d 100644 (file)
@@ -5,5 +5,5 @@ tt_content
 ,299,89,768,0,0,0,0,0,0,0,0,"Regular Element #3"
 ,300,89,1024,0,1,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3"
 ,301,-1,512,0,0,0,2,2,0,298,0,"Regular Element #2"
-,302,-1,1000000000,1,1,299,1,2,0,300,0,"[Translate to Dansk:] Regular Element #3"
+,302,-1,1024,0,1,299,1,2,0,300,0,"[Translate to Dansk:] Regular Element #3"
 ,303,-1,768,0,0,0,1,2,0,299,0,"Regular Element #3"
index 3935127..08e5013 100644 (file)
@@ -116,7 +116,6 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Reg
         * @see DataSet/deleteLocalizedContentNDeleteContent.csv
         */
        public function deleteLocalizedContentAndDeleteContent() {
-               $this->markTestSkipped('see http://forge.typo3.org/issues/59113');
                parent::deleteLocalizedContentAndDeleteContent();
                $this->actionService->publishRecords(
                        array(
index 350a4b7..2ca781a 100644 (file)
@@ -3,8 +3,7 @@ tt_content
 ,297,89,256,0,0,0,0,0,0,0,0,"Regular Element #1"
 ,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2"
 ,299,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #3"
-,300,89,1024,0,1,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3"
+,300,89,1000000000,1,1,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3"
 ,301,-1,512,0,0,0,2,2,0,298,0,"Regular Element #2"
-,302,-1,1000000000,1,1,299,1,2,0,300,0,"[Translate to Dansk:] Regular Element #3"
+,302,-1,1000000000,1,1,299,0,0,0,300,0,"[Translate to Dansk:] Regular Element #3"
 ,303,-1,1000000000,1,0,0,0,0,0,299,0,"Regular Element #3"
-,304,-1,1024,0,1,299,1,2,0,300,0,"[Translate to Dansk:] Regular Element #3"
index 350a4b7..2ca781a 100644 (file)
@@ -3,8 +3,7 @@ tt_content
 ,297,89,256,0,0,0,0,0,0,0,0,"Regular Element #1"
 ,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2"
 ,299,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #3"
-,300,89,1024,0,1,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3"
+,300,89,1000000000,1,1,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3"
 ,301,-1,512,0,0,0,2,2,0,298,0,"Regular Element #2"
-,302,-1,1000000000,1,1,299,1,2,0,300,0,"[Translate to Dansk:] Regular Element #3"
+,302,-1,1000000000,1,1,299,0,0,0,300,0,"[Translate to Dansk:] Regular Element #3"
 ,303,-1,1000000000,1,0,0,0,0,0,299,0,"Regular Element #3"
-,304,-1,1024,0,1,299,1,2,0,300,0,"[Translate to Dansk:] Regular Element #3"