2
0
forked from Wavyzz/dolibarr

Fix error management

This commit is contained in:
Laurent Destailleur
2015-03-03 13:29:16 +01:00
parent 73afe1513d
commit e667c3e916

View File

@@ -136,7 +136,7 @@ class Skeleton_Class extends CommonObject
* *
* @param int $id Id object * @param int $id Id object
* @param string $ref Ref * @param string $ref Ref
* @return int <0 if KO, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
function fetch($id,$ref='') function fetch($id,$ref='')
{ {
@@ -154,7 +154,8 @@ class Skeleton_Class extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
if ($this->db->num_rows($resql)) $numrows = $this->db->num_rows($resql);
if ($numrows)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
@@ -165,7 +166,7 @@ class Skeleton_Class extends CommonObject
} }
$this->db->free($resql); $this->db->free($resql);
return 1; return ($numrows?1:0);
} }
else else
{ {