From 4efe2a0e09f53d03ee1d7d3899e1430e7134842b Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 24 Aug 2021 08:20:40 +0200 Subject: [PATCH] FIX invoice fetch not found syslog debug level instead of error --- htdocs/compta/facture/class/facture.class.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ea41bd4842a..1d68747b1a5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1625,10 +1625,10 @@ class Facture extends CommonInvoice } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - if ($this->db->num_rows($result)) { - $obj = $this->db->fetch_object($result); + $resql = $this->db->query($sql); + if ($resql) { + if ($this->db->num_rows($resql)) { + $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; $this->entity = $obj->entity; @@ -1730,14 +1730,17 @@ class Facture extends CommonInvoice $this->error = $this->db->error(); return -3; } + + $this->db->free($resql); + return 1; } else { - $this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; - dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); + dol_syslog(__METHOD__ . ' Invoice with id=' . $rowid . ' or ref=' . $ref . ' or ref_ext=' . $ref_ext . ' not found', LOG_DEBUG); return 0; } } else { - $this->error = $this->db->error(); + $this->error = $this->db->lasterror(); + dol_syslog(__METHOD__ . ' Error : ' . $this->error, LOG_ERR); return -1; } }