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 '