diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 4c32664630f..b3822143167 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4137,7 +4137,7 @@ class Form
* The name of this function should be selectVat. We keep bad name for compatibility purpose.
*
* @param string $htmlname Name of HTML select field
- * @param float $selectedrate Force preselected vat rate. Use '' for no forcing.
+ * @param float|string $selectedrate Force preselected vat rate. Can be '8.5' or '8.5 (NOO)' for example. Use '' for no forcing.
* @param Societe $societe_vendeuse Thirdparty seller
* @param Societe $societe_acheteuse Thirdparty buyer
* @param int $idprod Id product
@@ -4169,7 +4169,7 @@ class Form
$defaultcode=$reg[1];
$defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx);
}
- //var_dump($defaulttx.'-'.$defaultnpr.'-'.$defaultcode);
+ //var_dump($selectedrate.'-'.$defaulttx.'-'.$defaultnpr.'-'.$defaultcode);
// Check parameters
if (is_object($societe_vendeuse) && ! $societe_vendeuse->country_code)
@@ -4266,7 +4266,7 @@ class Form
$return.= $rate['nprtva'] ? '*': '';
if ($addcode && $rate['code']) $return.=' ('.$rate['code'].')';
$return.= '"';
- if ($defaultcode)
+ if ($defaultcode) // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag
{
if ($defaultcode == $rate['code']) $return.= ' selected';
}
@@ -4276,7 +4276,7 @@ class Form
}
$return.= '>'.vatrate($rate['libtva']);
//$return.=($rate['code']?' '.$rate['code']:'');
- $return.= $rate['nprtva'] ? ' *': '';
+ $return.= (empty($defaultcode) && $rate['nprtva']) ? ' *': ''; // We show the * (old behaviour only if new vat code is not used)
$return.= '';
}
diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
index 8296aa82e74..5e0cbd644d5 100644
--- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
+++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
@@ -62,6 +62,7 @@ ALTER TABLE llx_product ADD COLUMN width_units tinyint DEFAULT NULL;
ALTER TABLE llx_product ADD COLUMN height float DEFAULT NULL;
ALTER TABLE llx_product ADD COLUMN height_units tinyint DEFAULT NULL;
+ALTER TABLE llx_product ADD COLUMN default_vat_code varchar(10) after cost_price;
CREATE TABLE llx_categorie_user
(
diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql
index d9de9da17e9..9d3446d696d 100755
--- a/htdocs/install/mysql/tables/llx_product.sql
+++ b/htdocs/install/mysql/tables/llx_product.sql
@@ -45,6 +45,7 @@ create table llx_product
price_min_ttc double(24,8) DEFAULT 0,
price_base_type varchar(3) DEFAULT 'HT',
cost_price double(24,8) DEFAULT NULL, -- Cost price without tax. Can be used for margin calculation.
+ default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product.
tva_tx double(6,3), -- Default VAT rate of product
recuperableonly integer NOT NULL DEFAULT '0', -- French NPR VAT
localtax1_tx double(6,3) DEFAULT 0, --
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 499fd8c3694..819a5438eda 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -97,6 +97,8 @@ class Product extends CommonObject
var $prices_by_qty=array();
var $prices_by_qty_id=array();
var $prices_by_qty_list=array();
+ //! Default VAT code for product (link to code into llx_c_tva but without foreign keys)
+ var $default_vat_code;
//! Default VAT rate of product
var $tva_tx;
//! French VAT NPR (0 or 1)
@@ -702,6 +704,7 @@ class Product extends CommonObject
$sql.= " SET label = '" . $this->db->escape($this->label) ."'";
$sql.= ", ref = '" . $this->db->escape($this->ref) ."'";
$sql.= ", ref_ext = ".(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null");
+ $sql.= ", default_vat_code = ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null");
$sql.= ", tva_tx = " . $this->tva_tx;
$sql.= ", recuperableonly = " . $this->tva_npr;
$sql.= ", localtax1_tx = " . $this->localtax1_tx;
@@ -824,12 +827,14 @@ class Product extends CommonObject
{
if (empty($conf->barcode->enabled)) $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref);
else $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductBarCodeAlreadyExists",$this->barcode);
+ $this->errors[]=$this->error;
$this->db->rollback();
return -1;
}
else
{
$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
+ $this->errors[]=$this->error;
$this->db->rollback();
return -2;
}
@@ -1390,27 +1395,28 @@ class Product extends CommonObject
/**
- * Modify price of a product/Service
+ * Modify customer price of a product/Service
*
- * @param double $newprice New price
- * @param string $newpricebase HT or TTC
- * @param User $user Object user that make change
- * @param double $newvat New VAT Rate (For example 8.5. Should not be a string)
- * @param double $newminprice New price min
- * @param int $level 0=standard, >0 = level if multilevel prices
- * @param int $newnpr 0=Standard vat rate, 1=Special vat rate for French NPR VAT
- * @param int $newpsq 1 if it has price by quantity
- * @param int $ignore_autogen Used to avoid infinite loops
+ * @param double $newprice New price
+ * @param string $newpricebase HT or TTC
+ * @param User $user Object user that make change
+ * @param double $newvat New VAT Rate (For example 8.5. Should not be a string)
+ * @param double $newminprice New price min
+ * @param int $level 0=standard, >0 = level if multilevel prices
+ * @param int $newnpr 0=Standard vat rate, 1=Special vat rate for French NPR VAT
+ * @param int $newpsq 1 if it has price by quantity
+ * @param int $ignore_autogen Used to avoid infinite loops
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
+ * @param string $newdefaultvatcode Default vat code
* @return int <0 if KO, >0 if OK
*/
- function updatePrice($newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0, $newpsq=0, $ignore_autogen=0, $localtaxes_array=array())
+ function updatePrice($newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0, $newpsq=0, $ignore_autogen=0, $localtaxes_array=array(), $newdefaultvatcode='')
{
global $conf,$langs;
$id=$this->id;
- dol_syslog(get_class($this)."::update_price id=".$id." newprice=".$newprice." newpricebase=".$newpricebase." newminprice=".$newminprice." level=".$level." npr=".$newnpr);
+ dol_syslog(get_class($this)."::update_price id=".$id." newprice=".$newprice." newpricebase=".$newpricebase." newminprice=".$newminprice." level=".$level." npr=".$newnpr," newdefaultvatcode=".$newdefaultvatcode);
// Clean parameters
if (empty($this->tva_tx)) $this->tva_tx=0;
@@ -1504,6 +1510,7 @@ class Product extends CommonObject
$sql.= " localtax2_tx=".($localtax2>=0?$localtax2:'NULL').",";
$sql.= " localtax1_type=".($localtaxtype1!=''?"'".$localtaxtype1."'":"'0'").",";
$sql.= " localtax2_type=".($localtaxtype2!=''?"'".$localtaxtype2."'":"'0'").",";
+ $sql.= " default_vat_code=".($newdefaultvatcode?"'".$this->db->escape($newdefaultvatcode)."'":"null").",";
$sql.= " tva_tx='".price2num($newvat)."',";
$sql.= " recuperableonly='".$newnpr."'";
$sql.= " WHERE rowid = ".$id;
@@ -1517,6 +1524,7 @@ class Product extends CommonObject
$this->multiprices_min[$level]= $price_min;
$this->multiprices_min_ttc[$level]= $price_min_ttc;
$this->multiprices_base_type[$level]= $newpricebase;
+ $this->multiprices_default_vat_code[$level]= $newdefaultvatcode;
$this->multiprices_tva_tx[$level]= $newvat;
$this->multiprices_recuperableonly[$level]= $newnpr;
@@ -1525,6 +1533,7 @@ class Product extends CommonObject
$this->price_min = $price_min;
$this->price_min_ttc = $price_min_ttc;
$this->price_base_type = $newpricebase;
+ $this->default_vat_code = $newdefaultvatcode;
$this->tva_tx = $newvat;
$this->tva_npr = $newnpr;
//Local taxes
@@ -1603,7 +1612,7 @@ class Product extends CommonObject
}
$sql = "SELECT rowid, ref, ref_ext, label, description, url, note, customcode, fk_country, price, price_ttc,";
- $sql.= " price_min, price_min_ttc, price_base_type, cost_price, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,";
+ $sql.= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,";
$sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,";
$sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
$sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,";
@@ -1647,6 +1656,7 @@ class Product extends CommonObject
$this->price_min_ttc = $obj->price_min_ttc;
$this->price_base_type = $obj->price_base_type;
$this->cost_price = $obj->cost_price;
+ $this->default_vat_code = $obj->default_vat_code;
$this->tva_tx = $obj->tva_tx;
//! French VAT NPR
$this->tva_npr = $obj->tva_npr;
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 857a6634bf6..5b024391b20 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -94,11 +94,10 @@ if (empty($reshook))
if (($action == 'update_vat') && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer))
{
- $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5
-
- $tva_tx_txt;
-
+ $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
+
// We must define tva_tx, npr and local taxes
+ $vatratecode = '';
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
@@ -116,33 +115,37 @@ if (empty($reshook))
$resql=$db->query($sql);
if ($resql)
{
- $obj = $db->fetch_object($resql);
- $npr = $obj->recuperableonly;
- $localtax1 = $obj->localtax1;
- $localtax2 = $obj->localtax2;
- $localtax1_type = $obj->localtax1_type;
- $localtax2_type = $obj->localtax2_type;
+ $obj = $db->fetch_object($resql);
+ $npr = $obj->recuperableonly;
+ $localtax1 = $obj->localtax1;
+ $localtax2 = $obj->localtax2;
+ $localtax1_type = $obj->localtax1_type;
+ $localtax2_type = $obj->localtax2_type;
}
}
-
+
+ $object->default_vat_code = $vatratecode;
$object->tva_tx = $tva_tx;
$object->tva_npr = $npr;
$object->localtax1_tx = $localtax1;
$object->localtax2_tx = $localtax2;
$object->localtax1_type = $localtax1_type;
$object->localtax2_type = $localtax2_type;
-
+
$db->begin();
-
+
$resql = $object->update($object->id, $user);
if (! $resql)
{
$error++;
+ setEventMessages($object->error, $object->errors, 'errors');
}
if ($error)
{
- $object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq); // FIXME Bug $newvat and $newnpr not defined
+ //$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2);
+ $localtaxarray=array(); // We do not store localtaxes into product, we will use instead the "vat code" to retreive them.
+ $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode);
}
if (! $error)
@@ -203,19 +206,44 @@ if (empty($reshook))
}
$tva_tx_txt = $newvattx[$i];
- $npr = $newvatnpr[$i];
+
+ $vatratecode = '';
+ $tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
+ $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
$localtax1 = $newlocaltax1_tx[$i];
$localtax1_type = $newlocaltax1_type[$i];
$localtax2 = $newlocaltax2_tx[$i];
$localtax2_type = $newlocaltax2_type[$i];
-
+ if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
+ {
+ // We look into database using code
+ $vatratecode=$reg[1];
+ // Get record from code
+ $sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
+ $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'";
+ $sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
+ $sql.= " AND t.code ='".$vatratecode."'";
+ $resql=$db->query($sql);
+ if ($resql)
+ {
+ $obj = $db->fetch_object($resql);
+ $npr = $obj->recuperableonly;
+ $localtax1 = $obj->localtax1;
+ $localtax2 = $obj->localtax2;
+ $localtax1_type = $obj->localtax1_type;
+ $localtax2_type = $obj->localtax2_type;
+ }
+ }
+
$pricestoupdate[$i] = array(
'price' => $newprice[$i],
'price_min' => $newprice_min[$i],
'price_base_type' => $newpricebase[$i],
- 'vat_tx' => $tva_tx,
- 'npr' => $npr,
- 'localtaxes_array' => array('0'=>$localtax1_type, '1'=>$localtax1, '2'=>$localtax2_type, '3'=>$localtax2)
+ 'default_vat_code' => $vatratecode,
+ 'vat_tx' => $tva_tx, // default_vat_code should be used in priority in a future
+ 'npr' => $npr, // default_vat_code should be used in priority in a future
+ 'localtaxes_array' => array('0'=>$localtax1_type, '1'=>$localtax1, '2'=>$localtax2_type, '3'=>$localtax2) // default_vat_code should be used in priority in a future
);
//If autogeneration is enabled, then we only set the first level
@@ -223,9 +251,12 @@ if (empty($reshook))
break;
}
}
- } else {
- $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' , '8.5*', '8.5 (8.5NPR) *' for example.
+ }
+ elseif (! $error)
+ {
+ $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
+ $vatratecode = '';
// We must define tva_tx, npr and local taxes
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
@@ -256,9 +287,10 @@ if (empty($reshook))
'price' => $_POST["price"],
'price_min' => $_POST["price_min"],
'price_base_type' => $_POST["price_base_type"],
- 'vat_tx' => $tva_tx,
- 'npr' => $npr,
- 'localtaxes_array' => array('0'=>$localtax1_type, '1'=>$localtax1, '2'=>$localtax2_type, '3'=>$localtax2)
+ 'default_vat_code' => $vatratecode,
+ 'vat_tx' => $tva_tx, // default_vat_code should be used in priority in a future
+ 'npr' => $npr, // default_vat_code should be used in priority in a future
+ 'localtaxes_array' => array('0'=>$localtax1_type, '1'=>$localtax1, '2'=>$localtax2_type, '3'=>$localtax2) // default_vat_code should be used in priority in a future
);
}
@@ -282,7 +314,7 @@ if (empty($reshook))
break;
}
- $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array']);
+ $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code']);
if ($res < 0) {
$error ++;
@@ -422,6 +454,7 @@ if (empty($reshook))
$tva_tx_txt = GETPOST("tva_tx");
+ $vatratecode = '';
// We must define tva_tx, npr and local taxes
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
@@ -449,6 +482,7 @@ if (empty($reshook))
}
}
+ $prodcustprice->default_vat_code = $vatratecode;
$prodcustprice->tva_tx = $tva_tx;
$prodcustprice->recuperableonly = $npr;
$prodcustprice->localtax1_tx = $localtax1;
@@ -463,7 +497,7 @@ if (empty($reshook))
$error++;
$action='add_customer_price';
}
- if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $prodcustprice->price_min<$maxpricesupplier)
+ if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $prodcustprice->price_min < $maxpricesupplier)
{
$langs->load("errors");
setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
@@ -511,9 +545,10 @@ if (empty($reshook))
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
-
+
$tva_tx_txt = GETPOST("tva_tx");
-
+
+ $vatratecode='';
// We must define tva_tx, npr and local taxes
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
@@ -541,6 +576,7 @@ if (empty($reshook))
}
}
+ $prodcustprice->default_vat_code = $vatratecode;
$prodcustprice->tva_tx = $tva_tx;
$prodcustprice->recuperableonly = $npr;
$prodcustprice->localtax1_tx = $localtax1;
@@ -548,7 +584,7 @@ if (empty($reshook))
$prodcustprice->localtax1_type = $localtax1_type;
$prodcustprice->localtax2_type = $localtax2_type;
- if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
+ if ($prodcustprice->price_min < $maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
{
setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
$error++;
@@ -640,7 +676,13 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
else
{
// TVA
- print '
' . $langs->trans("VATRate") . ' ' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . ' ';
+ print '' . $langs->trans("VATRate") . ' ';
+ if ($object->default_vat_code)
+ {
+ print vatrate($object->tva_tx, true) . ' ('.$object->default_vat_code.')';
+ }
+ else print vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true);
+ print ' ';
}
}
@@ -649,17 +691,23 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
{
// We show only vat for level 1
- print '' . $langs->trans("VATRate") . ' ' . vatrate($object->multiprices_tva_tx [1], true) . ' ';
+ print '' . $langs->trans("VATRate") . ' ' . vatrate($object->multiprices_tva_tx[1], true) . ' ';
}
else
{
// TVA
- print '' . $langs->trans("VATRate") . ' ' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . ' ';
+ print '' . $langs->trans("VATRate") . ' ';
+ if ($object->default_vat_code)
+ {
+ print vatrate($object->tva_tx, true) . ' ('.$object->default_vat_code.')';
+ }
+ else print vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true);
+ print ' ';
}
print ''.$langs->trans("PriceLevel").' '.$langs->trans("SellingPrice").' '.$langs->trans("MinPrice").' ';
- for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
+ for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
{
print '';
@@ -771,7 +819,13 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
else
{
// TVA
- print ' ' . $langs->trans("VATRate") . ' ' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . ' ';
+ print '' . $langs->trans("VATRate") . ' ';
+ if ($object->default_vat_code)
+ {
+ print vatrate($object->tva_tx, true) . ' ('.$object->default_vat_code.')';
+ }
+ else print vatrate($object->tva_tx, true, $object->tva_npr, true);
+ print ' ';
// Price
print '' . $langs->trans("SellingPrice") . ' ';
@@ -933,10 +987,10 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se
dol_fiche_head('');
print '';
-
+
// VAT
print '' . $langs->trans("VATRate") . ' ';
- print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
+ print $form->load_tva("tva_tx", $object->default_vat_code ? $object->tva_tx.' ('.$object->default_vat_code.')' : $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
print ' ';
print '
';
@@ -969,7 +1023,7 @@ if ($action == 'edit_price' && $object->getRights()->creer)
// VAT
print ' ' . $langs->trans("VATRate") . ' ';
- print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
+ print $form->load_tva("tva_tx", $object->default_vat_code ? $object->tva_tx.' ('.$object->default_vat_code.')' : $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
print ' ';
// Price base
@@ -1102,13 +1156,17 @@ if ($action == 'edit_price' && $object->getRights()->creer)
}
print '';
- print '
- '.$langs->trans("PriceLevel").' ';
- if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) {
- print ''.$langs->trans("VATRate").' ';
- }
- print ''.$langs->trans("SellingPrice").'
- '.$langs->trans("MinPrice").' ';
+ print '';
+
+ print ''.$langs->trans("PriceLevel").' ';
+
+ if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) print ''.$langs->trans("VATRate").' ';
+ else print ' ';
+
+ print ''.$langs->trans("SellingPrice").' ';
+
+ print ''.$langs->trans("MinPrice").' ';
+
if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) {
print ' ';
}
@@ -1126,12 +1184,14 @@ if ($action == 'edit_price' && $object->getRights()->creer)
// VAT
if (empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) {
- print ' ';
+ print '';
+ print ' ';
print ' ';
print ' ';
print ' ';
print ' ';
print ' ';
+ print ' ';
} else {
// This option is kept for backward compatibility but has no sense
print '';