Fixed hanging recordset in t3lib_TCEmain::getSortNumber
authorOliver Hader <oliver.hader@typo3.org>
Fri, 21 Dec 2007 16:38:55 +0000 (16:38 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Fri, 21 Dec 2007 16:38:55 +0000 (16:38 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2856 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tcemain.php

index 205caf6..d85c790 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2007-12-21  Oliver Hader  <oh@inpublica.de>
 
        * (minor) Fixed bug #6007: IRRE - Child records with image fields are not shown in m:n disposal
+       * (minor) Fixed hanging recordset in t3lib_TCEmain::getSortNumber
 
 2007-12-20     Thomas Hempel  <thomas@typo3-unleashed.net>
 
index 137b615..462263f 100755 (executable)
@@ -5597,18 +5597,18 @@ $this->log($table,$id,6,0,0,'Stage raised...',30,array('comment'=>$comment,'stag
                                                $row =  $lookForLiveVersion;
                                        }
 
-                                               // If the record happends to be it self
+                                               // If the record should be inserted after itself, keep the current sorting information:
                                        if ($row['uid']==$uid)  {
                                                $sortNumber = $row[$sortRow];
                                        } else {
                                                $subres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                                                                               $sortRow.',pid,uid',
-                                                                               $table,
-                                                                               'pid='.intval($row['pid']).' AND '.$sortRow.'>='.intval($row[$sortRow]).$this->deleteClause($table),
-                                                                               '',
-                                                                               $sortRow.' ASC',
-                                                                               '2'
-                                                                       );              // Fetches the next record in order to calculate the in between sortNumber
+                                                       $sortRow.',pid,uid',
+                                                       $table,
+                                                       'pid='.intval($row['pid']).' AND '.$sortRow.'>='.intval($row[$sortRow]).$this->deleteClause($table),
+                                                       '',
+                                                       $sortRow.' ASC',
+                                                       '2'
+                                               );              // Fetches the next record in order to calculate the in-between sortNumber
                                                if ($GLOBALS['TYPO3_DB']->sql_num_rows($subres)==2)     {       // There was a record afterwards
                                                        $GLOBALS['TYPO3_DB']->sql_fetch_assoc($subres);                         // Forward to the second result...
                                                        $subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($subres);       // There was a record afterwards
@@ -5619,6 +5619,7 @@ $this->log($table,$id,6,0,0,'Stage raised...',30,array('comment'=>$comment,'stag
                                                } else {        // If after the last record in the list, we just add the sortInterval to the last sortvalue
                                                        $sortNumber = $row[$sortRow]+$this->sortIntervals;
                                                }
+                                               $GLOBALS['TYPO3_DB']->sql_free_result($subres);
                                        }
                                        return Array('pid' => $row['pid'], 'sortNumber' => $sortNumber);
                                } else {