From 351807ee9a13dce59506c3ae17420ba0cb319d4e Mon Sep 17 00:00:00 2001 From: eldy Date: Sun, 9 Oct 2011 17:37:47 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20TVA=20Non=20Per=C3=A7ue=20R=C3=A9cup?= =?UTF-8?q?=C3=A9rable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/tpl/freeproductline_create.tpl.php | 6 +++--- htdocs/langs/fr_FR/bills.lang | 2 +- htdocs/lib/functions.lib.php | 4 ++-- htdocs/lib/pdf.lib.php | 2 +- htdocs/product/class/product.class.php | 3 +++ htdocs/product/fiche.php | 3 ++- htdocs/product/price.php | 4 ++-- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index a9f84fe4ee1..dc93993620a 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -72,16 +72,16 @@ tva_assuj == "0") echo '0'; - else echo $html->load_tva('np_tva_tx', -1, $seller, $buyer); + else echo $html->load_tva('np_tva_tx', (isset($_POST["np_tva_tx"])?$_POST["np_tva_tx"]:-1), $seller, $buyer); ?> - + "> "> % -service->enabled && $dateSelector) {?> +service->enabled && $dateSelector) { ?> > 1) return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits); + if (empty($hidedetails) || $hidedetails > 1) return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits,1); } } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index de7eb9ed069..c44cbc65f1b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -208,6 +208,7 @@ class Product extends CommonObject $this->price_min_ttc=price2num($this->price_min_ttc); $this->price_min=price2num($this->price_min); if (empty($this->tva_tx)) $this->tva_tx = 0; + if (empty($this->tva_npr)) $this->tva_npr = 0; //Local taxes if (empty($this->localtax1_tx)) $this->localtax1_tx = 0; if (empty($this->localtax2_tx)) $this->localtax2_tx = 0; @@ -420,6 +421,7 @@ class Product extends CommonObject $this->volume = price2num($this->volume); $this->volume_units = trim($this->volume_units); if (empty($this->tva_tx)) $this->tva_tx = 0; + if (empty($this->tva_npr)) $this->tva_npr = 0; //Local taxes if (empty($this->localtax1_tx)) $this->localtax1_tx = 0; if (empty($this->localtax2_tx)) $this->localtax2_tx = 0; @@ -435,6 +437,7 @@ class Product extends CommonObject $sql.= " SET label = '" . $this->db->escape($this->libelle) ."'"; $sql.= ",ref = '" . $this->ref ."'"; $sql.= ",tva_tx = " . $this->tva_tx; + $sql.= ",recuperableonly = " . $this->tva_npr; //Local taxes $sql.= ",localtax1_tx = " . $this->localtax1_tx; diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index badd9c3c815..04ac8c87052 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -148,7 +148,8 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service else $product->price = $_POST["price"]; if ($product->price_base_type == 'TTC') $product->price_min_ttc = $_POST["price_min"]; else $product->price_min = $_POST["price_min"]; - $product->tva_tx = $_POST["tva_tx"]; + $product->tva_tx = str_replace('*','',$_POST['tva_tx']); + $product->tva_npr = preg_match('/\*/',$_POST['tva_tx'])?1:0; // local taxes. $product->localtax1_tx = get_localtax($product->tva_tx,1); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index a4cda019993..7e21db9f865 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -241,7 +241,7 @@ if ($conf->global->PRODUIT_MULTIPRICES) else { // TVA - print ''.$langs->trans("VATRate").''.vatrate($product->tva_tx,true).''; + print ''.$langs->trans("VATRate").''.vatrate($product->tva_tx.($product->tva_npr?'*':''),true).''; // Price print ''.$langs->trans("SellingPrice").''; @@ -317,7 +317,7 @@ if ($_GET["action"] == 'edit_price' && ($user->rights->produit->creer || $user-> // VAT print ''.$langs->trans("VATRate").''; - print $html->load_tva("tva_tx",$product->tva_tx,$mysoc,'',$product->id); + print $html->load_tva("tva_tx",$product->tva_tx,$mysoc,'',$product->id,$product->tva_npr); print ''; // Price base