Fix: j'avais fait une correction pour rgler un problme qui en a engendr un autre, je reviend en arrire

This commit is contained in:
Regis Houssin 2007-05-08 13:33:22 +00:00
parent 07a8ee6e28
commit 7d8fafe48d
3 changed files with 50 additions and 51 deletions

View File

@ -294,12 +294,11 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on
$desc=$_POST['np_desc'];
if (! $desc && $conf->global->PRODUIT_CHANGE_PROD_DESC)
{
{
$desc = $prod->description;
}
// \todo La valeur de la TVA a 0 devrait etre retournée par get_default_tva
$tva_tx = ($soc->tva_assuj=='0')?0:get_default_tva($mysoc,$soc,$prod->tva_tx);
//$tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx);
}
$tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx);
}
else
{

View File

@ -843,21 +843,21 @@ class Form
$sql = "SELECT ";
if ($conf->categorie->enabled && ! $user->rights->categorie->voir)
{
$sql.="DISTINCT";
}
{
$sql.="DISTINCT";
}
$sql.= " p.rowid, p.label, p.ref, p.price, p.duration";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p ";
if ($conf->categorie->enabled && ! $user->rights->categorie->voir)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
}
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
}
$sql.= " WHERE p.envente = 1";
if ($conf->categorie->enabled && ! $user->rights->categorie->voir)
{
$sql.= ' AND IFNULL(c.visible,1)=1';
}
{
$sql.= ' AND IFNULL(c.visible,1)=1';
}
if ($filtretype && $filtretype != '') $sql.=" AND p.fk_product_type=".$filtretype;
if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND p.ref like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%'";
$sql.= " ORDER BY p.nbvente DESC";
@ -870,21 +870,21 @@ class Form
// Multilang : on construit une liste des traductions des produits listés
if ($conf->global->MAIN_MULTILANGS)
{
$sqld = "SELECT d.fk_product, d.label";
{
$sqld = "SELECT d.fk_product, d.label";
$sqld.= " FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_det as d ";
$sqld.= " WHERE d.fk_product=p.rowid AND p.envente=1 AND d.lang='". $langs->getDefaultLang() ."'";
$sqld.= " ORDER BY p.nbvente DESC";
$resultd = $this->db->query($sqld);
if ( $resultd ) $objtp = $this->db->fetch_object($resultd);
}
if ($result)
{
$num = $this->db->num_rows($result);
if ($conf->use_ajax)
{
if ($result)
{
$num = $this->db->num_rows($result);
if ($conf->use_ajax)
{
if (! $num)
{
print '<select class="flat" name="'.$htmlname.'">';
@ -901,11 +901,11 @@ class Form
print '<select class="flat" name="'.$htmlname.'">';
print '<option value="0" selected="true">&nbsp;</option>';
}
$i = 0;
while ($num && $i < $num)
{
$objp = $this->db->fetch_object($result);
$i = 0;
while ($num && $i < $num)
{
$objp = $this->db->fetch_object($result);
// Multilangs : modification des donnée si une traduction existe
if ($conf->global->MAIN_MULTILANGS)
@ -929,33 +929,33 @@ class Form
$result2 = $this->db->query($sql) ;
$objp2 = $this->db->fetch_object($result2);
if ($objp2->price)
{
$opt.= $objp2->price.' '.$langs->trans("Currency".$conf->monnaie);
}
else
{
$opt.= $objp->price.' '.$langs->trans("Currency".$conf->monnaie);
}
}
else
$opt.= $objp->price.' '.$langs->trans("Currency".$conf->monnaie);
if ($objp->duration) $opt.= ' - '.$objp->duration;
$opt.= "</option>\n";
print $opt;
$i++;
}
if ($conf->use_ajax)
{
// if ($num)
// {
print '</select>';
// }
}
else
{
print '</select>';
}
$this->db->free($result);
}
else
{
$opt.= $objp->price.' '.$langs->trans("Currency".$conf->monnaie);
}
if ($objp->duration) $opt.= ' - '.$objp->duration;
$opt.= "</option>\n";
print $opt;
$i++;
}
print '</select>';
$this->db->free($result);
}
else
{
dolibarr_print_error($db);
dolibarr_print_error($db);
}
}

View File

@ -1920,7 +1920,7 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $taux_produit)
if (! is_numeric($societe_vendeuse->tva_assuj) && $societe_vendeuse->tva_assuj=='franchise') return 0;
// Si le (pays vendeur = pays acheteur) alors la TVA par défaut=TVA du produit vendu. Fin de règle.
if (is_object($societe_acheteuse) && ($societe_vendeuse->pays_id == $societe_acheteuse->pays_id) && $societe_vendeuse->tva_assuj == 1)
if (is_object($societe_acheteuse) && ($societe_vendeuse->pays_id == $societe_acheteuse->pays_id) && $societe_acheteuse->tva_assuj == 1)
{
return $taux_produit;
}