From e3015a655917c69cfcfff66c11356db7141fe1bd Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 4 Sep 2024 14:52:53 +0200 Subject: [PATCH 01/12] feat: refs #7524 no apply limit --- loopback/common/models/vn-model.js | 10 +++++++--- modules/item/back/methods/item/getBalance.js | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/loopback/common/models/vn-model.js b/loopback/common/models/vn-model.js index a11bed11d..269ed673d 100644 --- a/loopback/common/models/vn-model.js +++ b/loopback/common/models/vn-model.js @@ -28,19 +28,19 @@ module.exports = function(Self) { }); this.beforeRemote('**', async ctx => { - if (!this.hasFilter(ctx)) return; + if (this.hasNoLimit(ctx) || !this.hasFilter(ctx)) return; const defaultLimit = this.app.orm.selectLimit; const filter = ctx.args.filter || {limit: defaultLimit}; - if (filter.limit > defaultLimit) { + if (!filter.limit || filter.limit > defaultLimit) { filter.limit = defaultLimit; ctx.args.filter = filter; } }); this.afterRemote('**', async ctx => { - if (!this.hasFilter(ctx)) return; + if (this.hasNoLimit(ctx) || !this.hasFilter(ctx)) return; const {result} = ctx; const length = Array.isArray(result) ? result.length : result ? 1 : 0; @@ -351,6 +351,10 @@ module.exports = function(Self) { hasFilter(ctx) { return ctx.req.method.toUpperCase() === 'GET' && ctx.method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object'); + }, + + hasNoLimit(ctx) { + return ctx.method.accepts.some(x => x.arg.toLowerCase() === 'nolimit') && ctx.args.noLimit; } }); diff --git a/modules/item/back/methods/item/getBalance.js b/modules/item/back/methods/item/getBalance.js index 207f8020f..1a4c7999d 100644 --- a/modules/item/back/methods/item/getBalance.js +++ b/modules/item/back/methods/item/getBalance.js @@ -8,6 +8,10 @@ module.exports = Self => { required: true, description: 'Filter defining where and paginated data', http: {source: 'query'} + }, { + arg: 'noLimit', + type: 'Boolean', + required: false, }], returns: { type: ['Object'], @@ -19,7 +23,7 @@ module.exports = Self => { } }); - Self.getBalance = async(ctx, filter, options) => { + Self.getBalance = async(ctx, filter, noLimit, options) => { const myOptions = {userId: ctx.req.accessToken.userId}; if (typeof options == 'object') From d82f9b2cd6e2f946ff37621e4226e4bdf91ac35b Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 4 Sep 2024 14:55:59 +0200 Subject: [PATCH 02/12] chore: refs #7524 fix test --- modules/item/back/methods/item/specs/getBalance.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/item/back/methods/item/specs/getBalance.spec.js b/modules/item/back/methods/item/specs/getBalance.spec.js index 95de3cc50..cef206411 100644 --- a/modules/item/back/methods/item/specs/getBalance.spec.js +++ b/modules/item/back/methods/item/specs/getBalance.spec.js @@ -23,7 +23,7 @@ describe('item getBalance()', () => { date: null } }; - const results = await models.Item.getBalance(ctx, filter, options); + const results = await models.Item.getBalance(ctx, filter, true, options); const result = results.find(element => element.clientType == 'loses'); @@ -57,8 +57,8 @@ describe('item getBalance()', () => { } }; - const firstItemBalance = await models.Item.getBalance(ctx, firstFilter, options); - const secondItemBalance = await models.Item.getBalance(ctx, secondFilter, options); + const firstItemBalance = await models.Item.getBalance(ctx, firstFilter, true, options); + const secondItemBalance = await models.Item.getBalance(ctx, secondFilter, true, options); expect(firstItemBalance[9].claimFk).toEqual(null); expect(secondItemBalance[7].claimFk).toEqual(1); From 0bbf10ca4f7d928cb3754889b1d289c67fe902d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 10 Sep 2024 12:59:07 +0200 Subject: [PATCH 03/12] fix: refs #7213 change rounding problems --- .../vn/procedures/sale_getProblems.sql | 24 ++++-- .../vn/procedures/sale_setProblemRounding.sql | 37 --------- .../sale_setProblemRoundingByBuy.sql | 75 ------------------- .../procedures/ticket_setProblemRounding.sql | 37 --------- 4 files changed, 19 insertions(+), 154 deletions(-) delete mode 100644 db/routines/vn/procedures/sale_setProblemRounding.sql delete mode 100644 db/routines/vn/procedures/sale_setProblemRoundingByBuy.sql delete mode 100644 db/routines/vn/procedures/ticket_setProblemRounding.sql diff --git a/db/routines/vn/procedures/sale_getProblems.sql b/db/routines/vn/procedures/sale_getProblems.sql index 7c5204e0d..352f7de4f 100644 --- a/db/routines/vn/procedures/sale_getProblems.sql +++ b/db/routines/vn/procedures/sale_getProblems.sql @@ -51,7 +51,6 @@ BEGIN hasTicketRequest, isTaxDataChecked, hasComponentLack, - hasRounding, isTooLittle) SELECT sgp.ticketFk, s.id, @@ -62,10 +61,6 @@ BEGIN IF(FIND_IN_SET('hasTicketRequest', t.problem), TRUE, FALSE) hasTicketRequest, IF(FIND_IN_SET('isTaxDataChecked', t.problem), FALSE, TRUE) isTaxDataChecked, IF(FIND_IN_SET('hasComponentLack', s.problem), TRUE, FALSE) hasComponentLack, - IF(FIND_IN_SET('hasRounding', s.problem), - LEFT(GROUP_CONCAT('RE: ', i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250), - NULL - ) hasRounding, IF(FIND_IN_SET('isTooLittle', t.problem) AND util.VN_NOW() < (util.VN_CURDATE() + INTERVAL HOUR(zc.`hour`) HOUR) + INTERVAL MINUTE(zc.`hour`) MINUTE, TRUE, FALSE) isTooLittle @@ -208,6 +203,25 @@ BEGIN GROUP BY sgp.ticketFk ) sub ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; + + CALL buyUltimate(vWarehouseFk, vDate); + INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk) + SELECT ticketFk, problem ,saleFk + FROM ( + SELECT tl.ticketFk, + s.id saleFk, + LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem + FROM tmp.ticket_list tl + JOIN ticket t ON t.id = tl.ticketFk + AND t.warehouseFk = vWarehouseFk + JOIN sale s ON s.ticketFk = tl.ticketFk + JOIN item i ON i.id = s.itemFk + JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk + JOIN buy b ON b.id = bu.buyFk + WHERE MOD(s.quantity, b.`grouping`) + GROUP BY tl.ticketFk + )sub + ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk; END LOOP; CLOSE vCursor; diff --git a/db/routines/vn/procedures/sale_setProblemRounding.sql b/db/routines/vn/procedures/sale_setProblemRounding.sql deleted file mode 100644 index 894749c7b..000000000 --- a/db/routines/vn/procedures/sale_setProblemRounding.sql +++ /dev/null @@ -1,37 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblemRounding`( - vSelf INT -) -BEGIN -/** - * Update the rounding problem for a sales line - * @param vSelf Id sale - */ - DECLARE vItemFk INT; - DECLARE vWarehouseFk INT; - DECLARE vShipped DATE; - DECLARE vQuantity INT; - DECLARE vIsProblemCalcNeeded BOOL; - - SELECT s.itemFk, t.warehouseFk, t.shipped, s.quantity, ticket_isProblemCalcNeeded(t.id) - INTO vItemFk, vWarehouseFk, vShipped, vQuantity, vIsProblemCalcNeeded - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - WHERE s.id = vSelf; - - CALL buy_getUltimate(vItemFk, vWarehouseFk, vShipped); - - CREATE OR REPLACE TEMPORARY TABLE tmp.sale - SELECT vSelf saleFk, - MOD(vQuantity, b.`grouping`) hasProblem, - vIsProblemCalcNeeded isProblemCalcNeeded - FROM tmp.buyUltimate bu - JOIN buy b ON b.id = bu.buyFk - WHERE bu.itemFk = vItemFk; - - CALL sale_setProblem('hasRounding'); - - DROP TEMPORARY TABLE tmp.sale; - DROP TEMPORARY TABLE tmp.buyUltimate; -END$$ -DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/procedures/sale_setProblemRoundingByBuy.sql b/db/routines/vn/procedures/sale_setProblemRoundingByBuy.sql deleted file mode 100644 index b0e286d25..000000000 --- a/db/routines/vn/procedures/sale_setProblemRoundingByBuy.sql +++ /dev/null @@ -1,75 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblemRoundingByBuy`( - vBuyFk INT -) -BEGIN -/** - * Update rounding problem for all sales related to a buy. - * - * @param vBuyFk Buy id - */ - DECLARE vItemFk INT; - DECLARE vWarehouseFk INT; - DECLARE vMaxDated DATE; - DECLARE vMinDated DATE; - DECLARE vLanding DATE; - DECLARE vLastBuy INT; - DECLARE vCurrentBuy INT; - DECLARE vGrouping INT; - - SELECT b.itemFk, t.warehouseInFk - INTO vItemFk, vWarehouseFk - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE b.id = vBuyFk; - - IF vItemFk AND vWarehouseFk THEN - SELECT DATE(MAX(t.shipped)) + INTERVAL 1 DAY, DATE(MIN(t.shipped)) - INTO vMaxDated, vMinDated - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - WHERE t.shipped >= util.VN_CURDATE() - AND s.itemFk = vItemFk - AND s.quantity > 0; - - CALL buy_getUltimate(vItemFk, vWarehouseFk, vMinDated); - - SELECT bu.buyFk, b.grouping INTO vLastBuy, vGrouping - FROM tmp.buyUltimate bu - JOIN buy b ON b.id = bu.buyFk; - - DROP TEMPORARY TABLE tmp.buyUltimate; - - SET vLanding = vMaxDated; - - WHILE vCurrentBuy <> vLastBuy OR vLanding > vMinDated DO - SET vMaxDated = vLanding - INTERVAL 1 DAY; - - CALL buy_getUltimate(vItemFk, vWarehouseFk, vMaxDated); - - SELECT buyFk, landing - INTO vCurrentBuy, vLanding - FROM tmp.buyUltimate; - - DROP TEMPORARY TABLE tmp.buyUltimate; - END WHILE; - - CREATE OR REPLACE TEMPORARY TABLE tmp.sale - (INDEX(saleFk, isProblemCalcNeeded)) - ENGINE = MEMORY - SELECT s.id saleFk, - MOD(s.quantity, vGrouping) hasProblem, - ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - WHERE s.itemFk = vItemFk - AND s.quantity > 0 - AND t.shipped BETWEEN vMinDated AND util.dayEnd(vMaxDated); - - CALL sale_setProblem('hasRounding'); - - DROP TEMPORARY TABLE tmp.sale; - END IF; -END$$ -DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/procedures/ticket_setProblemRounding.sql b/db/routines/vn/procedures/ticket_setProblemRounding.sql deleted file mode 100644 index 551cf67d1..000000000 --- a/db/routines/vn/procedures/ticket_setProblemRounding.sql +++ /dev/null @@ -1,37 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRounding`( - vSelf INT -) -BEGIN -/** - * Update the rounding problem for the sales lines of a ticket - * - * @param vSelf Id de ticket - */ - DECLARE vWarehouseFk INT; - DECLARE vDated DATE; - - SELECT warehouseFk, shipped - INTO vWarehouseFk, vDated - FROM ticket - WHERE id = vSelf; - - CALL buy_getUltimate(NULL, vWarehouseFk, vDated); - - CREATE OR REPLACE TEMPORARY TABLE tmp.sale - (INDEX(saleFk, isProblemCalcNeeded)) - SELECT s.id saleFk , - MOD(s.quantity, b.`grouping`) hasProblem, - ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk - JOIN buy b ON b.id = bu.buyFk - WHERE t.id = vSelf; - - CALL sale_setProblem('hasRounding'); - - DROP TEMPORARY TABLE tmp.sale; - DROP TEMPORARY TABLE tmp.buyUltimate; -END$$ -DELIMITER ; \ No newline at end of file From d98f0a24936e1bf9b4091f006c10926a9eaa4d0a Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 10 Sep 2024 13:15:58 +0200 Subject: [PATCH 04/12] chore: refs #7524 rollback --- modules/item/back/methods/item/getBalance.js | 9 +++------ modules/item/back/methods/item/specs/getBalance.spec.js | 6 +++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/item/back/methods/item/getBalance.js b/modules/item/back/methods/item/getBalance.js index 1a4c7999d..c835cd56f 100644 --- a/modules/item/back/methods/item/getBalance.js +++ b/modules/item/back/methods/item/getBalance.js @@ -8,10 +8,6 @@ module.exports = Self => { required: true, description: 'Filter defining where and paginated data', http: {source: 'query'} - }, { - arg: 'noLimit', - type: 'Boolean', - required: false, }], returns: { type: ['Object'], @@ -20,10 +16,11 @@ module.exports = Self => { http: { path: `/getBalance`, verb: 'GET' - } + }, + noLimit: true }); - Self.getBalance = async(ctx, filter, noLimit, options) => { + Self.getBalance = async(ctx, filter, options) => { const myOptions = {userId: ctx.req.accessToken.userId}; if (typeof options == 'object') diff --git a/modules/item/back/methods/item/specs/getBalance.spec.js b/modules/item/back/methods/item/specs/getBalance.spec.js index cef206411..95de3cc50 100644 --- a/modules/item/back/methods/item/specs/getBalance.spec.js +++ b/modules/item/back/methods/item/specs/getBalance.spec.js @@ -23,7 +23,7 @@ describe('item getBalance()', () => { date: null } }; - const results = await models.Item.getBalance(ctx, filter, true, options); + const results = await models.Item.getBalance(ctx, filter, options); const result = results.find(element => element.clientType == 'loses'); @@ -57,8 +57,8 @@ describe('item getBalance()', () => { } }; - const firstItemBalance = await models.Item.getBalance(ctx, firstFilter, true, options); - const secondItemBalance = await models.Item.getBalance(ctx, secondFilter, true, options); + const firstItemBalance = await models.Item.getBalance(ctx, firstFilter, options); + const secondItemBalance = await models.Item.getBalance(ctx, secondFilter, options); expect(firstItemBalance[9].claimFk).toEqual(null); expect(secondItemBalance[7].claimFk).toEqual(1); From 8fd7c1a8ddd775a7871631ee1d444e7c43bc5822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 10 Sep 2024 13:16:15 +0200 Subject: [PATCH 05/12] fix: refs #7213 change rounding problems --- db/routines/vn/procedures/sale_getProblems.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/routines/vn/procedures/sale_getProblems.sql b/db/routines/vn/procedures/sale_getProblems.sql index 352f7de4f..40b72a878 100644 --- a/db/routines/vn/procedures/sale_getProblems.sql +++ b/db/routines/vn/procedures/sale_getProblems.sql @@ -208,18 +208,18 @@ BEGIN INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk) SELECT ticketFk, problem ,saleFk FROM ( - SELECT tl.ticketFk, + SELECT sgp.ticketFk, s.id saleFk, LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem - FROM tmp.ticket_list tl - JOIN ticket t ON t.id = tl.ticketFk + FROM tmp.sale_getProblems sgp + JOIN ticket t ON t.id = sgp.ticketFk AND t.warehouseFk = vWarehouseFk - JOIN sale s ON s.ticketFk = tl.ticketFk + JOIN sale s ON s.ticketFk = sgp.ticketFk JOIN item i ON i.id = s.itemFk JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk JOIN buy b ON b.id = bu.buyFk WHERE MOD(s.quantity, b.`grouping`) - GROUP BY tl.ticketFk + GROUP BY sgp.ticketFk )sub ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk; END LOOP; From 1ff1a97f29e9638fddabb1bbaa6fc3d539d815d4 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 10 Sep 2024 13:21:56 +0200 Subject: [PATCH 06/12] feat: refs #7524 check noLimit method key --- loopback/common/models/vn-model.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/loopback/common/models/vn-model.js b/loopback/common/models/vn-model.js index 269ed673d..596ec0967 100644 --- a/loopback/common/models/vn-model.js +++ b/loopback/common/models/vn-model.js @@ -28,7 +28,7 @@ module.exports = function(Self) { }); this.beforeRemote('**', async ctx => { - if (this.hasNoLimit(ctx) || !this.hasFilter(ctx)) return; + if (ctx.method.noLimit || !this.hasFilter(ctx)) return; const defaultLimit = this.app.orm.selectLimit; const filter = ctx.args.filter || {limit: defaultLimit}; @@ -40,7 +40,7 @@ module.exports = function(Self) { }); this.afterRemote('**', async ctx => { - if (this.hasNoLimit(ctx) || !this.hasFilter(ctx)) return; + if (ctx.method.noLimit || !this.hasFilter(ctx)) return; const {result} = ctx; const length = Array.isArray(result) ? result.length : result ? 1 : 0; @@ -352,10 +352,5 @@ module.exports = function(Self) { return ctx.req.method.toUpperCase() === 'GET' && ctx.method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object'); }, - - hasNoLimit(ctx) { - return ctx.method.accepts.some(x => x.arg.toLowerCase() === 'nolimit') && ctx.args.noLimit; - } - }); }; From e3b51c81f9a4bd67cffa95e7e5ced1c80971c08a Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 10 Sep 2024 16:37:46 +0200 Subject: [PATCH 07/12] refactor: refs #7524 wrap it up in a fn --- loopback/common/models/vn-model.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/loopback/common/models/vn-model.js b/loopback/common/models/vn-model.js index 596ec0967..e24653d13 100644 --- a/loopback/common/models/vn-model.js +++ b/loopback/common/models/vn-model.js @@ -28,7 +28,7 @@ module.exports = function(Self) { }); this.beforeRemote('**', async ctx => { - if (ctx.method.noLimit || !this.hasFilter(ctx)) return; + if (!this.hasFilter(ctx)) return; const defaultLimit = this.app.orm.selectLimit; const filter = ctx.args.filter || {limit: defaultLimit}; @@ -40,7 +40,7 @@ module.exports = function(Self) { }); this.afterRemote('**', async ctx => { - if (ctx.method.noLimit || !this.hasFilter(ctx)) return; + if (!this.hasFilter(ctx)) return; const {result} = ctx; const length = Array.isArray(result) ? result.length : result ? 1 : 0; @@ -349,8 +349,10 @@ module.exports = function(Self) { }, hasFilter(ctx) { - return ctx.req.method.toUpperCase() === 'GET' && - ctx.method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object'); + const {method, req} = ctx; + if (method.noLimit) return false; + return req.method.toUpperCase() === 'GET' && + method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object'); }, }); }; From bebd49f08a84cde0acbf4a9a52362424e9293da0 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 11 Sep 2024 07:08:36 +0200 Subject: [PATCH 08/12] fix: debugAdd refs #6861 --- .../vn/procedures/itemShelvingSale_addBySectorCollection.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql b/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql index 26e661d9a..4f69c9a90 100644 --- a/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql +++ b/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql @@ -30,6 +30,8 @@ BEGIN FROM operator WHERE workerFk = account.myUser_getId(); + CALL util.debugAdd('itemShelvingSale_addBySectorCollection',CONCAT(vSectorCollectionFk,' - ', account.myUser_getId())); + OPEN vSales; l: LOOP SET vDone = FALSE; From ccaf56f8429052b824f6404f621758bbc8f374bd Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 11 Sep 2024 08:35:19 +0200 Subject: [PATCH 09/12] fix: setDeleted --- modules/ticket/back/methods/ticket/setDeleted.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/setDeleted.js b/modules/ticket/back/methods/ticket/setDeleted.js index 2afdf44ac..5000805b8 100644 --- a/modules/ticket/back/methods/ticket/setDeleted.js +++ b/modules/ticket/back/methods/ticket/setDeleted.js @@ -127,7 +127,7 @@ module.exports = Self => { id: id, url: `${url}ticket/${id}/summary` }); - await models.Chat.send(ctx, `@${salesPersonUser.name}`, message); + await models.Chat.sendCheckingPresence(ctx, `${salesPersonUser.id}`, message); } const updatedTicket = await ticket.updateAttribute('isDeleted', true, myOptions); From 838b8f541fb2e81d2ac9e64f2a1b48a2d628f97d Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 11 Sep 2024 08:45:00 +0200 Subject: [PATCH 10/12] fix: setDeleted --- modules/ticket/back/methods/ticket/setDeleted.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/setDeleted.js b/modules/ticket/back/methods/ticket/setDeleted.js index 5000805b8..8dfe42bf8 100644 --- a/modules/ticket/back/methods/ticket/setDeleted.js +++ b/modules/ticket/back/methods/ticket/setDeleted.js @@ -127,7 +127,7 @@ module.exports = Self => { id: id, url: `${url}ticket/${id}/summary` }); - await models.Chat.sendCheckingPresence(ctx, `${salesPersonUser.id}`, message); + await models.Chat.sendCheckingPresence(ctx, salesPersonUser.id, message); } const updatedTicket = await ticket.updateAttribute('isDeleted', true, myOptions); From ad8f27ea810b39bbc087ff32ceaf6cbf8827ecf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 11 Sep 2024 10:15:37 +0200 Subject: [PATCH 11/12] fix: refs #7213 change rounding problems --- .../vn/procedures/sale_getProblems.sql | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/db/routines/vn/procedures/sale_getProblems.sql b/db/routines/vn/procedures/sale_getProblems.sql index 40b72a878..133f3995a 100644 --- a/db/routines/vn/procedures/sale_getProblems.sql +++ b/db/routines/vn/procedures/sale_getProblems.sql @@ -204,9 +204,10 @@ BEGIN ) sub ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; + -- Redondeo: cantidad incorrecta con respecto al grouping CALL buyUltimate(vWarehouseFk, vDate); INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk) - SELECT ticketFk, problem ,saleFk + SELECT ticketFk, problem, saleFk FROM ( SELECT sgp.ticketFk, s.id saleFk, @@ -222,24 +223,11 @@ BEGIN GROUP BY sgp.ticketFk )sub ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk; + + DROP TEMPORARY TABLE tmp.buyUltimate; END LOOP; CLOSE vCursor; - INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk) - SELECT ticketFk, problem, saleFk - FROM ( - SELECT sgp.ticketFk, - s.id saleFk, - LEFT(GROUP_CONCAT('RE: ', i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem - FROM tmp.sale_getProblems sgp - JOIN ticket t ON t.id = sgp.ticketFk - JOIN sale s ON s.ticketFk = sgp.ticketFk - JOIN item i ON i.id = s.itemFk - WHERE FIND_IN_SET('hasRounding', s.problem) - GROUP BY sgp.ticketFk - ) sub - ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk; - DROP TEMPORARY TABLE tItemShelvingStock_byWarehouse; END$$ DELIMITER ; From 011c16180da509df54fc2aec304c89f651a274ad Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 11 Sep 2024 12:31:16 +0200 Subject: [PATCH 12/12] fix: refs #7213 buyUltimate --- db/routines/vn/procedures/sale_getProblems.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/sale_getProblems.sql b/db/routines/vn/procedures/sale_getProblems.sql index 133f3995a..da7c8d360 100644 --- a/db/routines/vn/procedures/sale_getProblems.sql +++ b/db/routines/vn/procedures/sale_getProblems.sql @@ -205,7 +205,7 @@ BEGIN ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; -- Redondeo: cantidad incorrecta con respecto al grouping - CALL buyUltimate(vWarehouseFk, vDate); + CALL buy_getUltimate(NULL, vWarehouseFk, vDate); INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk) SELECT ticketFk, problem, saleFk FROM (