From 46abf2f57bafaca090d77e86ede873d40bc027c0 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 12 Aug 2024 10:27:26 +0200 Subject: [PATCH 1/5] fix(defaulter_filter): recovery subquery --- modules/client/back/methods/defaulter/filter.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/client/back/methods/defaulter/filter.js b/modules/client/back/methods/defaulter/filter.js index 40756b236..9f19dee0a 100644 --- a/modules/client/back/methods/defaulter/filter.js +++ b/modules/client/back/methods/defaulter/filter.js @@ -83,9 +83,14 @@ module.exports = Self => { LEFT JOIN account.user u ON u.id = c.salesPersonFk LEFT JOIN account.user uw ON uw.id = co.workerFk LEFT JOIN ( - SELECT MAX(started), clientFk, finished - FROM recovery - GROUP BY clientFk + SELECT r1.started, r1.clientFk, r1.finished + FROM recovery r1 + JOIN ( + SELECT MAX(started) AS maxStarted, clientFk + FROM recovery + GROUP BY clientFk + ) r2 ON r1.clientFk = r2.clientFk + AND r1.started = r2.maxStarted ) r ON r.clientFk = c.id LEFT JOIN workerDepartment wd ON wd.workerFk = u.id JOIN department dp ON dp.id = wd.departmentFk From 32d5ca0d5c3324d0e779239555ec5418f230962e Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 13 Aug 2024 11:37:08 +0200 Subject: [PATCH 2/5] fix: refs #6861 refs#6861 bySectorCollection --- .../vn/procedures/itemShelvingSale_addBySectorCollection.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql b/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql index c359c7c8d..26e661d9a 100644 --- a/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql +++ b/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql @@ -12,7 +12,7 @@ BEGIN DECLARE vSaleFk INT; DECLARE vSectorFk INT; DECLARE vSales CURSOR FOR - SELECT s.id + SELECT DISTINCT s.id FROM sectorCollectionSaleGroup sc JOIN saleGroupDetail sg ON sg.saleGroupFk = sc.saleGroupFk JOIN sale s ON sg.saleFk = s.id From a178c285c06f154ee3c0698f0a2e4d6db54eb09c Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 13 Aug 2024 10:44:54 +0000 Subject: [PATCH 3/5] fix(salix): #7867 avoid deactivate user when is supplier --- db/routines/vn/procedures/client_userDisable.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/routines/vn/procedures/client_userDisable.sql b/db/routines/vn/procedures/client_userDisable.sql index f2ba65c1c..da3c0efa1 100644 --- a/db/routines/vn/procedures/client_userDisable.sql +++ b/db/routines/vn/procedures/client_userDisable.sql @@ -21,6 +21,9 @@ BEGIN AND a.id IS NULL AND u.active AND c.created < util.VN_CURDATE() - INTERVAL vMonths MONTH + AND u.role NOT IN ( + SELECT id FROM `role` r WHERE r.name = 'supplier' + ) AND u.id NOT IN ( SELECT DISTINCT c.id FROM client c From befcf895342d6d8f57eb3bda53f0d2af9434e9ce Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 13 Aug 2024 11:18:23 +0000 Subject: [PATCH 4/5] fix(salix): #7867 apply SQL conventions --- db/routines/vn/procedures/client_userDisable.sql | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/client_userDisable.sql b/db/routines/vn/procedures/client_userDisable.sql index da3c0efa1..779ffd688 100644 --- a/db/routines/vn/procedures/client_userDisable.sql +++ b/db/routines/vn/procedures/client_userDisable.sql @@ -21,9 +21,7 @@ BEGIN AND a.id IS NULL AND u.active AND c.created < util.VN_CURDATE() - INTERVAL vMonths MONTH - AND u.role NOT IN ( - SELECT id FROM `role` r WHERE r.name = 'supplier' - ) + AND NOT u.role = (SELECT id FROM `role` WHERE name = 'supplier') AND u.id NOT IN ( SELECT DISTINCT c.id FROM client c From b268bf5eb76ef9bd4681ca5a1985194aa4929d59 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 14 Aug 2024 12:47:44 +0200 Subject: [PATCH 5/5] feat: refs #7811 Added autorestart param pm2 --- back/process.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/back/process.yml b/back/process.yml index 08fee7a93..94072b57d 100644 --- a/back/process.yml +++ b/back/process.yml @@ -3,4 +3,5 @@ apps: name: salix-back instances: 1 max_restarts: 0 + autorestart: false node_args: --tls-min-v1.0 --openssl-legacy-provider