diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 258e79be2c0ded9af1692198462f5e5146ca9893..4a86ba549ae74e6a1268f9aca1dd01a7e5c68413 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -726,6 +726,7 @@ class Product extends CommonObject $sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit); $sql.= ", price_autogen = " . (!$this->price_autogen ? 0 : 1); $sql.= ", fk_price_expression = ".($this->fk_price_expression != 0 ? $this->fk_price_expression : 'NULL'); + $sql.= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL'); $sql.= " WHERE rowid = " . $id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -4113,4 +4114,52 @@ class Product extends CommonObject return $user->rights->service; } } + + /** + * Load information for tab info + * + * @param int $id Id of thirdparty to load + * @return void + */ + function info($id) + { + $sql = "SELECT p.rowid, p.datec as date_creation, p.tms as date_modification,"; + $sql.= " p.fk_user_author, p.fk_user_modif"; + $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as p"; + $sql.= " WHERE p.rowid = ".$id; + + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + + $this->id = $obj->rowid; + + if ($obj->fk_user_author) { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_modif) { + $muser = new User($this->db); + $muser->fetch($obj->fk_user_modif); + $this->user_modification = $muser; + } + + $this->ref = $obj->name; + $this->date_creation = $this->db->jdate($obj->date_creation); + $this->date_modification = $this->db->jdate($obj->date_modification); + } + + $this->db->free($result); + + } + else + { + dol_print_error($this->db); + } + } }