From 703d4a6aeebaa87c391910eaa20a9447b08d8763 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Oct 2017 14:02:24 +0200 Subject: [PATCH] FIX #7648 --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/fourn/facture/card.php | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 43f2250b508..7a17de63926 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1499,7 +1499,7 @@ class FactureFournisseur extends CommonInvoice * @param int $id Id of line invoice * @param string $desc Description of line * @param double $pu Prix unitaire (HT ou TTC selon price_base_type) - * @param double $vatrate VAT Rate + * @param double $vatrate VAT Rate (Can be '8.5', '8.5 (ABC)') * @param double $txlocaltax1 LocalTax1 Rate * @param double $txlocaltax2 LocalTax2 Rate * @param double $qty Quantity diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 46eadf97c28..156590fb286 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -810,7 +810,7 @@ if (empty($reshook)) $object->fetch($id); $object->fetch_thirdparty(); - $tva_tx = GETPOST('tva_tx'); + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); if (GETPOST('price_ht') != '') { @@ -841,8 +841,16 @@ if (empty($reshook)) $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); $date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); - $localtax1_tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty); - $localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty); + // Define info_bits + $info_bits = 0; + if (preg_match('/\*/', $tva_tx)) + $info_bits |= 0x01; + + // Define vat_rate + $tva_tx = str_replace('*', '', $tva_tx); + $localtax1_tx= get_localtax($tva_tx, 1, $mysoc,$object->thirdparty); + $localtax2_tx= get_localtax($tva_tx, 2, $mysoc,$object->thirdparty); + $remise_percent=GETPOST('remise_percent'); $pu_ht_devise = GETPOST('multicurrency_subprice'); @@ -857,7 +865,7 @@ if (empty($reshook)) } } - $result=$object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('productid'), $price_base_type, 0, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $_POST['units'], $pu_ht_devise); + $result=$object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('productid'), $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $_POST['units'], $pu_ht_devise); if ($result >= 0) { unset($_POST['label']);