From 52457b964230af1eac10f328785d6c1c48f4deb8 Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 3 Apr 2024 07:09:07 +0200 Subject: [PATCH 01/15] feat: sin concatenar en el nombre --- db/routines/vn/procedures/itemTrash.sql | 56 ------------------- .../vn/procedures/item_setVisibleDiscard.sql | 8 +-- 2 files changed, 4 insertions(+), 60 deletions(-) delete mode 100644 db/routines/vn/procedures/itemTrash.sql diff --git a/db/routines/vn/procedures/itemTrash.sql b/db/routines/vn/procedures/itemTrash.sql deleted file mode 100644 index bbb30b78a..000000000 --- a/db/routines/vn/procedures/itemTrash.sql +++ /dev/null @@ -1,56 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemTrash`( - vItemFk INT, - vWarehouseFk INT, - vQuantity INT, - vIsTrash BOOLEAN) -BEGIN - DECLARE vTicketFk INT; - DECLARE vClientFk INT; - DECLARE vCompanyVnlFk INT DEFAULT 442; - DECLARE vCalc INT; - - SELECT barcodeToItem(vItemFk) INTO vItemFk; - - SELECT IF(vIsTrash, 200, 400) INTO vClientFk; - - SELECT t.id INTO vTicketFk - FROM ticket t - JOIN address a ON a.id=t.addressFk - WHERE t.warehouseFk = vWarehouseFk - AND t.clientFk = vClientFk - AND DATE(t.shipped) = util.VN_CURDATE() - AND a.isDefaultAddress - LIMIT 1; - - CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); - - IF vTicketFk IS NULL THEN - CALL ticket_add( - vClientFk, - util.VN_CURDATE(), - vWarehouseFk, - vCompanyVnlFk, - NULL, - NULL, - NULL, - util.VN_CURDATE(), - account.myUser_getId(), - FALSE, - vTicketFk); - END IF; - - INSERT INTO sale(ticketFk, itemFk, concept, quantity) - SELECT vTicketFk, - vItemFk, - CONCAT(longName,' ',worker_getCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)), - vQuantity - FROM item - WHERE id = vItemFk; - - UPDATE cache.visible - SET visible = visible - vQuantity - WHERE calc_id = vCalc - AND item_id = vItemFk; -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/item_setVisibleDiscard.sql b/db/routines/vn/procedures/item_setVisibleDiscard.sql index 1cc2a8871..c1792dbb9 100644 --- a/db/routines/vn/procedures/item_setVisibleDiscard.sql +++ b/db/routines/vn/procedures/item_setVisibleDiscard.sql @@ -23,11 +23,11 @@ BEGIN SELECT DEFAULT(companyFk) INTO vDefaultCompanyFk FROM vn.ticket LIMIT 1; - - IF vAddressFk IS NULL THEN + + IF vAddressFk IS NULL THEN SELECT pc.shortageAddressFk INTO vAddressShortage FROM productionConfig pc ; - ELSE + ELSE SET vAddressShortage = vAddressFk; END IF; @@ -65,7 +65,7 @@ BEGIN INSERT INTO sale(ticketFk, itemFk, concept, quantity) SELECT vTicketFk, vItemFk, - CONCAT(longName,' ', worker_getCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)), + longName, vQuantity FROM item WHERE id = vItemFk; From d71f3e0818e38a978a01ccb508ead3b409755cb1 Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 3 Apr 2024 09:02:34 +0200 Subject: [PATCH 02/15] test --- db/routines/vn/procedures/item_setVisibleDiscard.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/db/routines/vn/procedures/item_setVisibleDiscard.sql b/db/routines/vn/procedures/item_setVisibleDiscard.sql index c1792dbb9..59ffa0f66 100644 --- a/db/routines/vn/procedures/item_setVisibleDiscard.sql +++ b/db/routines/vn/procedures/item_setVisibleDiscard.sql @@ -13,6 +13,7 @@ BEGIN * @param vQuantity a dar de alta/baja * @param vAddressFk id address */ + DECLARE vTicketFk INT; DECLARE vClientFk INT; DECLARE vDefaultCompanyFk INT; From 90c26959af27b5c7abe43c20abbcd665ac50260f Mon Sep 17 00:00:00 2001 From: ivanm Date: Tue, 9 Apr 2024 13:39:33 +0200 Subject: [PATCH 03/15] refs #7161 change longName to name --- db/routines/vn/procedures/item_setVisibleDiscard.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/item_setVisibleDiscard.sql b/db/routines/vn/procedures/item_setVisibleDiscard.sql index 59ffa0f66..1f2dbee93 100644 --- a/db/routines/vn/procedures/item_setVisibleDiscard.sql +++ b/db/routines/vn/procedures/item_setVisibleDiscard.sql @@ -66,7 +66,7 @@ BEGIN INSERT INTO sale(ticketFk, itemFk, concept, quantity) SELECT vTicketFk, vItemFk, - longName, + name, vQuantity FROM item WHERE id = vItemFk; From 622075a9aa41c22673b1b8828d4ce22747c954d7 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 12 Apr 2024 09:21:34 +0200 Subject: [PATCH 04/15] fix(util): refs #7205 fix util.slowLog_prune --- db/routines/util/procedures/slowLog_prune.sql | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/db/routines/util/procedures/slowLog_prune.sql b/db/routines/util/procedures/slowLog_prune.sql index 7294be2f6..8e8aec30f 100644 --- a/db/routines/util/procedures/slowLog_prune.sql +++ b/db/routines/util/procedures/slowLog_prune.sql @@ -6,11 +6,19 @@ BEGIN */ DECLARE vSlowQueryLog INT DEFAULT @@slow_query_log; DECLARE vSqlLogBin INT DEFAULT @@SESSION.sql_log_bin; + DECLARE vLogExists BOOL; SET sql_log_bin = OFF; SET GLOBAL slow_query_log = OFF; - RENAME TABLE `mysql`.`slow_log` TO `mysql`.`slow_log_temp`; + SELECT COUNT(*) INTO vLogExists + FROM information_schema.TABLES + WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'slow_log'; + + IF vLogExists THEN + DROP TEMPORARY TABLE IF EXISTS `mysql`.`slow_log_temp`; + RENAME TABLE `mysql`.`slow_log` TO `mysql`.`slow_log_temp`; + END IF; DELETE FROM `mysql`.`slow_log_temp` WHERE start_time < TIMESTAMPADD(WEEK, -1, util.VN_NOW()); From ccf77ed356bfb24ec80d11ea6546458d59d8c81f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 12 Apr 2024 09:24:48 +0200 Subject: [PATCH 05/15] fix(util): refs #7205 util.slowLog_prune code clean --- db/routines/util/procedures/slowLog_prune.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/routines/util/procedures/slowLog_prune.sql b/db/routines/util/procedures/slowLog_prune.sql index 8e8aec30f..d676ae3d9 100644 --- a/db/routines/util/procedures/slowLog_prune.sql +++ b/db/routines/util/procedures/slowLog_prune.sql @@ -11,19 +11,19 @@ BEGIN SET sql_log_bin = OFF; SET GLOBAL slow_query_log = OFF; - SELECT COUNT(*) INTO vLogExists + SELECT COUNT(*) > 0 INTO vLogExists FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'slow_log'; IF vLogExists THEN - DROP TEMPORARY TABLE IF EXISTS `mysql`.`slow_log_temp`; - RENAME TABLE `mysql`.`slow_log` TO `mysql`.`slow_log_temp`; + DROP TEMPORARY TABLE IF EXISTS mysql.slow_log_temp; + RENAME TABLE mysql.slow_log TO mysql.slow_log_temp; END IF; - DELETE FROM `mysql`.`slow_log_temp` + DELETE FROM mysql.slow_log_temp WHERE start_time < TIMESTAMPADD(WEEK, -1, util.VN_NOW()); - RENAME TABLE `mysql`.`slow_log_temp` TO `mysql`.`slow_log`; + RENAME TABLE mysql.slow_log_temp TO mysql.slow_log; SET GLOBAL slow_query_log = vSlowQueryLog; SET sql_log_bin = vSqlLogBin; From b4862a8ce94dc86223967b38bc20da393841eeb5 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 12 Apr 2024 11:35:21 +0200 Subject: [PATCH 06/15] hotFix(claimBegginingModel): enable claimIsEditable and && --- modules/claim/back/models/claim-beginning.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/claim/back/models/claim-beginning.js b/modules/claim/back/models/claim-beginning.js index 4b870e5ea..d269b2285 100644 --- a/modules/claim/back/models/claim-beginning.js +++ b/modules/claim/back/models/claim-beginning.js @@ -19,7 +19,7 @@ module.exports = Self => { if (ticket.ticketFk != claim.ticketFk) throw new UserError(`Cannot create a new claimBeginning from a different ticket`); } - // await claimIsEditable(ctx); + await claimIsEditable(ctx); }); Self.observe('before delete', async ctx => { @@ -36,7 +36,7 @@ module.exports = Self => { if (ctx.options && ctx.options.transaction) myOptions.transaction = ctx.options.transaction; - const claimBeginning = await Self.findById(ctx.where.id); + const claimBeginning = ctx.instance ?? await Self.findById(ctx.where.id); const filter = { where: {id: claimBeginning.claimFk}, From a68b8431c5915ec958478f3d5112c6d4c504080d Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 15 Apr 2024 10:21:59 +0200 Subject: [PATCH 07/15] feat: refs #6938 add scope & acls --- .../10994-wheatLaurel/00-modifyAcls.sql | 4 ++ modules/worker/back/models/worker.json | 53 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 db/versions/10994-wheatLaurel/00-modifyAcls.sql diff --git a/db/versions/10994-wheatLaurel/00-modifyAcls.sql b/db/versions/10994-wheatLaurel/00-modifyAcls.sql new file mode 100644 index 000000000..5b264482a --- /dev/null +++ b/db/versions/10994-wheatLaurel/00-modifyAcls.sql @@ -0,0 +1,4 @@ +UPDATE salix.ACL SET principalId = "hr" WHERE property IN ('find','findById','findOne') AND model = "Worker"; + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES ('Worker', 'summary', 'READ', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index ed430f133..4b7e4a512 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -92,5 +92,58 @@ "model": "WorkerTeamCollegues", "foreignKey": "workerFk" } + }, + "scopes":{ + "summary": { + "fields": [ + [ + "id", + "firstName", + "lastName", + "bossFk", + "maritalStatus", + "originCountryFk", + "educationLevelFk", + "SSN", + "mobileExtension", + "code", + "locker", + "fi", + "birth", + "isF11Allowed" + ] + + ], + "include": [ + { + "relation": "user", + "scope": { + "fields": ["email", "name", "nickname", "roleFk"], + "include": { + "relation": "role", + "scope": { + "fields": ["name"] + } + } + } + }, { + "relation": "department", + "scope": { + "include": { + "relation": "department", + "scope": { + "fields": ["name"] + } + } + } + }, { + "relation": "boss" + }, { + "relation": "client" + }, { + "relation": "sip" + } + ] + } } } From 200cbd8d74bedf95605c3b8ab260fb2155100494 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 15 Apr 2024 11:03:57 +0200 Subject: [PATCH 08/15] fix: refs #6938 acls & scope --- db/versions/10994-wheatLaurel/00-modifyAcls.sql | 2 +- modules/worker/back/models/worker.json | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/db/versions/10994-wheatLaurel/00-modifyAcls.sql b/db/versions/10994-wheatLaurel/00-modifyAcls.sql index 5b264482a..905f67aba 100644 --- a/db/versions/10994-wheatLaurel/00-modifyAcls.sql +++ b/db/versions/10994-wheatLaurel/00-modifyAcls.sql @@ -1,4 +1,4 @@ UPDATE salix.ACL SET principalId = "hr" WHERE property IN ('find','findById','findOne') AND model = "Worker"; INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) - VALUES ('Worker', 'summary', 'READ', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file + VALUES ('Worker', '__get__summary', 'READ', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 4b7e4a512..0c4f91118 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -96,7 +96,6 @@ "scopes":{ "summary": { "fields": [ - [ "id", "firstName", "lastName", @@ -112,8 +111,7 @@ "birth", "isF11Allowed" ] - - ], + , "include": [ { "relation": "user", From 42fe7fb1e23e47cf6b07d846dd0ea57a3f1e9481 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 15 Apr 2024 11:32:44 +0200 Subject: [PATCH 09/15] feat(binlog): refs #4409 Disable order recalc from triggers --- db/routines/hedera/events/order_doRecalc.sql | 2 +- db/routines/hedera/procedures/order_requestRecalc.sql | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/db/routines/hedera/events/order_doRecalc.sql b/db/routines/hedera/events/order_doRecalc.sql index d355e1a55..bbc61924f 100644 --- a/db/routines/hedera/events/order_doRecalc.sql +++ b/db/routines/hedera/events/order_doRecalc.sql @@ -3,6 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `hedera`.`order_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2019-08-29 14:18:04.000' ON COMPLETION PRESERVE - ENABLE + DISABLE DO CALL order_doRecalc$$ DELIMITER ; diff --git a/db/routines/hedera/procedures/order_requestRecalc.sql b/db/routines/hedera/procedures/order_requestRecalc.sql index 4bcb1010e..990894bb6 100644 --- a/db/routines/hedera/procedures/order_requestRecalc.sql +++ b/db/routines/hedera/procedures/order_requestRecalc.sql @@ -10,6 +10,7 @@ proc: BEGIN LEAVE proc; END IF; - INSERT INTO orderRecalc SET orderFk = vSelf; + -- #4409 Disable order recalc + -- INSERT INTO orderRecalc SET orderFk = vSelf; END$$ DELIMITER ; From d7b06fe637ca4662cdd8672ba287ca03a2f07c76 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 15 Apr 2024 12:47:27 +0200 Subject: [PATCH 10/15] fix: refs #6938 scope --- modules/worker/back/models/worker.json | 67 +++++++++++++++++--------- 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 0c4f91118..10776af90 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -95,23 +95,6 @@ }, "scopes":{ "summary": { - "fields": [ - "id", - "firstName", - "lastName", - "bossFk", - "maritalStatus", - "originCountryFk", - "educationLevelFk", - "SSN", - "mobileExtension", - "code", - "locker", - "fi", - "birth", - "isF11Allowed" - ] - , "include": [ { "relation": "user", @@ -128,16 +111,56 @@ "relation": "department", "scope": { "include": { - "relation": "department", - "scope": { - "fields": ["name"] - } + "relation": "department" } } }, { "relation": "boss" }, { - "relation": "client" + "relation": "client", + "scope": { + "fields": [ + "id", + "name", + "fi", + "socialName", + "contact", + "street", + "city", + "postcode", + "email", + "mobile", + "isActive", + "credit", + "creditInsurance", + "iban", + "dueDay", + "isEqualizated", + "isFreezed", + "hasToInvoiceByAddress", + "hasToInvoice", + "isToBeMailed", + "hasSepaVnl", + "hasLcr", + "hasCoreVnl", + "hasCoreVnh", + "hasIncoterms", + "isTaxDataChecked", + "eypbc", + "quality", + "isVies", + "isRelevant", + "accountingAccount", + "created", + "sageTaxTypeFk", + "sageTransactionTypeFk", + "businessTypeFk", + "salesPersonFk", + "hasElectronicInvoice", + "rating", + "recommendedCredit" + ] + } }, { "relation": "sip" } From 3e1218463c03b2cda4ea390a262299b49d661fac Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 15 Apr 2024 14:44:18 +0200 Subject: [PATCH 11/15] fix: refs #6938 filters & scope --- modules/worker/back/models/worker.json | 18 ++++++--- modules/worker/front/card/index.js | 32 ++-------------- modules/worker/front/descriptor/index.js | 36 ++--------------- modules/worker/front/summary/index.js | 49 +++--------------------- 4 files changed, 25 insertions(+), 110 deletions(-) diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 10776af90..57dc80ec9 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -100,12 +100,20 @@ "relation": "user", "scope": { "fields": ["email", "name", "nickname", "roleFk"], - "include": { - "relation": "role", - "scope": { - "fields": ["name"] + "include": [ + { + "relation": "role", + "scope": { + "fields": ["name"] + } + }, + { + "relation": "emailUser", + "scope": { + "fields": ["email"] + } } - } + ] } }, { "relation": "department", diff --git a/modules/worker/front/card/index.js b/modules/worker/front/card/index.js index 9a40e31c2..1aa548db9 100644 --- a/modules/worker/front/card/index.js +++ b/modules/worker/front/card/index.js @@ -4,37 +4,13 @@ import ModuleCard from 'salix/components/module-card'; class Controller extends ModuleCard { reload() { const filter = { - include: [ - { - relation: 'user', - scope: { - fields: ['name', 'emailVerified'], - include: { - relation: 'emailUser', - scope: { - fields: ['email'] - } - } - } - }, { - relation: 'sip', - scope: { - fields: ['extension', 'secret'] - } - }, { - relation: 'department', - scope: { - include: { - relation: 'department' - } - } - } - ] + where: { + id: this.$params.id} }; return Promise.all([ - this.$http.get(`Workers/${this.$params.id}`, {filter}) - .then(res => this.worker = res.data), + this.$http.get(`Workers/summary`, {filter}) + .then(res => this.worker = res.data[0]), this.$http.get(`Workers/${this.$params.id}/activeContract`) .then(res => this.hasWorkCenter = res.data?.workCenterFk) ]); diff --git a/modules/worker/front/descriptor/index.js b/modules/worker/front/descriptor/index.js index d7962369c..ebf3d65ed 100644 --- a/modules/worker/front/descriptor/index.js +++ b/modules/worker/front/descriptor/index.js @@ -37,41 +37,11 @@ class Controller extends Descriptor { loadData() { const filter = { - include: [ - { - relation: 'user', - scope: { - fields: ['name', 'emailVerified'], - include: { - relation: 'emailUser', - scope: { - fields: ['email'] - } - } - } - }, { - relation: 'client', - scope: { - fields: ['fi'] - } - }, { - relation: 'sip', - scope: { - fields: ['extension'] - } - }, { - relation: 'department', - scope: { - include: { - relation: 'department' - } - } - } - ] + where: {id: this.id}, }; - return this.getData(`Workers/${this.id}`, {filter}) - .then(res => this.entity = res.data); + return this.getData(`Workers/summary`, {filter}) + .then(res => this.entity = res.data[0]); } getPassRequirements() { diff --git a/modules/worker/front/summary/index.js b/modules/worker/front/summary/index.js index 212609f58..d1a27a6d4 100644 --- a/modules/worker/front/summary/index.js +++ b/modules/worker/front/summary/index.js @@ -10,53 +10,14 @@ class Controller extends Summary { this.$.worker = null; if (!value) return; - const query = `Workers/${value.id}`; const filter = { - include: [ - { - relation: 'user', - scope: { - fields: ['name', 'roleFk'], - include: [{ - relation: 'role', - scope: { - fields: ['name'] - } - }, - { - relation: 'emailUser', - scope: { - fields: ['email'] - } - }] - } - }, - { - relation: 'client', - scope: {fields: ['fi', 'phone']} - }, - { - relation: 'boss', - scope: {fields: ['id', 'name']} - }, - { - relation: 'sip', - scope: {fields: ['extension']} - }, - { - relation: 'department', - scope: { - include: { - relation: 'department', - scope: {fields: ['id', 'code', 'name']} - } - } - } - ] + where: { + id: value.id + } }; - this.$http.get(query, {params: {filter}}).then(res => { - this.$.worker = res.data; + this.$http.get(`Workers/summary`, {filter}).then(res => { + this.$.worker = res.data[0]; }); } From 3c9ac9634b6c4ab5890bb232d2d68b9d12eb9a63 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 15 Apr 2024 15:02:45 +0200 Subject: [PATCH 12/15] fix: refs #6938 front tests --- modules/worker/front/descriptor/index.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/worker/front/descriptor/index.spec.js b/modules/worker/front/descriptor/index.spec.js index 4f7fa6a05..cee8b0def 100644 --- a/modules/worker/front/descriptor/index.spec.js +++ b/modules/worker/front/descriptor/index.spec.js @@ -14,14 +14,14 @@ describe('vnWorkerDescriptor', () => { describe('loadData()', () => { it(`should perform a get query to store the worker data into the controller`, () => { const id = 1; - const response = 'foo'; + const response = ['foo']; $httpBackend.whenGET('UserConfigs/getUserConfig').respond({}); - $httpBackend.expectRoute('GET', `Workers/${id}`).respond(response); + $httpBackend.expectRoute('GET', `Workers/summary`).respond(response); controller.id = id; $httpBackend.flush(); - expect(controller.worker).toEqual(response); + expect([controller.worker]).toEqual(response); }); }); From adb2249d2f8b4a74149e195b471963b2e317aade Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 15 Apr 2024 15:09:41 +0200 Subject: [PATCH 13/15] fix: refs #6938 e2e tests --- e2e/paths/03-worker/01_summary.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/paths/03-worker/01_summary.spec.js b/e2e/paths/03-worker/01_summary.spec.js index 51992b41d..3c6149726 100644 --- a/e2e/paths/03-worker/01_summary.spec.js +++ b/e2e/paths/03-worker/01_summary.spec.js @@ -2,7 +2,6 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Worker summary path', () => { - const workerId = 3; let browser; let page; beforeAll(async() => { @@ -10,7 +9,7 @@ describe('Worker summary path', () => { page = browser.page; await page.loginAndModule('employee', 'worker'); const httpDataResponse = page.waitForResponse(response => { - return response.status() === 200 && response.url().includes(`Workers/${workerId}`); + return response.status() === 200 && response.url().includes(`Workers/summary`); }); await page.accessToSearchResult('agencyNick'); await httpDataResponse; From 6e183b74264099ed0cb928d5f6d6ad3698f6e848 Mon Sep 17 00:00:00 2001 From: ivanm Date: Mon, 15 Apr 2024 15:59:05 +0200 Subject: [PATCH 14/15] refs #7161 change vAddress to vAddressShortage --- db/routines/vn/procedures/itemTrash.sql | 56 +++++++++++++++++++ .../vn/procedures/item_setVisibleDiscard.sql | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 db/routines/vn/procedures/itemTrash.sql diff --git a/db/routines/vn/procedures/itemTrash.sql b/db/routines/vn/procedures/itemTrash.sql new file mode 100644 index 000000000..bbb30b78a --- /dev/null +++ b/db/routines/vn/procedures/itemTrash.sql @@ -0,0 +1,56 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemTrash`( + vItemFk INT, + vWarehouseFk INT, + vQuantity INT, + vIsTrash BOOLEAN) +BEGIN + DECLARE vTicketFk INT; + DECLARE vClientFk INT; + DECLARE vCompanyVnlFk INT DEFAULT 442; + DECLARE vCalc INT; + + SELECT barcodeToItem(vItemFk) INTO vItemFk; + + SELECT IF(vIsTrash, 200, 400) INTO vClientFk; + + SELECT t.id INTO vTicketFk + FROM ticket t + JOIN address a ON a.id=t.addressFk + WHERE t.warehouseFk = vWarehouseFk + AND t.clientFk = vClientFk + AND DATE(t.shipped) = util.VN_CURDATE() + AND a.isDefaultAddress + LIMIT 1; + + CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); + + IF vTicketFk IS NULL THEN + CALL ticket_add( + vClientFk, + util.VN_CURDATE(), + vWarehouseFk, + vCompanyVnlFk, + NULL, + NULL, + NULL, + util.VN_CURDATE(), + account.myUser_getId(), + FALSE, + vTicketFk); + END IF; + + INSERT INTO sale(ticketFk, itemFk, concept, quantity) + SELECT vTicketFk, + vItemFk, + CONCAT(longName,' ',worker_getCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)), + vQuantity + FROM item + WHERE id = vItemFk; + + UPDATE cache.visible + SET visible = visible - vQuantity + WHERE calc_id = vCalc + AND item_id = vItemFk; +END$$ +DELIMITER ; diff --git a/db/routines/vn/procedures/item_setVisibleDiscard.sql b/db/routines/vn/procedures/item_setVisibleDiscard.sql index 1f2dbee93..0a6c54971 100644 --- a/db/routines/vn/procedures/item_setVisibleDiscard.sql +++ b/db/routines/vn/procedures/item_setVisibleDiscard.sql @@ -34,7 +34,7 @@ BEGIN SELECT a.clientFk INTO vClientFk FROM address a - WHERE a.id = vAddressFk; + WHERE a.id = vAddressShortage; SELECT t.id INTO vTicketFk FROM ticket t From 7fda58d4a4fef14dcd557c90fa7be07caadcf122 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 16 Apr 2024 12:29:44 +0200 Subject: [PATCH 15/15] hotfix: ticket#174308 Ekt load packing --- db/routines/edi/procedures/ekt_load.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/edi/procedures/ekt_load.sql b/db/routines/edi/procedures/ekt_load.sql index ccdcd1999..adbaf4628 100644 --- a/db/routines/edi/procedures/ekt_load.sql +++ b/db/routines/edi/procedures/ekt_load.sql @@ -147,7 +147,7 @@ proc:BEGIN (@t := IF(i.stems, i.stems, 1)) * e.pri / IFNULL(i.stemMultiplier, 1) buyingValue, IFNULL(vItem, vDefaultEntry) itemFk, e.qty stickers, - @pac := IFNULL(i.stemMultiplier, 1) * e.pac / @t packing, + @pac := GREATEST(1, i.stemMultiplier * e.pac / @t) packing, IFNULL(b.`grouping`, e.pac), @pac * e.qty, vForceToPacking,