Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 15.0
This commit is contained in:
commit
9f2fb17446
@ -5688,21 +5688,20 @@ function isOnlyOneLocalTax($local)
|
|||||||
function get_localtax_by_third($local)
|
function get_localtax_by_third($local)
|
||||||
{
|
{
|
||||||
global $db, $mysoc;
|
global $db, $mysoc;
|
||||||
$sql = "SELECT t.localtax1, t.localtax2 ";
|
|
||||||
|
$sql = " SELECT t.localtax".$local." as localtax";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=t.fk_pays";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=t.fk_pays";
|
||||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND t.active = 1 AND t.taux=(";
|
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND t.active = 1 AND t.taux=(";
|
||||||
$sql .= " SELECT max(tt.taux) FROM ".MAIN_DB_PREFIX."c_tva as tt inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=tt.fk_pays";
|
$sql .= " SELECT max(tt.taux) FROM ".MAIN_DB_PREFIX."c_tva as tt inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=tt.fk_pays";
|
||||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND tt.active = 1";
|
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND tt.active = 1";
|
||||||
$sql .= " )";
|
$sql .= " ) ";
|
||||||
|
$sql .= " AND t.localtax".$local."_type > 0";
|
||||||
|
$sql .= " ORDER BY rowid DESC";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if ($local == 1) {
|
return $obj->localtax;
|
||||||
return $obj->localtax1;
|
|
||||||
} elseif ($local == 2) {
|
|
||||||
return $obj->localtax2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user