forked from Wavyzz/dolibarr
Debug v17
This commit is contained in:
@@ -6283,9 +6283,11 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
|||||||
|
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."c_country as c";
|
$sql .= ", ".MAIN_DB_PREFIX."c_country as c";
|
||||||
if (!empty($mysoc) && $mysoc->country_code == 'ES') {
|
if (!empty($mysoc) && $mysoc->country_code == 'ES') {
|
||||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($buyer->country_code)."'"; // local tax in spain use the buyer country ??
|
$countrycodetouse = ((empty($buyer) || empty($buyer->country_code)) ? $mysoc->country_code : $buyer->country_code);
|
||||||
|
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($countrycodetouse)."'"; // local tax in spain use the buyer country ??
|
||||||
} else {
|
} else {
|
||||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(empty($seller->country_code) ? $mysoc->country_code : $seller->country_code)."'";
|
$countrycodetouse = ((empty($seller) || empty($seller->country_code)) ? $mysoc->country_code : $seller->country_code);
|
||||||
|
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($countrycodetouse)."'";
|
||||||
}
|
}
|
||||||
$sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
|
$sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
|
||||||
if ($vatratecode) {
|
if ($vatratecode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user