From da099c1c0ea58e9442b3d16db6829b4789de9664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= <109105553+comaiteseb@users.noreply.github.com> Date: Tue, 16 Jan 2024 12:42:45 +0100 Subject: [PATCH 1/5] FIX #27536 --- htdocs/core/class/html.form.class.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9db677432d1..550d4cbc57f 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 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) && (!is_object($societe_acheteuse) || (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); From f53aa7c5050c992bdbb870bafb7acc998d315dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= <109105553+comaiteseb@users.noreply.github.com> Date: Tue, 16 Jan 2024 13:45:38 +0100 Subject: [PATCH 2/5] phpcs correction --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 550d4cbc57f..31ef838edad 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6509,7 +6509,7 @@ 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 SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries + // 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) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { From efdaa0c9ec9abc5484784f945edc7e186a7fd8b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= <109105553+comaiteseb@users.noreply.github.com> Date: Tue, 16 Jan 2024 13:49:15 +0100 Subject: [PATCH 3/5] phpcs correction --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 31ef838edad..36865cffac6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6510,7 +6510,7 @@ 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 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 + // 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) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { // We also add the buyer country code From b70faf91328b1e505056ee797580f9e9b2428f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= <109105553+comaiteseb@users.noreply.github.com> Date: Wed, 17 Jan 2024 11:04:26 +0100 Subject: [PATCH 4/5] oubli correction de la logique pour la TVA Intraco vers un particulier --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 36865cffac6..e696aa9dee4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6512,7 +6512,7 @@ class Form // 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) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { + 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 From ec23bc3c9051332f8bae00f6421e1d6bf9ef9bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= <109105553+comaiteseb@users.noreply.github.com> Date: Wed, 17 Jan 2024 16:03:14 +0100 Subject: [PATCH 5/5] Syntax error crrected --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e696aa9dee4..f18e3eb85a6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6512,7 +6512,7 @@ class Form // 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()) { + 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