diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 38a677d0a19..5696291f63a 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -213,25 +213,36 @@ if ($_GET['action'] == 'del_ligne') } // Modification d'une ligne -if ($_REQUEST['action'] == 'change_line') +if ($_REQUEST['action'] == 'update_line') { if ($_REQUEST['etat'] == '1' && ! $_REQUEST['cancel']) // si on valide la modification { - $facfou = new FactureFournisseur($db,'',$_GET['facid']); + $facfou = new FactureFournisseur($db); + $facfou->fetch($_GET['facid']); + + if ($_POST['puht']) + { + $pu=$_POST['puht']; + $price_base_type='HT'; + } + if ($_POST['puttc']) + { + $pu=$_POST['puttc']; + $price_base_type='TTC'; + } if ($_POST['idprod']) { $prod = new Product($db); $prod->fetch($_POST['idprod']); - $label = $prod->libelle; - - $facfou->updateline($_GET['ligne_id'], $label, $_POST['puht'], $_POST['tauxtva'], $_POST['qty'], $_POST['idprod']); } else { - $facfou->updateline($_GET['ligne_id'], $_POST['label'], $_POST['puht'], $_POST['tauxtva'], $_POST['qty']); + $label = $_POST['label']; } + + $facfou->updateline($_GET['ligne_id'], $label, $pu, $_POST['tauxtva'], $_POST['qty'], $_POST['idprod'], $price_base_type); } } @@ -496,7 +507,7 @@ else $var=!$var; // Affichage simple de la ligne print ''.$fac->lignes[$i]->description.''; - print ''.price($fac->lignes[$i]->tva_taux).'%'; + print ''.vatrate($fac->lignes[$i]->tva_taux).'%'; print ''.price($fac->lignes[$i]->pu_ht,'MU').''; print ''.($fac->lignes[$i]->pu_ttc?price($fac->lignes[$i]->pu_ttc,'MU'):' ').''; print ''.$fac->lignes[$i]->qty.''; @@ -697,12 +708,16 @@ else if ($fac->statut == 0 && $_GET['action'] == 'mod_ligne' && $_GET['etat'] == '0' && $_GET['ligne_id'] == $fac->lignes[$i]->rowid) { print '
'; - print ''; + print ''; print ''; print ''; if ($conf->produit->enabled && $fac->lignes[$i]->fk_product) { - $html->select_produits_fournisseurs($fac->socid,$fac->lignes[$i]->fk_product,'idprod',$filtre); + $product=new ProductFournisseur($db); + $product->fetch($fac->lignes[$i]->fk_product); + $product->ref=$product->libelle; // Car sur facture fourn on met juste le libelle sur produits lies + print $product->getNomUrl(1); + print ''; } else { @@ -713,7 +728,7 @@ else $html->select_tva('tauxtva',$fac->lignes[$i]->tva_taux,$societe,$mysoc); print ''; print ''; - print ''; + print ''; print ''; print ' '; print ' '; @@ -740,7 +755,7 @@ else print nl2br($fac->lignes[$i]->description); } print ''; - print ''.price($fac->lignes[$i]->tva_taux).'%'; + print ''.vatrate($fac->lignes[$i]->tva_taux).'%'; print ''.price($fac->lignes[$i]->pu_ht,'MU').''; print ''.($fac->lignes[$i]->pu_ttc?price($fac->lignes[$i]->pu_ttc,'MU'):' ').''; print ''.$fac->lignes[$i]->qty.''; diff --git a/htdocs/fourn/fournisseur.facture.class.php b/htdocs/fourn/fournisseur.facture.class.php index c3a3e622798..4ae95b3ecb1 100644 --- a/htdocs/fourn/fournisseur.facture.class.php +++ b/htdocs/fourn/fournisseur.facture.class.php @@ -432,6 +432,8 @@ class FactureFournisseur extends Facture */ function updateline($id, $label, $pu, $tauxtva, $qty=1, $idproduct=0, $price_base_type='HT') { + include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php'); + $pu = price2num($pu); $qty = price2num($qty);