ajout des attributs grar et desc

This commit is contained in:
bouba 2003-11-20 21:28:17 +00:00
parent 0c2be4b0eb
commit 60da30bd17

View File

@ -26,6 +26,8 @@ class Groupart {
var $id ; var $id ;
var $nom ; var $nom ;
var $desc ;
var $grar ;
Function Groupart($DB, $id=0) { Function Groupart($DB, $id=0) {
$this->db = $DB; $this->db = $DB;
@ -41,7 +43,9 @@ class Groupart {
$sql = "INSERT INTO llx_groupart (fk_user_author) VALUES (".$user->id.")"; $sql = "INSERT INTO llx_groupart (fk_user_author) VALUES (".$user->id.")";
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {
$id = $this->db->last_insert_id(); $id = $this->db->last_insert_id();
if ( $this->update($id, $user) ) if ( $this->update($id, $user) )
@ -65,7 +69,8 @@ class Groupart {
$sql = "UPDATE llx_groupart "; $sql = "UPDATE llx_groupart ";
$sql .= " SET nom = '" . trim($this->nom) ."'"; $sql .= " SET nom = '" . trim($this->nom) ."'";
$sql .= " , description = '" . trim($this->desc) ."'";
$sql .= " , groupart = '" . trim($this->grar) ."'";
$sql .= " WHERE rowid = " . $id; $sql .= " WHERE rowid = " . $id;
if ( $this->db->query($sql) ) { if ( $this->db->query($sql) ) {
@ -81,17 +86,19 @@ class Groupart {
*/ */
Function fetch ($id) { Function fetch ($id) {
$sql = "SELECT rowid, nom FROM llx_groupart WHERE rowid = $id"; $sql = "SELECT rowid, nom, groupart, description FROM llx_groupart WHERE rowid = $id";
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
if ( $result ) { if ( $result ) {
$result = $this->db->fetch_array(); $result = $this->db->fetch_array();
$this->id = $result["rowid"]; $this->id = $result["rowid"];
$this->nom = $result["nom"]; $this->nom = $result["nom"];
$this->desc = $result["description"];
$this->grar = $result["groupart"];
$this->nom_url = '<a href="'.DOL_URL_ROOT.'/product/groupart/fiche.php?id='.$result["rowid"].'">'.$result["nom"].'</a>'; $this->nom_url = '<a href="'.DOL_URL_ROOT.'/product/groupart/fiche.php?id='.$result["rowid"].'">'.$result["nom"].'</a>';
} }
$this->db->free(); $this->db->free();