Merge pull request #18475 from OPEN-DSI/v14-fix-invoice-fetch-not-found-syslog-level

FIX invoice fetch not found syslog debug level instead of error
This commit is contained in:
Laurent Destailleur 2021-08-28 20:12:45 +02:00 committed by GitHub
commit 8870662200
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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,16 @@ 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_WARNING);
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();
return -1; return -1;
} }
} }