diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index e2119894504..f83bcc02fcd 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -875,7 +875,7 @@ class Form { $sql= "SELECT price, price_ttc, price_base_type "; $sql.= "FROM ".MAIN_DB_PREFIX."product_price "; - $sql.= "WHERE fk_product='".$objp->rowid; + $sql.= "WHERE fk_product='".$objp->rowid."'"; $sql.= " AND price_level=".$price_level; $sql.= " ORDER BY date_price"; $sql.= " DESC limit 1"; @@ -888,19 +888,23 @@ class Form if ($objp2) { if ($objp2->price_base_type == 'HT') - $opt.= price($objp2->price,1).' '.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("HT"); + $opt.= price($objp2->price,1).' '.$conf->monnaie.' '.$langs->trans("HT"); else - $opt.= price($objp2->price_ttc,1).' '.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("TTC"); + $opt.= price($objp2->price_ttc,1).' '.$conf->monnaie.' '.$langs->trans("TTC"); } //si il n'y a pas de prix multiple on prend le prix de base du produit/service else { if ($objp->price_base_type == 'HT') - $opt.= price($objp->price,1).' '.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("HT"); + $opt.= price($objp->price,1).' '.$conf->monnaie.' '.$langs->trans("HT"); else - $opt.= price($objp->price_ttc,1).' '.$langs->trans("Currency".$conf->monnaie).' '.$langs->trans("TTC"); + $opt.= price($objp->price_ttc,1).' '.$conf->monnaie.' '.$langs->trans("TTC"); } } + else + { + dol_print_error($this->db); + } } else { diff --git a/htdocs/product.class.php b/htdocs/product.class.php index 74e886aafc9..4445a6146f8 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -557,7 +557,7 @@ class Product extends CommonObject $sql.= " WHERE fk_product=".$this->id." AND lang='".$value."'"; $result = $this->db->query($sql); - + if ($value == $current_lang) { if ($this->db->num_rows($result)) // si aucune ligne dans la base @@ -594,7 +594,7 @@ class Product extends CommonObject $sql2.= "','".addslashes($this->multilangs["$value"]["description"]); $sql2.= "','".addslashes($this->multilangs["$value"]["note"])."')"; } - + // on ne sauvegarde pas des champs vides if ( $this->multilangs["$value"]["libelle"] || $this->multilangs["$value"]["description"] || $this->multilangs["$value"]["note"] ) if (!$this->db->query($sql2)) return -1; @@ -633,7 +633,7 @@ class Product extends CommonObject $this->libelle = $obj->label; $this->description = $obj->description; $this->note = $obj->note; - + } $this->multilangs["$obj->lang"]["libelle"] = $obj->label; $this->multilangs["$obj->lang"]["description"] = $obj->description; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index f373678b2f4..f53cf804218 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -64,7 +64,7 @@ if ($_POST["action"] == 'update_price' && ! $_POST["cancel"] && ($user->rights-> for($i=1; $i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { - if ($_POST["price_".$i]) + if (isset($_POST["price_".$i])) { $level=$i; $newprice=price2num($_POST["price_".$i],'MU'); @@ -72,6 +72,7 @@ if ($_POST["action"] == 'update_price' && ! $_POST["cancel"] && ($user->rights-> $newpricebase=$_POST["multiprices_base_type_".$i]; $newnpr=(eregi('\*',$_POST["tva_tx_".$i]) ? 1 : 0); $newvat=eregi_replace('\*','',$_POST["tva_tx_".$i]); + break; // We found submited price } } } @@ -354,12 +355,11 @@ if ($_GET["action"] == 'edit_price' && ($user->rights->produit->creer || $user-> $sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx,"; $sql.= " p.price_level, p.price_min, p.price_min_ttc,"; $sql.= " ".$db->pdate("p.date_price")." as dp, u.rowid as user_id, u.login"; -$sql.= " FROM ".MAIN_DB_PREFIX."product_price as p"; -$sql.= ", ".MAIN_DB_PREFIX."user as u"; +$sql.= " FROM ".MAIN_DB_PREFIX."product_price as p,"; +$sql.= " ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE fk_product = ".$product->id; $sql.= " AND p.fk_user_author = u.rowid"; -if ($conf->global->PRODUIT_MULTIPRICES) $sql.= " ORDER BY p.price_level ASC, p.date_price DESC"; -else $sql.= " ORDER BY p.date_price DESC"; +$sql.= " ORDER BY p.date_price DESC, p.price_level ASC"; //$sql .= $db->plimit(); $result = $db->query($sql) ;