This commit is contained in:
Rodolphe Quiedeville 2006-12-04 11:42:28 +00:00
parent ad6678a869
commit 291ebde9d7

View File

@ -44,15 +44,19 @@ class Product
var $ref; var $ref;
var $libelle; var $libelle;
var $description; var $description;
//! Prix de vente
var $price; var $price;
var $multiprices=array(); var $multiprices=array();
//! Taux de TVA
var $tva_tx; var $tva_tx;
//! Type 0 pour produit, 1 pour service
var $type; var $type;
var $seuil_stock_alerte; var $seuil_stock_alerte;
//! Duree de validite du service //! Duree de validite du service
var $duration_value; var $duration_value;
//! Unite de duree //! Unite de duree
var $duration_unit; var $duration_unit;
// Statut indique si le produit est en vente '1' ou non '0'
var $status; var $status;
var $stats_propale=array(); var $stats_propale=array();
@ -85,13 +89,10 @@ class Product
$this->typeprodser[1]=$langs->trans("Service"); $this->typeprodser[1]=$langs->trans("Service");
$this->canvas = ''; $this->canvas = '';
} }
/** /**
* \brief Vérifie que la référence et libellé du produit est non null * \brief Vérifie que la référence et libellé du produit est non null
* \return int 1 si ok, 0 sinon * \return int 1 si ok, 0 sinon
*/ */
function check() function check()
{ {
$this->ref = ereg_replace("'","",stripslashes($this->ref)); $this->ref = ereg_replace("'","",stripslashes($this->ref));
@ -113,8 +114,6 @@ class Product
return 1; return 1;
} }
} }
/** /**
* \brief Insère le produit en base * \brief Insère le produit en base
* \param user Utilisateur qui effectue l'insertion * \param user Utilisateur qui effectue l'insertion
@ -147,10 +146,10 @@ class Product
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product "; $sql = "INSERT INTO ".MAIN_DB_PREFIX."product ";
$sql.= " (datec, "; $sql.= " (datec, ";
if ($this->ref) $sql.= "ref, "; if ($this->ref) $sql.= "ref, ";
$sql.= "fk_user_author, fk_product_type, price)"; $sql.= "fk_user_author, fk_product_type, price, canvas)";
$sql.= " VALUES (now(), "; $sql.= " VALUES (now(), ";
if ($this->ref) $sql.= "'".$this->ref."', "; if ($this->ref) $sql.= "'".$this->ref."', ";
$sql.= $user->id.", ".$this->type.", '" . $this->price . "')"; $sql.= $user->id.", ".$this->type.", '" . $this->price . "','".$this->canvas."')";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
@ -201,8 +200,6 @@ class Product
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
/** /**
* \brief Mise à jour du produit en base * \brief Mise à jour du produit en base
* \param id id du produit * \param id id du produit
@ -816,7 +813,7 @@ class Product
$this->seuil_stock_alerte = $result["seuil_stock_alerte"]; $this->seuil_stock_alerte = $result["seuil_stock_alerte"];
$this->canvas = $result["canvas"]; $this->canvas = $result["canvas"];
$this->stock_in_command = $result["stock_in_command"]; $this->stock_in_command = $result["stock_commande"];
$this->label_url = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$this->id.'">'.$this->libelle.'</a>'; $this->label_url = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$this->id.'">'.$this->libelle.'</a>';