Fix bookkeeping list was empty
This commit is contained in:
parent
2f2df12f59
commit
84d73086ea
@ -866,14 +866,13 @@ class BookKeeping extends CommonObject
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit Offset limit
|
||||
* @param int $offset Offset limit
|
||||
* @param array $filter Filter array
|
||||
* @param string $filtermode Filter mode (AND or OR)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
|
||||
{
|
||||
@ -932,7 +931,7 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql.= ' WHERE entity IN (' . getEntity('accountancy') . ')';
|
||||
$sql.= ' WHERE t.entity IN (' . getEntity('accountancy') . ')';
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||
}
|
||||
@ -950,7 +949,8 @@ class BookKeeping extends CommonObject
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
while ($obj = $this->db->fetch_object($resql) && (empty($limit) || $i < min($limit, $num))) {
|
||||
while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num)))
|
||||
{
|
||||
$line = new BookKeepingLine();
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
@ -989,8 +989,7 @@ class BookKeeping extends CommonObject
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user