Merge pull request #10667 from frederic34/patch-24

Update api_contacts.class.php
This commit is contained in:
Laurent Destailleur 2019-02-24 20:35:51 +01:00 committed by GitHub
commit 9a8be2da9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> /* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -177,16 +178,17 @@ class Contacts extends DolibarrApi
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit)); $min = min($num, ($limit <= 0 ? $num : $limit));
$i = 0;
while ($i < $min) while ($i < $min)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$contact_static = new Contact($db); $contact_static = new Contact($db);
if ($contact_static->fetch($obj->rowid)) if ($contact_static->fetch($obj->rowid))
{ {
if ($includecount) if ($includecount)
{ {
$contact_static->load_ref_elements(); $contact_static->load_ref_elements();
} }
$obj_ret[] = $this->_cleanObjectDatas($contact_static); $obj_ret[] = $this->_cleanObjectDatas($contact_static);
} }