From 7e5309d99af4745a1710e127a2266a75802cd501 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 12 Feb 2006 11:57:39 +0000 Subject: [PATCH] modification de la description produit --- htdocs/compta/facture.php | 2 +- htdocs/propal.class.php | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 7163e1e779f..8d5e313298f 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -860,7 +860,7 @@ if ($_GET['action'] == 'create') print $objp->product?' - '.$objp->product:''; print "\n"; print ''; - print dolibarr_trunc($objp->description,60); + print stripslashes(nl2br(dolibarr_trunc($objp->description,60))); print ''; print ''.$objp->tva_tx.'%'; print ''.price($objp->price).''; diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 8dca46e2b28..47788ea791e 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -210,8 +210,9 @@ class Propal * \return int >0 si ok, <0 si ko * \see add_product */ - function insert_product_generic($p_desc, $p_price, $p_qty, $p_tva_tx, $remise_percent=0) + function insert_product_generic($p_desc, $p_product_desc, $p_price, $p_qty, $p_tva_tx, $remise_percent=0) { + global $conf; dolibarr_syslog("propal.class.php::insert_product_generic $p_desc, $p_price, $p_qty, $p_tva_tx, $remise_percent"); if ($this->statut == 0) { @@ -229,9 +230,17 @@ class Propal $remise = round(($p_price * $remise_percent / 100), 2); $price = $p_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.", 0,'". $p_qty."','". price2num($price)."','".$p_tva_tx."','".addslashes($p_desc)."','$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.", 0,'". $p_qty."','". price2num($price)."','".$p_tva_tx."','".addslashes($p_product_desc)."','$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.", 0,'". $p_qty."','". price2num($price)."','".$p_tva_tx."','".addslashes($p_desc)."','$remise_percent', '".price2num($subprice)."') ; "; + } if ($this->db->query($sql) ) {