[BUGFIX] Nested IRRE elements are not removed
authorOliver Hader <oliver@typo3.org>
Tue, 6 Mar 2012 22:14:54 +0000 (23:14 +0100)
committerOliver Hader <oliver@typo3.org>
Mon, 12 Mar 2012 16:06:19 +0000 (17:06 +0100)
Imagine a nested IRRE structure like Hotel->Offer->Price (taken
form EXT:irre_tutorial) in the live workspace. Now the whole
structure from the parent record including all child records is
deleted on a custom workspace. Publishing the delete placeholders
does not work for child records, only the parent gets removed and
the children stay...

Since the parent record gets processed first, the "delete" action
during publishing is forwared to all child records, but without
the accordant publishing context. Thus, for removals it is now to
be checked whether the record is marked to be removed and would
be processed in the same publishing request, but just later.

Change-Id: If5741f5354507938eb4ddbe2015112acc47bccce
Fixes: #34556
Releases: 4.5, 4.6, 4.7
Reviewed-on: http://review.typo3.org/9447
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/version/class.tx_version_tcemain.php

index f148593..f383db3 100644 (file)
@@ -216,6 +216,17 @@ class tx_version_tcemain {
                                        if ($tcemainObj->BE_USER->workspace == 0 || (int) $record['t3ver_wsid'] == $tcemainObj->BE_USER->workspace) {
                                                $liveRec = t3lib_BEfunc::getLiveVersionOfRecord($table, $id, 'uid,t3ver_state');
 
+                                                       // Processing can be skipped if a delete placeholder shall be swapped/published
+                                                       // during the current request. Thus it will be deleted later on...
+                                               if ($record['t3ver_state'] == 2 && !empty($liveRec['uid'])
+                                                       && !empty($tcemainObj->cmdmap[$table][$liveRec['uid']]['version']['action'])
+                                                       && !empty($tcemainObj->cmdmap[$table][$liveRec['uid']]['version']['swapWith'])
+                                                       && $tcemainObj->cmdmap[$table][$liveRec['uid']]['version']['action'] === 'swap'
+                                                       && $tcemainObj->cmdmap[$table][$liveRec['uid']]['version']['swapWith'] == $id) {
+
+                                                       return NULL;
+                                               }
+
                                                        // Delete those in WS 0 + if their live records state was not "Placeholder".
                                                if ($record['t3ver_wsid']==0 || (int) $liveRec['t3ver_state'] <= 0) {
                                                        $tcemainObj->deleteEl($table, $id);