|
@@ -5037,8 +5037,8 @@ function get_localtax($vatrate, $local, $thirdparty_buyer = "", $thirdparty_sell
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
|
|
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($thirdparty_seller->country_code)."'";
|
|
|
$sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
|
|
|
- if ($vatratecode) $sql .= " AND t.code ='".$db->escape($vatratecode)."'"; // If we have the code, we use it in priority
|
|
|
- else $sql .= " AND t.recuperableonly ='".$db->escape($vatnpr)."'";
|
|
|
+ if (!empty($vatratecode)) $sql .= " AND t.code ='".$db->escape($vatratecode)."'"; // If we have the code, we use it in priority
|
|
|
+ else $sql .= " AND t.recuperableonly = '".$db->escape($vatnpr)."'";
|
|
|
dol_syslog("get_localtax", LOG_DEBUG);
|
|
|
$resql = $db->query($sql);
|
|
|
|