From 6116ada156dd68e2b5e1e94fef8c8811c8fc9e7b Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 13 Feb 2024 09:35:39 +0100 Subject: [PATCH 1/3] fix: refs #6813 remove inserts --- db/routines/vn2008/procedures/recobro_credito.sql | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/db/routines/vn2008/procedures/recobro_credito.sql b/db/routines/vn2008/procedures/recobro_credito.sql index ca5304b6c..0db9d6e70 100644 --- a/db/routines/vn2008/procedures/recobro_credito.sql +++ b/db/routines/vn2008/procedures/recobro_credito.sql @@ -8,16 +8,10 @@ BEGIN END; START TRANSACTION; - INSERT INTO vn.clientCredit(clientFk, amount) - SELECT c.id, 0 - FROM vn.`client` c - JOIN vn.payMethod pm ON pm.id = c.payMethodFk - WHERE c.credit <> 0 AND pm.`code` = 'card'; - UPDATE vn.`client` c - JOIN vn.payMethod pm ON pm.id = c.payMethodFk + JOIN vn.payMethod pm ON pm.id = c.payMethodFk SET credit = 0 - WHERE pm.`code` = 'card'; + WHERE pm.`code` = 'card'; DROP TEMPORARY TABLE IF EXISTS clientes_credit; CREATE TEMPORARY TABLE clientes_credit @@ -44,10 +38,6 @@ BEGIN UPDATE Clientes JOIN clientes_credit USING(Id_Cliente) SET Clientes.Credito = newCredit; - - INSERT INTO credit(Id_Cliente, amount, Id_Trabajador) - SELECT Id_Cliente, newCredit, NULL - FROM clientes_credit; DROP TEMPORARY TABLE clientes_credit; COMMIT; From db2919b48208cd634ab8cea4d7d9f567fca32354 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 13 Feb 2024 11:05:21 +0100 Subject: [PATCH 2/3] fix: refs #6813 procedure --- db/routines/vn2008/procedures/recobro_credito.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn2008/procedures/recobro_credito.sql b/db/routines/vn2008/procedures/recobro_credito.sql index 0db9d6e70..3c8b6fbfe 100644 --- a/db/routines/vn2008/procedures/recobro_credito.sql +++ b/db/routines/vn2008/procedures/recobro_credito.sql @@ -8,10 +8,10 @@ BEGIN END; START TRANSACTION; - UPDATE vn.`client` c + UPDATE vn.client c JOIN vn.payMethod pm ON pm.id = c.payMethodFk SET credit = 0 - WHERE pm.`code` = 'card'; + WHERE pm.code = 'card'; DROP TEMPORARY TABLE IF EXISTS clientes_credit; CREATE TEMPORARY TABLE clientes_credit From 579f2abe5bd48bd05f5d25b7a9b66daf45038278 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 13 Feb 2024 11:16:00 +0100 Subject: [PATCH 3/3] fix: refs #6813 remove quotation marks --- db/routines/vn2008/procedures/recobro_credito.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn2008/procedures/recobro_credito.sql b/db/routines/vn2008/procedures/recobro_credito.sql index 3c8b6fbfe..0db9d6e70 100644 --- a/db/routines/vn2008/procedures/recobro_credito.sql +++ b/db/routines/vn2008/procedures/recobro_credito.sql @@ -8,10 +8,10 @@ BEGIN END; START TRANSACTION; - UPDATE vn.client c + UPDATE vn.`client` c JOIN vn.payMethod pm ON pm.id = c.payMethodFk SET credit = 0 - WHERE pm.code = 'card'; + WHERE pm.`code` = 'card'; DROP TEMPORARY TABLE IF EXISTS clientes_credit; CREATE TEMPORARY TABLE clientes_credit