2
0
forked from Wavyzz/dolibarr

Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/accountancy/admin/account.php
	htdocs/accountancy/admin/categories.php
	htdocs/expensereport/class/expensereport.class.php
	htdocs/install/mysql/migration/4.0.0-5.0.0.sql
This commit is contained in:
Laurent Destailleur
2017-03-05 22:11:35 +01:00
41 changed files with 854 additions and 688 deletions

View File

@@ -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)
@@ -2234,7 +2234,7 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
* @param string $trunc Where to trunc: right, left, middle (size must be a 2 power), wrap
* @param string $stringencoding Tell what is source string encoding
* @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation.
* @param int $display Trunc is use to display and can be changed for small screen
* @param int $display Trunc is use to display and can be changed for small screen. TODO Remove this param (must be dealt with CSS)
* @return string Truncated string
*/
function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0, $display=0)
@@ -3963,11 +3963,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)
@@ -3995,14 +3996,14 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
else
{
$ret=$product->tva_tx; // Default vat of product we defined
if ($product->default_vat_code) $ret.=' ('.$product->default_vat_code.')';
}
$found=1;
}
else
{
// TODO Read default product vat according to countrycode and product
// TODO Read default product vat according to countrycode and product. Vat for couple countrycode/product is a feature not implemeted yet.
// May be usefull/required if hidden option SERVICE_ARE_ECOMMERCE_200238EC is on
}
}
@@ -4010,11 +4011,11 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
{
if (empty($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS))
{
// If vat of product for the country not found or not defined, we return higher vat of country.
// If vat of product for the country not found or not defined, we return the first higher vat of country.
$sql = "SELECT taux as vat_rate";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
$sql.= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'";
$sql.= " ORDER BY t.taux DESC, t.recuperableonly ASC";
$sql.= " ORDER BY t.taux DESC, t.code ASC, t.recuperableonly ASC";
$sql.= $db->plimit(1);
$resql=$db->query($sql);
@@ -4117,7 +4118,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)