diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 45a78d2914d..4c217f8b0ef 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1589,16 +1589,17 @@ class FichinterLigne extends CommonObjectLine */ public function fetch($rowid) { + dol_syslog("FichinterLigne::fetch", LOG_DEBUG); + $sql = 'SELECT ft.rowid, ft.fk_fichinter, ft.description, ft.duree, ft.rang, ft.date'; $sql .= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; $sql .= ' WHERE ft.rowid = '.((int) $rowid); - dol_syslog("FichinterLigne::fetch", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - $objp = $this->db->fetch_object($result); + $resql = $this->db->query($sql); + if ($resql) { + $objp = $this->db->fetch_object($resql); $this->rowid = $objp->rowid; - $this->id = $objp->rowid; + $this->id = $objp->rowid; $this->fk_fichinter = $objp->fk_fichinter; $this->date = $this->db->jdate($objp->date); $this->datei = $this->db->jdate($objp->date); // For backward compatibility @@ -1606,7 +1607,10 @@ class FichinterLigne extends CommonObjectLine $this->duration = $objp->duree; $this->rang = $objp->rang; - $this->db->free($result); + $this->db->free($resql); + + $this->fetch_optionals(); + return 1; } else { $this->error = $this->db->error().' sql='.$sql; @@ -1623,8 +1627,6 @@ class FichinterLigne extends CommonObjectLine */ public function insert($user, $notrigger = 0) { - global $langs, $conf; - $error = 0; dol_syslog("FichinterLigne::insert rang=".$this->rang); @@ -1714,8 +1716,6 @@ class FichinterLigne extends CommonObjectLine */ public function update($user, $notrigger = 0) { - global $langs, $conf; - $error = 0; if (empty($this->date) && !empty($this->datei)) { // For backward compatibility