2
0
forked from Wavyzz/dolibarr

Work on inventory module debug

This commit is contained in:
Laurent Destailleur
2017-05-06 22:28:07 +02:00
parent f4447f9c87
commit 46ff62fc87
10 changed files with 79 additions and 57 deletions

View File

@@ -4938,25 +4938,33 @@ abstract class CommonObject
if(!empty($id)) $sql.= ' WHERE rowid = '.$id;
else $sql.= ' WHERE ref = \''.$this->quote($ref).'\'';
$res = $this->db->query($sql);
if($obj = $this->db->fetch_object($res))
if ($res)
{
$this->id = $id;
$this->set_vars_by_db($obj);
$this->datec = $this->db->idate($obj->datec);
$this->tms = $this->db->idate($obj->tms);
return $this->id;
if ($obj = $this->db->fetch_object($res))
{
$this->id = $id;
$this->set_vars_by_db($obj);
$this->datec = $this->db->idate($obj->datec);
$this->tms = $this->db->idate($obj->tms);
return $this->id;
}
else
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
}
}
else
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
}
}
/**

View File

@@ -106,14 +106,12 @@ class CoreObject extends CommonObject
*/
public function fetch($id, $loadChild = true)
{
$res = $this->fetchCommon($id);
if($res>0) {
if ($loadChild) $this->fetchChild();
}
return $res;
}