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

ChangeLog
t3lib/class.t3lib_tcemain.php

index e50e71b..16aa317 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-06  Francois Suter  <francois@typo3.org>
+
+       * Fixed bug #14005: Moving a page with IRRE records misplaces IRRE records
+
 2010-04-11  Patrick Broens  <patrick@patrickbroens.nl>
 
        * Added feature #14064: Install tool refactoring
index 2d817ba..325b923 100644 (file)
@@ -3798,11 +3798,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']);
 
@@ -3810,18 +3810,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);
                        }
                }
        }