diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index eeffd1aea4a..65f2233b7ae 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6509,14 +6509,31 @@ class Form } if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; - if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { + // If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries + // If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country + $selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); + if (isInEEC($societe_vendeuse) && isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()) { // We also add the buyer country code if (is_numeric($type)) { if ($type == 1) { // We know product is a service - $code_country .= ",'" . $societe_acheteuse->country_code . "'"; + switch ($selectVatComboMode) { + case '1': + $code_country .= ",'" . $societe_acheteuse->country_code . "'"; + break; + case '2': + $code_country = "'" . $societe_acheteuse->country_code . "'"; + break; + } } } elseif (!$idprod) { // We don't know type of product - $code_country .= ",'" . $societe_acheteuse->country_code . "'"; + switch ($selectVatComboMode) { + case '1': + $code_country .= ",'" . $societe_acheteuse->country_code . "'"; + break; + case '2': + $code_country = "'" . $societe_acheteuse->country_code . "'"; + break; + } } else { $prodstatic = new Product($this->db); $prodstatic->fetch($idprod);