diff --git a/dev/.gitignore b/dev/.gitignore new file mode 100644 index 00000000000..eaecc7e3425 --- /dev/null +++ b/dev/.gitignore @@ -0,0 +1 @@ +/spec diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index dc96679132e..67e27610c42 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2800,7 +2800,7 @@ class Form * @param societe_vendeuse Objet societe vendeuse * @param societe_acheteuse Objet societe acheteuse * @param idprod Id product - * @param info_bits Miscellaneous information on line + * @param info_bits Miscellaneous information on line (1 for NPR) * @param type ''=Unknown, 0=Product, 1=Service (Used if idprod not defined) * Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle. * Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle. diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index e329b0e669d..8f8a4c8c68b 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -64,16 +64,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 277fd8a85ab..c750ff7dfbe 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -48,27 +48,27 @@ class Product extends CommonObject var $libelle; // TODO deprecated var $label; var $description; - //! Prix de vente - var $price; // Price without tax + //! Type 0 for regular product, 1 for service (Advanced feature: 2 for assembly kit, 3 for stock kit) + var $type; + //! Selling price + var $price; // Price net var $price_ttc; // Price with tax - var $price_min; - var $price_min_ttc; - //! Base de prix (ttc ou ht) + var $price_min; // Minimum price net + var $price_min_ttc; // Minimum price with tax + //! Base price ('TTC' for price including tax or 'HT' for net price) var $price_base_type; - //! Tableau des prix multiples + //! Arrays for multiprices var $multiprices=array(); var $multiprices_ttc=array(); var $multiprices_base_type=array(); var $multiprices_tva_tx=array(); - //! Taux de TVA + //! Default VAT rate of product var $tva_tx; - //! French VAT NPR + //! French VAT NPR (0 or 1) var $tva_npr=0; //! Spanish local taxes var $localtax1_tx; var $localtax2_tx; - //! Type 0 for regular product, 1 for service (Advanced feature: 2 for assembly kit, 3 for stock kit) - var $type; //! Stock var $stock_reel; @@ -207,6 +207,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; @@ -403,7 +404,7 @@ class Product extends CommonObject global $langs, $conf; // Verification parametres - if (! $this->libelle) $this->libelle = 'LIBELLE MANQUANT'; + if (! $this->libelle) $this->libelle = 'MISSING LABEL'; // Clean parameters $this->ref = dol_string_nospecial(trim($this->ref)); @@ -419,6 +420,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; @@ -433,6 +435,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 7f1621651df..0d3d0c9869c 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -158,7 +158,8 @@ if (empty($reshook)) 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 1a24a910605..242a203819e 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -240,7 +240,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").''; @@ -316,7 +316,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 @@ -357,10 +357,12 @@ if ($_GET["action"] == 'edit_price' && ($user->rights->produit->creer || $user-> } print ''; - print ' '; - print ''; print ''; - print ''; + + print '

 '; + print '
'; + + print '
'; } else {