From aa14cefed113bdb0f6972ee558f68c7bb849915c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 12 Feb 2006 12:08:04 +0000 Subject: [PATCH] modification de la description produit --- htdocs/comm/propal.php | 2 +- htdocs/propal.class.php | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 9d7158b0fd4..8e6c7d25b3a 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -318,7 +318,7 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer) $_POST['idprod'], $_POST['qty'], $_POST['remise'], - $_POST['np_desc']), + $_POST['np_desc'], $_POST['np_product_desc']); } propale_pdf_create($db, $_POST['propalid'], $propal->modelpdf); diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 47788ea791e..f106bb7a3b7 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -132,7 +132,7 @@ class Propal * \return int >0 si ok, <0 si ko * \see add_product */ - function insert_product($idproduct, $qty, $remise_percent=0, $p_desc='') + function insert_product($idproduct, $qty, $remise_percent=0, $p_desc='', $p_product_desc) { global $conf; dolibarr_syslog("propal.class.php::insert_product $idproduct, $qty, $remise_percent, $p_desc"); @@ -171,9 +171,17 @@ class Propal $remise = round(($prod->price * $remise_percent / 100), 2); $price = $prod->price - $remise; } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."propaldet (fk_propal, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES "; - $sql .= " (".$this->id.",". $idproduct.",'". $qty."','". $price."','".$txtva."','".addslashes($p_desc?$p_desc:$prod->label)."','".price2num($remise_percent)."','".price2num($subprice)."')"; + + if ($conf->global->CHANGE_PROD_DESC) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."propaldet (fk_propal, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES "; + $sql .= " (".$this->id.",". $idproduct.",'". $qty."','". $price."','".$txtva."','".addslashes($prod->product_desc)."','".price2num($remise_percent)."','".price2num($subprice)."')"; + } + else + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."propaldet (fk_propal, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES "; + $sql .= " (".$this->id.",". $idproduct.",'". $qty."','". $price."','".$txtva."','".addslashes($p_desc?$p_desc:$prod->label)."','".price2num($remise_percent)."','".price2num($subprice)."')"; + } if ($this->db->query($sql) ) {