From 39934a9a81607dd8d0760cdf40f544167fc41537 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 23 Oct 2022 11:19:23 +0200 Subject: [PATCH] Fix scrutinizer api_thirdparties.class.php 5 issues --- htdocs/societe/class/api_thirdparties.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 962bbf021b8..b5d9f7bfc48 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1082,7 +1082,7 @@ class Thirdparties extends DolibarrApi $invoice = new Facture($this->db); $result = $invoice->list_replacable_invoices($id); if ($result < 0) { - throw new RestException(405, $this->thirdparty->error); + throw new RestException(405, $invoice->error); } return $result; @@ -1125,7 +1125,7 @@ class Thirdparties extends DolibarrApi $invoice = new Facture($this->db); $result = $invoice->list_qualified_avoir_invoices($id); if ($result < 0) { - throw new RestException(405, $this->thirdparty->error); + throw new RestException(405, $invoice->error); } return $result; @@ -1164,10 +1164,9 @@ class Thirdparties extends DolibarrApi $sql .= " WHERE fk_soc = ".((int) $id); } - $result = $this->db->query($sql); - if ($result->num_rows == 0) { + if ($this->db->num_rows($result) == 0) { throw new RestException(404, 'Account not found'); } @@ -1409,7 +1408,7 @@ class Thirdparties extends DolibarrApi if ($result > 0) { return array("success" => $result); } else { - throw new RestException(500, 'Error generating the document '.$this->error); + throw new RestException(500, 'Error generating the document '.$this->company->error); } }