FIX #9837 - The fetchAllXXX was not managing correctly the limit

This commit is contained in:
Laurent Destailleur 2018-10-24 02:20:07 +02:00
parent 83dacf6290
commit 065d715d41

View File

@ -785,7 +785,8 @@ class BookKeeping extends CommonObject
if ($resql) {
$num = $this->db->num_rows($resql);
while ( $obj = $this->db->fetch_object($resql) ) {
$i = 0;
while ($obj = $this->db->fetch_object($resql) && (empty($limit) || $i < min($limit, $num))) {
$line = new BookKeepingLine();
$line->id = $obj->rowid;
@ -817,6 +818,8 @@ class BookKeeping extends CommonObject
$line->date_creation = $obj->date_creation;
$this->lines[] = $line;
$i++;
}
$this->db->free($resql);
@ -914,7 +917,8 @@ class BookKeeping extends CommonObject
if ($resql) {
$num = $this->db->num_rows($resql);
while ( $obj = $this->db->fetch_object($resql) ) {
$i = 0;
while ($obj = $this->db->fetch_object($resql) && (empty($limit) || $i < min($limit, $num))) {
$line = new BookKeepingLine();
$line->id = $obj->rowid;
@ -943,6 +947,8 @@ class BookKeeping extends CommonObject
$line->date_modification = $this->db->jdate($obj->date_modification);
$this->lines[] = $line;
$i++;
}
$this->db->free($resql);
@ -1021,7 +1027,7 @@ class BookKeeping extends CommonObject
$num = $this->db->num_rows($resql);
$i = 0;
while (($obj = $this->db->fetch_object($resql)) && ($i < min($limit, $num)))
while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num)))
{
$line = new BookKeepingLine();