Fix bugs reported by scrutinizer

This commit is contained in:
Laurent Destailleur 2016-12-07 19:12:25 +01:00
parent 1838670e31
commit 49f5ec6b52
3 changed files with 7 additions and 5 deletions

View File

@ -153,6 +153,7 @@ class Invoices extends DolibarrApi
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$i=0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
while ($i < min($num, ($limit <= 0 ? $num : $limit))) while ($i < min($num, ($limit <= 0 ? $num : $limit)))
{ {
@ -177,7 +178,7 @@ class Invoices extends DolibarrApi
* Create invoice object * Create invoice object
* *
* @param array $request_data Request datas * @param array $request_data Request datas
* @return int ID of invoice * @return int ID of invoice
*/ */
function post($request_data = NULL) function post($request_data = NULL)
{ {
@ -278,7 +279,7 @@ class Invoices extends DolibarrApi
/** /**
* Validate fields before create or update object * Validate fields before create or update object
* *
* @param array $data Datas to validate * @param array|null $data Datas to validate
* @return array * @return array
* *
* @throws RestException * @throws RestException
@ -293,4 +294,5 @@ class Invoices extends DolibarrApi
} }
return $invoice; return $invoice;
} }
} }

View File

@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
use Luracast\Restler\RestException; use Luracast\Restler\RestException;
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
/** /**
* API class for supplier invoices * API class for supplier invoices
@ -153,6 +153,7 @@ class SupplierInvoices extends DolibarrApi
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$i = 0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
while ($i < min($num, ($limit <= 0 ? $num : $limit))) while ($i < min($num, ($limit <= 0 ? $num : $limit)))
{ {

View File

@ -326,7 +326,6 @@ class FactureFournisseur extends CommonInvoice
{ {
$idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det'); $idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det');
var_dump($this->lines[$i]);exit;
$this->updateline( $this->updateline(
$idligne, $idligne,
$this->lines[$i]->description, $this->lines[$i]->description,