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:
@@ -60,3 +60,4 @@ PriceRemoved=Price removed
|
||||
BarCode=Barcode
|
||||
Pack=Pack
|
||||
Packs=Packs
|
||||
NoteNotVisibleOnBill=Note (not visible on invoices, proposals...)
|
||||
@@ -75,3 +75,4 @@ PriceRemoved=Prix supprim
|
||||
BarCode=Code barre
|
||||
Pack=Lot
|
||||
Packs=Lots
|
||||
NoteNotVisibleOnBill=Note (non visible sur les factures, propals...)
|
||||
@@ -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,8 +400,9 @@ class Product
|
||||
*/
|
||||
function fetch ($id)
|
||||
{
|
||||
$sql = "SELECT rowid, ref, label, description, price, tva_tx, envente, nbvente, fk_product_type, duration, seuil_stock_alerte";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product WHERE rowid = $id";
|
||||
$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"];
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user