Skip to content

Commit

Permalink
Fix: wrong min value
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed May 24, 2017
1 parent 6d4c5e4 commit 659436f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions htdocs/adherents/class/api_members.class.php
Expand Up @@ -106,7 +106,7 @@ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0
$sql.= ' AND t.fk_adherent_type='.$typeid;
}
// Add sql filters
if ($sqlfilters)
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
Expand All @@ -115,7 +115,7 @@ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}

$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
Expand All @@ -132,9 +132,10 @@ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0
{
$i=0;
$num = $db->num_rows($result);
while ($i < min($limit, $num))
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
{
$obj = $db->fetch_object($result);
$obj = $db->fetch_object($result);
$member = new Adherent($this->db);
if($member->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($member);
Expand Down

0 comments on commit 659436f

Please sign in to comment.