Index: t3lib/class.t3lib_tcemain.php =================================================================== --- t3lib/class.t3lib_tcemain.php (révision 10411) +++ t3lib/class.t3lib_tcemain.php (copie de travail) @@ -3536,8 +3536,8 @@ $this->moveRecord_procFields($table, $uid, $destPid); // Create query for update: $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($uid), $updateFields); - // check for the localizations of that element - $this->moveL10nOverlayRecords($table, $uid, $destPid); + // Move the localizations of that element just after the element + $this->moveL10nOverlayRecords($table, $uid); // Call post processing hooks: foreach ($hookObjectsArr as $hookObj) { @@ -3559,10 +3559,6 @@ } $this->clear_cache($table, $uid); // clear cache after moving $this->fixUniqueInPid($table, $uid); - // fixCopyAfterDuplFields - if ($origDestPid < 0) { - $this->fixCopyAfterDuplFields($table, $uid, abs($origDestPid), 1); - } // origDestPid is retrieve before it may possibly be converted to resolvePid if the table is not sorted anyway. In this way, copying records to after another records which are not sorted still lets you use this function in order to copy fields from the one before. } else { $destPropArr = $this->getRecordProperties('pages', $destPid); $this->log($table, $uid, 4, 0, 1, "Attempt to move page '%s' (%s) to inside of its own rootline (at page '%s' (%s))", 10, array($propArr['header'], $uid, $destPropArr['header'], $destPid), $propArr['pid']); @@ -3583,8 +3579,8 @@ $this->moveRecord_procFields($table, $uid, $destPid); // Create query for update: $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($uid), $updateFields); - // check for the localizations of that element - $this->moveL10nOverlayRecords($table, $uid, $destPid); + // Move the localizations of that element just after the element + $this->moveL10nOverlayRecords($table, $uid); // Call post processing hooks: foreach ($hookObjectsArr as $hookObj) { @@ -3609,11 +3605,6 @@ // fixUniqueInPid $this->fixUniqueInPid($table, $uid); - - // fixCopyAfterDuplFields - if ($origDestPid < 0) { - $this->fixCopyAfterDuplFields($table, $uid, abs($origDestPid), 1); - } } else { $destPropArr = $this->getRecordProperties('pages', $destPid); $this->log($table, $uid, 4, 0, 1, "Attempt to move page '%s' (%s) to inside of its own rootline (at page '%s' (%s))", 10, array($propArr['header'], $uid, $destPropArr['header'], $destPid), $propArr['pid']); @@ -3694,10 +3685,10 @@ * * @param string $table: Record Table * @param string $uid: Record UID - * @param string $destPid: Position to move to + * @param string $destPid: not used: DEPRECATED as of TYPO3 4.6 * @return void */ - function moveL10nOverlayRecords($table, $uid, $destPid) { + function moveL10nOverlayRecords($table, $uid, $destPid = 0) { //there's no need to perform this for page-records or not localizeable tables if (!t3lib_BEfunc::isTableLocalizable($table) || !empty($GLOBALS['TCA'][$table]['ctrl']['transForeignTable']) || !empty($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) { return; @@ -3707,10 +3698,12 @@ if (isset($GLOBALS['TCA'][$table]['ctrl']['versioningWS'])) { $where = ' AND t3ver_oid=0'; } - $l10nRecords = t3lib_BEfunc::getRecordsByField($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], $uid, $where); + $l10nRecords = t3lib_BEfunc::getRecordsByField($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], $uid, $where, '', !empty($GLOBALS['TCA'][$table]['ctrl']['sortby']) ? $GLOBALS['TCA'][$table]['ctrl']['sortby'] : ''); if (is_array($l10nRecords)) { - foreach ($l10nRecords as $record) { - $this->moveRecord($table, $record['uid'], $destPid); + // Moving records to a positive destination will insert each + // record at the beginning, thus the order is reversed here: + foreach (array_reverse($l10nRecords) as $record) { + $this->moveRecord($table, $record['uid'], -$uid); } } }