From 2dcc959488a870b6da705922be554d324402f4fb Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 7 May 2024 13:17:56 +0200 Subject: [PATCH 01/11] fix: refs #5699 clientsDisable --- db/routines/vn/events/clientsDisable.sql | 8 ++++++-- db/routines/vn/triggers/client_afterUpdate.sql | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/db/routines/vn/events/clientsDisable.sql b/db/routines/vn/events/clientsDisable.sql index 238e060dd..35e6554a2 100644 --- a/db/routines/vn/events/clientsDisable.sql +++ b/db/routines/vn/events/clientsDisable.sql @@ -7,15 +7,19 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`clientsDisable` DO BEGIN UPDATE account.user u JOIN client c ON c.id = u.id + LEFT JOIN account.account a ON a.id = u.id SET u.active = FALSE WHERE c.typeFk = 'normal' + AND a.id IS NULL + AND u.active + AND c.created < util.VN_CURDATE() - INTERVAL 12 MONTH AND u.id NOT IN ( SELECT DISTINCT c.id FROM client c LEFT JOIN ticket t ON t.clientFk = c.id WHERE c.salesPersonFk IS NOT NULL - OR t.created > util.VN_CURDATE() - INTERVAL 2 MONTH - OR shipped > util.VN_CURDATE() - INTERVAL 2 MONTH + OR t.created > util.VN_CURDATE() - INTERVAL 12 MONTH + OR shipped > util.VN_CURDATE() - INTERVAL 12 MONTH ); END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/client_afterUpdate.sql b/db/routines/vn/triggers/client_afterUpdate.sql index 481b00007..d35a5098b 100644 --- a/db/routines/vn/triggers/client_afterUpdate.sql +++ b/db/routines/vn/triggers/client_afterUpdate.sql @@ -8,7 +8,7 @@ BEGIN WHERE clientFk = NEW.id; UPDATE `address` SET isDefaultAddress = 1 - WHERE id = NEW.defaultAddressFk; + WHERE id = NEW.defaultAddressFk; END IF; IF NOT (NEW.provinceFk <=> OLD.provinceFk) OR NOT (NEW.isVies <=> OLD.isVies) THEN @@ -17,7 +17,7 @@ BEGIN WHERE t.clientFk = NEW.id AND t.refFk IS NULL; END IF; - + IF NOT NEW.isActive THEN UPDATE account.`user` SET active = FALSE From 5207f07c8031c46a5ad9215d819bbd7883a83f2a Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Wed, 8 May 2024 10:03:11 +0200 Subject: [PATCH 02/11] refs #6276 hotFix:itemShelving_add --- db/routines/vn/procedures/itemShelving_add.sql | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/itemShelving_add.sql b/db/routines/vn/procedures/itemShelving_add.sql index d4c31f09e..0bec9fb45 100644 --- a/db/routines/vn/procedures/itemShelving_add.sql +++ b/db/routines/vn/procedures/itemShelving_add.sql @@ -20,8 +20,11 @@ BEGIN SELECT barcodeToItem(vBarcode) INTO vItemFk; - SET vPacking = COALESCE(vPacking, GREATEST(vn.itemPacking(vBarcode,vWarehouseFk), 1)); - SET vQuantity = vQuantity * vPacking; + IF vPacking IS NULL + THEN + SET vPacking = itemPacking(vBarcode, vWarehouseFk); + SET vQuantity = vQuantity * vPacking; + END IF; IF (SELECT COUNT(*) FROM shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN From b0848edff85031aafff56043ea7eddc91fe6efec Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 8 May 2024 12:52:11 +0200 Subject: [PATCH 03/11] feat: refs #5699 quittar de client_afterUpdate desactivar cliente --- db/routines/vn/triggers/client_afterUpdate.sql | 6 ------ 1 file changed, 6 deletions(-) diff --git a/db/routines/vn/triggers/client_afterUpdate.sql b/db/routines/vn/triggers/client_afterUpdate.sql index 8bca36d63..e316fb08a 100644 --- a/db/routines/vn/triggers/client_afterUpdate.sql +++ b/db/routines/vn/triggers/client_afterUpdate.sql @@ -10,11 +10,5 @@ BEGIN UPDATE `address` SET isDefaultAddress = TRUE WHERE id = NEW.defaultAddressFk; END IF; - - IF NOT NEW.isActive THEN - UPDATE account.`user` - SET active = FALSE - WHERE id = NEW.id; - END IF; END$$ DELIMITER ; From f963923645211065557a580d69c2d58e88398132 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 9 May 2024 12:54:57 +0200 Subject: [PATCH 04/11] feat: refs #6223 pull master --- db/routines/vn/procedures/ticketCalculateClon.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/ticketCalculateClon.sql b/db/routines/vn/procedures/ticketCalculateClon.sql index 7ded84f45..a56491590 100644 --- a/db/routines/vn/procedures/ticketCalculateClon.sql +++ b/db/routines/vn/procedures/ticketCalculateClon.sql @@ -29,7 +29,7 @@ BEGIN FROM sale WHERE ticketFk = vTicketNew AND price > 0; - CALL sale_recalcComponent('imbalance'); + CALL sale_recalcComponent('buyerDiscount'); DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales; From ec060209aa9166c0f95d300451d8e45c37aea80f Mon Sep 17 00:00:00 2001 From: pako Date: Thu, 9 May 2024 18:53:32 +0200 Subject: [PATCH 05/11] done --- db/routines/vn/procedures/collection_assign.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/collection_assign.sql b/db/routines/vn/procedures/collection_assign.sql index 196764c42..c2b6e538e 100644 --- a/db/routines/vn/procedures/collection_assign.sql +++ b/db/routines/vn/procedures/collection_assign.sql @@ -30,7 +30,10 @@ BEGIN -- Si hay colecciones sin terminar, sale del proceso CALL collection_get(vUserFk); - SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 INTO vHasTooMuchCollections + SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, + collection_assign_lockname + INTO vHasTooMuchCollections, + vLockName FROM productionConfig pc LEFT JOIN tCollection ON TRUE; From 56815e4b1af531e4bca5b9306c605142211eb7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 10 May 2024 13:10:54 +0200 Subject: [PATCH 06/11] Ticket 180571 No se ven las ubicaciones --- db/versions/11045-redLaurel/00-firstScript.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 db/versions/11045-redLaurel/00-firstScript.sql diff --git a/db/versions/11045-redLaurel/00-firstScript.sql b/db/versions/11045-redLaurel/00-firstScript.sql new file mode 100644 index 000000000..e72bc46a5 --- /dev/null +++ b/db/versions/11045-redLaurel/00-firstScript.sql @@ -0,0 +1,3 @@ + +ALTER TABLE vn.productionConfig + ADD defaultSectorFk INT UNSIGNED DEFAULT 37 NOT NULL COMMENT 'Default sector'; \ No newline at end of file From 349c3d71dd99049b6ae15de4d12ffdd420f125b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 10 May 2024 13:14:23 +0200 Subject: [PATCH 07/11] Ticket 180571 No se ven las ubicaciones --- db/versions/11045-redLaurel/00-firstScript.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/versions/11045-redLaurel/00-firstScript.sql b/db/versions/11045-redLaurel/00-firstScript.sql index e72bc46a5..cc83f922f 100644 --- a/db/versions/11045-redLaurel/00-firstScript.sql +++ b/db/versions/11045-redLaurel/00-firstScript.sql @@ -1,3 +1,4 @@ + ALTER TABLE vn.productionConfig - ADD defaultSectorFk INT UNSIGNED DEFAULT 37 NOT NULL COMMENT 'Default sector'; \ No newline at end of file + ADD IF NOT EXISTS defaultSectorFk INT UNSIGNED DEFAULT 37 NOT NULL COMMENT 'Default sector'; \ No newline at end of file From a7910d98944039500704bf0ea19a9c4f75605077 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 10 May 2024 14:58:52 +0200 Subject: [PATCH 08/11] hotFix(invoiceInPdf): fix accessScopes --- modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js b/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js index 681a19fc6..1e9da86a4 100644 --- a/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js +++ b/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js @@ -29,7 +29,8 @@ module.exports = Self => { http: { path: '/:id/invoice-in-pdf', verb: 'GET' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.invoiceInPdf = (ctx, id) => Self.printReport(ctx, id, 'invoiceIn'); From 48392879cbc435105bfe421c14884a36342a25df Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 13 May 2024 10:59:22 +0200 Subject: [PATCH 09/11] fix: refs #4988 insert into agencyWorkCenter --- db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql index 179fbc63c..2a5e12e22 100644 --- a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql +++ b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql @@ -13,6 +13,7 @@ CREATE TABLE IF NOT EXISTS `vn`.`agencyWorkCenter` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #4988'; INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk) - SELECT id, workCenterFk - FROM vn.agency - WHERE workCenterFk IS NOT NULL; + SELECT a.id, wc.id + FROM agency a + JOIN warehouse w ON w.id = a.warehouseFk + JOIN workCenter wc ON wc.warehouseFk = w.id; \ No newline at end of file From c7eeaf238a5f6844f4d730df4a9aa19365e8f965 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 13 May 2024 11:04:50 +0200 Subject: [PATCH 10/11] fix: refs #4988 add schema --- db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql index 2a5e12e22..5a3012959 100644 --- a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql +++ b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql @@ -14,6 +14,6 @@ CREATE TABLE IF NOT EXISTS `vn`.`agencyWorkCenter` ( INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk) SELECT a.id, wc.id - FROM agency a - JOIN warehouse w ON w.id = a.warehouseFk - JOIN workCenter wc ON wc.warehouseFk = w.id; \ No newline at end of file + FROM vn.agency a + JOIN vn.warehouse w ON w.id = a.warehouseFk + JOIN vn.workCenter wc ON wc.warehouseFk = w.id; \ No newline at end of file From bde7fc997289ec7833472a3f1dfee24af0cb2ea4 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 13 May 2024 12:30:17 +0200 Subject: [PATCH 11/11] fix: refs #4988 no task id on table comment --- db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql index 5a3012959..6aeb52a41 100644 --- a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql +++ b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql @@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS `vn`.`agencyWorkCenter` ( CONSTRAINT `agencyWorkCenter_agency_FK` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE, CONSTRAINT `agencyWorkCenter_user_FK` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agencyWorkCenter_workCenter_FK` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #4988'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk) SELECT a.id, wc.id