FIX invoice fetch not found syslog debug level instead of error

This commit is contained in:
lvessiller 2021-08-24 08:20:40 +02:00
parent a6ddc90d5b
commit 4efe2a0e09

View File

@ -1625,10 +1625,10 @@ class Facture extends CommonInvoice
} }
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql); $resql = $this->db->query($sql);
if ($result) { if ($resql) {
if ($this->db->num_rows($result)) { if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->entity = $obj->entity; $this->entity = $obj->entity;
@ -1730,14 +1730,17 @@ class Facture extends CommonInvoice
$this->error = $this->db->error(); $this->error = $this->db->error();
return -3; return -3;
} }
$this->db->free($resql);
return 1; return 1;
} else { } else {
$this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; dol_syslog(__METHOD__ . ' Invoice with id=' . $rowid . ' or ref=' . $ref . ' or ref_ext=' . $ref_ext . ' not found', LOG_DEBUG);
dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
return 0; return 0;
} }
} else { } else {
$this->error = $this->db->error(); $this->error = $this->db->lasterror();
dol_syslog(__METHOD__ . ' Error : ' . $this->error, LOG_ERR);
return -1; return -1;
} }
} }