Index: t3lib/class.t3lib_tcemain.php =================================================================== --- t3lib/class.t3lib_tcemain.php (revision 3851) +++ t3lib/class.t3lib_tcemain.php (working copy) @@ -695,12 +695,12 @@ if ($OK) { $sortRow = $TCA[$table]['ctrl']['sortby']; if ($pid_value>=0) { // Points to a page on which to insert the element, possibly in the top of the page - if ($sortRow) { // If this table is sorted we better find the top sorting number + if ($sortRow && !$incomingFieldArray[$sortRow]) { // If this table is sorted we better find the top sorting number $fieldArray[$sortRow] = $this->getSortNumber($table,0,$pid_value); } $fieldArray['pid'] = $pid_value; // The numerical pid is inserted in the data array } else { // points to another record before ifself - if ($sortRow) { // If this table is sorted we better find the top sorting number + if ($sortRow && !$incomingFieldArray[$sortRow]) { // If this table is sorted we better find the top sorting number $tempArray=$this->getSortNumber($table,0,$pid_value); // Because $pid_value is < 0, getSortNumber returns an array $fieldArray['pid'] = $tempArray['pid']; $fieldArray[$sortRow] = $tempArray['sortNumber'];