From 7d8fafe48de89a3211df5a9b6ad17145893455d6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 8 May 2007 13:33:22 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20j'avais=20fait=20une=20correction=20pour?= =?UTF-8?q?=20r=E9gler=20un=20probl=E8me=20qui=20en=20a=20engendr=E9=20un?= =?UTF-8?q?=20autre,=20je=20reviend=20en=20arri=E8re?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/commande/fiche.php | 9 ++-- htdocs/html.form.class.php | 90 ++++++++++++++++++------------------ htdocs/lib/functions.inc.php | 2 +- 3 files changed, 50 insertions(+), 51 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 2d5a0e628ff..f541dad50ae 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -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 { diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 1cf450b633e..fef83927330 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -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 ''; print ''; } - - $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.= "\n"; - print $opt; - $i++; - } - if ($conf->use_ajax) - { - // if ($num) - // { - print ''; - // } - } - else - { - print ''; - } - $this->db->free($result); - } - else + { + $opt.= $objp->price.' '.$langs->trans("Currency".$conf->monnaie); + } + + if ($objp->duration) $opt.= ' - '.$objp->duration; + + $opt.= "\n"; + print $opt; + $i++; + } + + print ''; + + $this->db->free($result); + } + else { - dolibarr_print_error($db); + dolibarr_print_error($db); } } diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 1a09c972ec1..e70b56b6425 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -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; }