Fixed bug #14005: Moving a page with IRRE records misplaces IRRE records
authorFrancois Suter <francois.suter@typo3.org>
Sun, 11 Apr 2010 16:26:23 +0000 (16:26 +0000)
committerFrancois Suter <francois.suter@typo3.org>
Sun, 11 Apr 2010 16:26:23 +0000 (16:26 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-2@7294 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tcemain.php

index 8500229..8dfee3e 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-11  Francois Suter  <francois@typo3.org>
+
+       * Fixed bug #14005: Moving a page with IRRE records misplaces IRRE records
+
 2010-04-09  Michael Stucki  <michael@typo3.org>
 
        * Fixed bug #13959: Security precaution for extensions which use their own autoloader. Note: This is the same fix which has been committed to TYPO3 4.3 where it is marked as a security fix. However, versions prior to TYPO3 4.3 do not ship with an autoloader, so they are not affected by this problem unless an extension provides its own autoloader.
index 6012f2b..3caa2df 100755 (executable)
@@ -3644,11 +3644,11 @@ class t3lib_TCEmain     {
         * @param       array           $conf: TCA configuration of current field
         * @return      void
         */
-       function moveRecord_procBasedOnFieldType($table,$uid,$destPid,$field,$value,$conf) {
+       function moveRecord_procBasedOnFieldType($table, $uid, $destPid, $field, $value, $conf) {
                $moveTable = '';
                $moveIds = array();
 
-               if ($conf['type'] == 'inline')  {
+               if ($conf['type'] == 'inline') {
                        $foreign_table = $conf['foreign_table'];
                        $moveChildrenWithParent = (!isset($conf['behaviour']['disableMovingChildrenWithParent']) || !$conf['behaviour']['disableMovingChildrenWithParent']);
 
@@ -3656,18 +3656,23 @@ class t3lib_TCEmain     {
                                $inlineType = $this->getInlineFieldType($conf);
                                if ($inlineType == 'list' || $inlineType == 'field') {
                                        $moveTable = $foreign_table;
+                                       if ($table == 'pages') {
+                                                       // If the inline elements are related to a page record,
+                                                       // make sure they reside at that page and not at its parent
+                                               $destPid = $uid;
+                                       }
                                        $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
                                        $dbAnalysis->start($value, $conf['foreign_table'], '', $uid, $table, $conf);
                                }
                        }
                }
 
-                       // move the records
+                       // Move the records
                if (isset($dbAnalysis)) {
                                // Moving records to a positive destination will insert each
                                // record at the beginning, thus the order is reversed here:
                        foreach (array_reverse($dbAnalysis->itemArray) as $v) {
-                               $this->moveRecord($v['table'],$v['id'],$destPid);
+                               $this->moveRecord($v['table'], $v['id'], $destPid);
                        }
                }
        }