2
0
forked from Wavyzz/dolibarr

New: Ajout d'un champ note sur les produits non destin etre visible sur les factures ou propales.

This commit is contained in:
Laurent Destailleur
2005-08-20 18:25:39 +00:00
parent 1267e3dbd9
commit d0e245c030
5 changed files with 29 additions and 20 deletions

View File

@@ -60,3 +60,4 @@ PriceRemoved=Price removed
BarCode=Barcode
Pack=Pack
Packs=Packs
NoteNotVisibleOnBill=Note (not visible on invoices, proposals...)

View File

@@ -75,3 +75,4 @@ PriceRemoved=Prix supprim
BarCode=Code barre
Pack=Lot
Packs=Lots
NoteNotVisibleOnBill=Note (non visible sur les factures, propals...)

View File

@@ -104,8 +104,12 @@ class Product
function create($user)
{
$this->ref = ereg_replace("'","",stripslashes($this->ref));
$this->ref = ereg_replace("\"","",stripslashes($this->ref));
$this->ref = ereg_replace("'","",$this->ref);
$this->ref = ereg_replace("\"","",$this->ref);
if (strlen($this->tva_tx)==0) $this->tva_tx = 0;
if (strlen($this->price)==0) $this->price = 0;
if (strlen($this->envente)==0) $this->envente = 0;
$this->price = ereg_replace(",",".",$this->price);
dolibarr_syslog("Product::Create ref=".$this->ref." Categorie : ".$this->catid);
@@ -120,12 +124,6 @@ class Product
$row = $this->db->fetch_array($result);
if ($row[0] == 0)
{
if (strlen($this->tva_tx)==0) $this->tva_tx = 0;
if (strlen($this->price)==0) $this->price = 0;
if (strlen($this->envente)==0) $this->envente = 0;
$this->price = ereg_replace(",",".",$this->price);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product ";
$sql .= " (datec, fk_user_author, fk_product_type, price)";
$sql .= " VALUES (now(),".$user->id.",$this->type, '" . $this->price . "')";
@@ -191,12 +189,14 @@ class Product
$langs->load("products");
if (! $this->libelle) $this->libelle = 'LIBELLE MANQUANT';
$this->ref = ereg_replace("\"","",stripslashes($this->ref));
$this->ref = ereg_replace("'","",stripslashes($this->ref));
$this->ref = trim($this->ref);
$this->ref = ereg_replace("\"","",$this->ref);
$this->ref = ereg_replace("'","",$this->ref);
$this->libelle = trim($this->libelle);
$this->description = trim($this->description);
$this->note = trim($this->note);
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
$sql .= " SET label = '" . addslashes($this->libelle) ."'";
@@ -205,6 +205,7 @@ class Product
$sql .= ",envente = " . $this->envente ;
$sql .= ",seuil_stock_alerte = " . $this->seuil_stock_alerte ;
$sql .= ",description = '" . addslashes($this->description) ."'";
$sql .= ",note = '" . addslashes($this->note) ."'";
$sql .= ",duration = '" . $this->duration_value . $this->duration_unit ."'";
$sql .= " WHERE rowid = " . $id;
@@ -214,11 +215,13 @@ class Product
}
else
{
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref);
return -1;
}
else {
else
{
$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
return -2;
}
@@ -397,7 +400,8 @@ class Product
*/
function fetch ($id)
{
$sql = "SELECT rowid, ref, label, description, price, tva_tx, envente, nbvente, fk_product_type, duration, seuil_stock_alerte";
$sql = "SELECT rowid, ref, label, description, note, price, tva_tx, envente,";
$sql.= " nbvente, fk_product_type, duration, seuil_stock_alerte";
$sql.= " FROM ".MAIN_DB_PREFIX."product WHERE rowid = $id";
$result = $this->db->query($sql) ;
@@ -410,6 +414,7 @@ class Product
$this->ref = $result["ref"];
$this->libelle = stripslashes($result["label"]);
$this->description = stripslashes($result["description"]);
$this->note = stripslashes($result["note"]);
$this->price = $result["price"];
$this->tva_tx = $result["tva_tx"];
$this->type = $result["fk_product_type"];

View File

@@ -419,6 +419,7 @@ alter table llx_product add stock_commande integer default 0;
alter table llx_product add seuil_stock_alerte integer default 0;
update llx_product set ref=substr(label,0,15) where ref is null;
alter table llx_product modify ref varchar(15) UNIQUE NOT NULL;
alter table llx_product add note text after description;
alter table llx_groupart add description text after groupart ;

View File

@@ -26,10 +26,11 @@ create table llx_product
datec datetime,
tms timestamp,
ref varchar(15) UNIQUE NOT NULL,
label varchar(255),
description text,
label varchar(128),
description varchar(255),
note text,
price double,
tva_tx double DEFAULT 19.6,
tva_tx double,
fk_user_author integer,
envente tinyint DEFAULT 1,
nbvente integer DEFAULT 0,