Fix: Syntax error in request

This commit is contained in:
Laurent Destailleur 2009-06-16 18:41:01 +00:00
parent 181c4e4ba8
commit 6d8e0b05d3
3 changed files with 17 additions and 13 deletions

View File

@ -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
{

View File

@ -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;

View File

@ -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) ;