forked from Wavyzz/dolibarr
FIX The vat rate line used when adding a predefined product was wrong if
there is several vat line with same rate.
This commit is contained in:
@@ -379,7 +379,7 @@ function dol_include_once($relpath, $classname='')
|
||||
|
||||
|
||||
/**
|
||||
* Return path of url or filesystem. Return alternate root if exists
|
||||
* Return path of url or filesystem. Return alternate root if exists.
|
||||
*
|
||||
* @param string $path Relative path to file (if mode=0) or relative url (if mode=1). Ie: mydir/myfile, ../myfile
|
||||
* @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path using same host that current url), 3=Used for an URL path (output full path using host defined into $dolibarr_main_url_root of conf file)
|
||||
@@ -3900,7 +3900,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
$sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
|
||||
if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'";
|
||||
}
|
||||
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -3959,11 +3959,12 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
|
||||
/**
|
||||
* Return vat rate of a product in a particular selling country or default country vat if product is unknown
|
||||
*
|
||||
* Function called by get_default_tva
|
||||
*
|
||||
* @param int $idprod Id of product or 0 if not a predefined product
|
||||
* @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...)
|
||||
* @param int $idprodfournprice Id product_fournisseur_price (for "supplier" order/invoice)
|
||||
* @return float Vat rate
|
||||
* @return float|string Vat rate to use with format 5.0 or '5.0 (XXX)'
|
||||
* @see get_product_localtax_for_country
|
||||
*/
|
||||
function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice=0)
|
||||
@@ -3991,14 +3992,14 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
|
||||
else
|
||||
{
|
||||
$ret=$product->tva_tx; // Default vat of product we defined
|
||||
// TODO Add ' ('.$product->default_vat_code.')';
|
||||
if ($product->default_vat_code) $ret.=' ('.$product->default_vat_code.')';
|
||||
}
|
||||
$found=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO Read default product vat according to countrycode and product. Vat for couple countrycode/product is a feature not implemeted yet.
|
||||
// Such feature is useless for 99.999% of users, probably 100%
|
||||
// May be usefull/required if hidden option SERVICE_ARE_ECOMMERCE_200238EC is on
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4113,7 +4114,7 @@ function get_product_localtax_for_country($idprod, $local, $thirdparty_seller)
|
||||
* @param Societe $thirdparty_buyer Objet societe acheteuse
|
||||
* @param int $idprod Id product
|
||||
* @param int $idprodfournprice Id product_fournisseur_price (for supplier order/invoice)
|
||||
* @return float Vat rate to use, -1 if we can't guess it
|
||||
* @return float|string Vat rate to use with format 5.0 or '5.0 (XXX)', -1 if we can't guess it
|
||||
* @see get_default_npr, get_default_localtax
|
||||
*/
|
||||
function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
|
||||
|
||||
Reference in New Issue
Block a user