From 44f2cd4efc0abe6877eee71889bb1b0b29c0abb9 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 22 Apr 2024 14:04:07 +0200 Subject: [PATCH 1/2] feat: refs #7247 clientSupplier_add --- db/routines/sage/procedures/clientSupplier_add.sql | 4 ++-- db/versions/11006-chocolateCataractarum/00-firstScript.sql | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 db/versions/11006-chocolateCataractarum/00-firstScript.sql diff --git a/db/routines/sage/procedures/clientSupplier_add.sql b/db/routines/sage/procedures/clientSupplier_add.sql index 7a0aec6e2..70f3ef3d0 100644 --- a/db/routines/sage/procedures/clientSupplier_add.sql +++ b/db/routines/sage/procedures/clientSupplier_add.sql @@ -53,7 +53,7 @@ BEGIN IFNULL(c.street, ''), c.accountingAccount, @fi := IF(cu.code = LEFT(TRIM(c.fi), 2) AND c.isVies, MID(TRIM(c.fi), 3, LENGTH(TRIM(c.fi))-1), TRIM(c.fi)), - IF(c.isVies, CONCAT(cu.code, @fi ), TRIM(c.fi)), + IF(c.isVies, CONCAT(IFNULL(cu.viesCode,cu.code), @fi ), TRIM(c.fi)), IFNULL(c.postcode, ''), IFNULL(c.city, ''), IFNULL(pr.CodigoProvincia, ''), @@ -91,7 +91,7 @@ BEGIN IFNULL(s.street, ''), s.account, @nif := IF(co.code = LEFT(TRIM(s.nif), 2), MID(TRIM(s.nif), 3, LENGTH(TRIM(s.nif))-1), TRIM(s.nif)), - IF(s.isVies, CONCAT(co.code, @nif), TRIM(s.nif)), + IF(s.isVies, CONCAT(IFNULL(co.viesCode,co.code), @nif), TRIM(s.nif)), IFNULL(s.postCode,''), IFNULL(s.city, ''), IFNULL(pr.CodigoProvincia, ''), diff --git a/db/versions/11006-chocolateCataractarum/00-firstScript.sql b/db/versions/11006-chocolateCataractarum/00-firstScript.sql new file mode 100644 index 000000000..7eaaa101e --- /dev/null +++ b/db/versions/11006-chocolateCataractarum/00-firstScript.sql @@ -0,0 +1,7 @@ +-- Place your SQL code here +ALTER TABLE vn.country + ADD IF NOT EXISTS viesCode varchar(2) DEFAULT NULL NULL AFTER code; + +UPDATE vn.country + SET viesCode='FR' + WHERE country = 'Mónaco'; \ No newline at end of file -- 2.40.1 From c4a66b42bb411d37497a1a9cb33769558b0c82f9 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 8 May 2024 14:56:51 +0200 Subject: [PATCH 2/2] feat: refs #7247 Minor changes --- db/versions/11006-chocolateCataractarum/00-firstScript.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/db/versions/11006-chocolateCataractarum/00-firstScript.sql b/db/versions/11006-chocolateCataractarum/00-firstScript.sql index 7eaaa101e..8cc86a78f 100644 --- a/db/versions/11006-chocolateCataractarum/00-firstScript.sql +++ b/db/versions/11006-chocolateCataractarum/00-firstScript.sql @@ -1,7 +1,6 @@ --- Place your SQL code here ALTER TABLE vn.country ADD IF NOT EXISTS viesCode varchar(2) DEFAULT NULL NULL AFTER code; -UPDATE vn.country - SET viesCode='FR' - WHERE country = 'Mónaco'; \ No newline at end of file +UPDATE IGNORE vn.country + SET viesCode = 'FR' + WHERE code = 'MC'; -- Mónaco \ No newline at end of file -- 2.40.1