diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bace4411184..4dc1f7251c1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5811,9 +5811,12 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, if (($seller_in_cee && $buyer_in_cee)) { $isacompany = $thirdparty_buyer->isACompany(); if ($isacompany) { - if (!empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID) && !isValidVATID($thirdparty_buyer)) { - //print 'VATRULE 6'; - return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); + if (!empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + if (!isValidVATID($thirdparty_buyer)) { + //print 'VATRULE 6'; + return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); + } } //print 'VATRULE 3'; return 0;