mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-22 17:31:25 +01:00
FIX localtax info were not returned correctly when call done with id.
This commit is contained in:
@@ -4922,13 +4922,14 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
|||||||
dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local);
|
dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local);
|
||||||
|
|
||||||
// Search local taxes
|
// Search local taxes
|
||||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
|
$sql = "SELECT t.taux as rate, t.code, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
|
||||||
if ($firstparamisid) $sql .= " WHERE t.rowid = ".(int) $vatrate;
|
if ($firstparamisid) $sql .= " WHERE t.rowid = ".(int) $vatrate;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$vatratecleaned = $vatrate;
|
$vatratecleaned = $vatrate;
|
||||||
$vatratecode = '';
|
$vatratecode = '';
|
||||||
|
$reg = array();
|
||||||
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "x.x (yy)"
|
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "x.x (yy)"
|
||||||
{
|
{
|
||||||
$vatratecleaned = $reg[1];
|
$vatratecleaned = $reg[1];
|
||||||
@@ -4946,17 +4947,20 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
$vateratestring = $obj->rate.($obj->code ? ' ('.$obj->code.')' : '');
|
||||||
|
|
||||||
if ($local == 1)
|
if ($local == 1)
|
||||||
{
|
{
|
||||||
return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
return array($obj->localtax1_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||||
}
|
}
|
||||||
elseif ($local == 2)
|
elseif ($local == 2)
|
||||||
{
|
{
|
||||||
return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
return array($obj->localtax2_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
return array($obj->localtax1_type, get_localtax($vateratestring, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vateratestring, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user