From 6b76804913e5bf86dd014e326e43dd96f978f34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 28 Nov 2022 10:52:15 +0100 Subject: [PATCH 1/8] refs #4865 Sintaxis mensajes rocket --- loopback/locale/en.json | 8 ++++---- loopback/locale/es.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index ad110ec98..2abf17b4b 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -66,9 +66,9 @@ "MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} ({{clientId}})]({{{url}}}) to *{{credit}} €*", "Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})", "Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})", - "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked", - "Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*", - "Claim state has changed to canceled": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*", + "Claim will be picked": "The product from the claim [{{claimId}}]({{{claimUrl}}}) from the client *{{clientName}}* will be picked", + "Claim state has changed to incomplete": "The state of the claim [{{claimId}}]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*", + "Claim state has changed to canceled": "The state of the claim [{{claimId}}]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*", "Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member", "Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member", "Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}", @@ -134,7 +134,7 @@ "Password does not meet requirements": "Password does not meet requirements", "You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies", "Not enough privileges to edit a client": "Not enough privileges to edit a client", - "Claim pickup order sent": "Claim pickup order sent [({{claimId}})]({{{claimUrl}}}) to client *{{clientName}}*", + "Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*", "You don't have grant privilege": "You don't have grant privilege", "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user", "Ticket merged": "Ticket [{{id}}]({{{fullPath}}}) ({{{originDated}}}) merged with [{{tfId}}]({{{fullPathFuture}}}) ({{{futureDated}}})", diff --git a/loopback/locale/es.json b/loopback/locale/es.json index ecaae31b9..c1e09e9f6 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -134,9 +134,9 @@ "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*", "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})", "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})", - "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*", - "Claim state has changed to incomplete": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *incompleta*", - "Claim state has changed to canceled": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *anulado*", + "Claim will be picked": "Se recogerá el género de la reclamación [{{claimId}}]({{{claimUrl}}}) del cliente *{{clientName}}*", + "Claim state has changed to incomplete": "Se ha cambiado el estado de la reclamación [{{claimId}}]({{{claimUrl}}}) del cliente *{{clientName}}* a *incompleta*", + "Claim state has changed to canceled": "Se ha cambiado el estado de la reclamación [{{claimId}}]({{{claimUrl}}}) del cliente *{{clientName}}* a *anulado*", "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}", "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", "Distance must be lesser than 1000": "La distancia debe ser inferior a 1000", @@ -238,7 +238,7 @@ "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador", "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente", "This route does not exists": "Esta ruta no existe", - "Claim pickup order sent": "Reclamación Orden de recogida enviada [({{claimId}})]({{{claimUrl}}}) al cliente *{{clientName}}*", + "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*", "You don't have grant privilege": "No tienes privilegios para dar privilegios", "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario", "Ticket merged": "Ticket [{{id}}]({{{fullPath}}}) ({{{originDated}}}) fusionado con [{{tfId}}]({{{fullPathFuture}}}) ({{{futureDated}}})", From a86636bee48177291165ad28e2898ce9a241d198 Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 14 Dec 2022 13:49:49 +0100 Subject: [PATCH 2/8] Use proper module codes --- db/changes/225001/01-modules.sql | 60 ++++++++++++++++++++++++++ db/changes/225001/02-starredModule.sql | 16 +++++++ front/core/services/modules.js | 1 + front/salix/components/home/home.js | 15 +++++-- 4 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 db/changes/225001/01-modules.sql create mode 100644 db/changes/225001/02-starredModule.sql diff --git a/db/changes/225001/01-modules.sql b/db/changes/225001/01-modules.sql new file mode 100644 index 000000000..82861a5e2 --- /dev/null +++ b/db/changes/225001/01-modules.sql @@ -0,0 +1,60 @@ +UPDATE salix.module t +SET t.code = 'supplier' +WHERE t.code LIKE 'Suppliers' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'travel' +WHERE t.code LIKE 'Travels' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'ticket' +WHERE t.code LIKE 'Tickets' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'zone' +WHERE t.code LIKE 'Zones' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'monitor' +WHERE t.code LIKE 'Monitors' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'entry' +WHERE t.code LIKE 'Entries' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'invoiceIn' +WHERE t.code LIKE 'Invoices in' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'customer' +WHERE t.code LIKE 'Clients' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'route' +WHERE t.code LIKE 'Routes' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'item' +WHERE t.code LIKE 'Items' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'claim' +WHERE t.code LIKE 'Claims' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'user' +WHERE t.code LIKE 'Users' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'invoiceOut' +WHERE t.code LIKE 'Invoices out' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'order' +WHERE t.code LIKE 'Orders' ESCAPE '#'; + +UPDATE salix.module t +SET t.code = 'worker' +WHERE t.code LIKE 'Workers' ESCAPE '#'; + diff --git a/db/changes/225001/02-starredModule.sql b/db/changes/225001/02-starredModule.sql new file mode 100644 index 000000000..3ca67fce4 --- /dev/null +++ b/db/changes/225001/02-starredModule.sql @@ -0,0 +1,16 @@ +UPDATE `vn`.starredModule SET moduleFk = 'customer' WHERE moduleFk = 'Clients'; +UPDATE `vn`.starredModule SET moduleFk = 'ticket' WHERE moduleFk = 'Tickets'; +UPDATE `vn`.starredModule SET moduleFk = 'route' WHERE moduleFk = 'Routes'; +UPDATE `vn`.starredModule SET moduleFk = 'zone' WHERE moduleFk = 'Zones'; +UPDATE `vn`.starredModule SET moduleFk = 'order' WHERE moduleFk = 'Orders'; +UPDATE `vn`.starredModule SET moduleFk = 'claim' WHERE moduleFk = 'Claims'; +UPDATE `vn`.starredModule SET moduleFk = 'item' WHERE moduleFk = 'Items'; +UPDATE `vn`.starredModule SET moduleFk = 'worker' WHERE moduleFk = 'Workers'; +UPDATE `vn`.starredModule SET moduleFk = 'entry' WHERE moduleFk = 'Entries'; +UPDATE `vn`.starredModule SET moduleFk = 'invoiceOut' WHERE moduleFk = 'Invoices out'; +UPDATE `vn`.starredModule SET moduleFk = 'invoiceIn' WHERE moduleFk = 'Invoices in'; +UPDATE `vn`.starredModule SET moduleFk = 'monitor' WHERE moduleFk = 'Monitors'; +UPDATE `vn`.starredModule SET moduleFk = 'user' WHERE moduleFk = 'Users'; +UPDATE `vn`.starredModule SET moduleFk = 'supplier' WHERE moduleFk = 'Suppliers'; +UPDATE `vn`.starredModule SET moduleFk = 'travel' WHERE moduleFk = 'Travels'; +UPDATE `vn`.starredModule SET moduleFk = 'shelving' WHERE moduleFk = 'Shelvings'; \ No newline at end of file diff --git a/front/core/services/modules.js b/front/core/services/modules.js index 4b0d93b76..0b9f8409f 100644 --- a/front/core/services/modules.js +++ b/front/core/services/modules.js @@ -29,6 +29,7 @@ export default class Modules { const module = { name: mod.name || mod.module, + code: mod.module, icon: mod.icon || null, route, keyBind diff --git a/front/salix/components/home/home.js b/front/salix/components/home/home.js index 7a36e1d42..144a1c6d0 100644 --- a/front/salix/components/home/home.js +++ b/front/salix/components/home/home.js @@ -33,7 +33,9 @@ export default class Controller extends Component { if (!res.data.length) return; for (let starredModule of res.data) { - const module = this.modules.find(mod => mod.name === starredModule.moduleFk); + let moduleName = starredModule.moduleFk; + if (moduleName === 'customer') moduleName = 'client'; + const module = this.modules.find(mod => mod.code === moduleName); if (module) { module.starred = true; module.position = starredModule.position; @@ -47,8 +49,10 @@ export default class Controller extends Component { if (event.defaultPrevented) return; event.preventDefault(); event.stopPropagation(); + let moduleName = module.code; + if (moduleName === 'client') moduleName = 'customer'; - const params = {moduleName: module.name}; + const params = {moduleName}; const query = `starredModules/toggleStarredModule`; this.$http.post(query, params).then(res => { if (res.data) { @@ -84,13 +88,16 @@ export default class Controller extends Component { event.preventDefault(); event.stopPropagation(); - const params = {moduleName: module.name, direction: direction}; + let moduleName = module.code; + if (moduleName === 'client') moduleName = 'customer'; + + const params = {moduleName: moduleName, direction: direction}; const query = `starredModules/setPosition`; this.$http.post(query, params).then(res => { if (res.data) { module.position = res.data.movingModule.position; this.modules.forEach(mod => { - if (mod.name == res.data.pushedModule.moduleFk) + if (mod.code == res.data.pushedModule.moduleFk) mod.position = res.data.pushedModule.position; }); this.vnApp.showSuccess(this.$t('Data saved!')); From 11db08b32bc63dec9d68ba6d2718ffa1129d5832 Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 14 Dec 2022 14:20:41 +0100 Subject: [PATCH 3/8] Updated unit test --- .../specs/getStarredModules.spec.js | 4 +- .../starred-module/specs/setPosition.spec.js | 90 +++++++++---------- .../specs/toggleStarredModule.spec.js | 6 +- front/salix/components/home/home.spec.js | 22 ++--- 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/back/methods/starred-module/specs/getStarredModules.spec.js b/back/methods/starred-module/specs/getStarredModules.spec.js index b5d2f25c8..c962bc471 100644 --- a/back/methods/starred-module/specs/getStarredModules.spec.js +++ b/back/methods/starred-module/specs/getStarredModules.spec.js @@ -19,11 +19,11 @@ describe('getStarredModules()', () => { }); it(`should return the starred modules for a given user`, async() => { - const newStarred = await app.models.StarredModule.create({workerFk: 9, moduleFk: 'Clients', position: 1}); + const newStarred = await app.models.StarredModule.create({workerFk: 9, moduleFk: 'customer', position: 1}); const starredModules = await app.models.StarredModule.getStarredModules(ctx); expect(starredModules.length).toEqual(1); - expect(starredModules[0].moduleFk).toEqual('Clients'); + expect(starredModules[0].moduleFk).toEqual('customer'); // restores await app.models.StarredModule.destroyById(newStarred.id); diff --git a/back/methods/starred-module/specs/setPosition.spec.js b/back/methods/starred-module/specs/setPosition.spec.js index 6ac9cab16..5421bd62b 100644 --- a/back/methods/starred-module/specs/setPosition.spec.js +++ b/back/methods/starred-module/specs/setPosition.spec.js @@ -26,29 +26,29 @@ describe('setPosition()', () => { const filter = { where: { workerFk: ctx.req.accessToken.userId, - moduleFk: 'Orders' + moduleFk: 'order' } }; try { const options = {transaction: tx}; - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); let orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; let clients = await app.models.StarredModule.findOne(filter, options); expect(orders.position).toEqual(1); expect(clients.position).toEqual(2); - await app.models.StarredModule.setPosition(ctx, 'Clients', 'left', options); + await app.models.StarredModule.setPosition(ctx, 'customer', 'left', options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; clients = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; orders = await app.models.StarredModule.findOne(filter, options); expect(clients.position).toEqual(1); @@ -67,29 +67,29 @@ describe('setPosition()', () => { const filter = { where: { workerFk: ctx.req.accessToken.userId, - moduleFk: 'Orders' + moduleFk: 'order' } }; try { const options = {transaction: tx}; - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); let orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; let clients = await app.models.StarredModule.findOne(filter, options); expect(orders.position).toEqual(1); expect(clients.position).toEqual(2); - await app.models.StarredModule.setPosition(ctx, 'Orders', 'right', options); + await app.models.StarredModule.setPosition(ctx, 'order', 'right', options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; clients = await app.models.StarredModule.findOne(filter, options); expect(orders.position).toEqual(2); @@ -108,35 +108,35 @@ describe('setPosition()', () => { const filter = { where: { workerFk: ctx.req.accessToken.userId, - moduleFk: 'Items' + moduleFk: 'item' } }; try { const options = {transaction: tx}; - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Items', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Claims', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Zones', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'item', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'claim', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'zone', options); const items = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Claims'; + filter.where.moduleFk = 'claim'; const claims = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; let clients = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; let orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Zones'; + filter.where.moduleFk = 'zone'; const zones = await app.models.StarredModule.findOne(filter, options); expect(items.position).toEqual(1); @@ -145,12 +145,12 @@ describe('setPosition()', () => { expect(orders.position).toEqual(4); expect(zones.position).toEqual(5); - await app.models.StarredModule.setPosition(ctx, 'Clients', 'right', options); + await app.models.StarredModule.setPosition(ctx, 'customer', 'right', options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; clients = await app.models.StarredModule.findOne(filter, options); expect(orders.position).toEqual(3); @@ -169,31 +169,31 @@ describe('setPosition()', () => { const filter = { where: { workerFk: ctx.req.accessToken.userId, - moduleFk: 'Items' + moduleFk: 'item' } }; try { const options = {transaction: tx}; - await app.models.StarredModule.toggleStarredModule(ctx, 'Items', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Clients', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Claims', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders', options); - await app.models.StarredModule.toggleStarredModule(ctx, 'Zones', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'item', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'customer', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'claim', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'order', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'zone', options); const items = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; let clients = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Claims'; + filter.where.moduleFk = 'claim'; const claims = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; let orders = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Zones'; + filter.where.moduleFk = 'zone'; const zones = await app.models.StarredModule.findOne(filter, options); expect(items.position).toEqual(1); @@ -202,13 +202,13 @@ describe('setPosition()', () => { expect(orders.position).toEqual(4); expect(zones.position).toEqual(5); - await app.models.StarredModule.toggleStarredModule(ctx, 'Claims', options); - await app.models.StarredModule.setPosition(ctx, 'Clients', 'right', options); + await app.models.StarredModule.toggleStarredModule(ctx, 'claim', options); + await app.models.StarredModule.setPosition(ctx, 'customer', 'right', options); - filter.where.moduleFk = 'Clients'; + filter.where.moduleFk = 'customer'; clients = await app.models.StarredModule.findOne(filter, options); - filter.where.moduleFk = 'Orders'; + filter.where.moduleFk = 'order'; orders = await app.models.StarredModule.findOne(filter, options); expect(orders.position).toEqual(2); diff --git a/back/methods/starred-module/specs/toggleStarredModule.spec.js b/back/methods/starred-module/specs/toggleStarredModule.spec.js index 1aed4f54a..1195834e7 100644 --- a/back/methods/starred-module/specs/toggleStarredModule.spec.js +++ b/back/methods/starred-module/specs/toggleStarredModule.spec.js @@ -21,15 +21,15 @@ describe('toggleStarredModule()', () => { }); it('should create a new starred module and then remove it by calling the method again with same args', async() => { - const starredModule = await app.models.StarredModule.toggleStarredModule(ctx, 'Orders'); + const starredModule = await app.models.StarredModule.toggleStarredModule(ctx, 'order'); let starredModules = await app.models.StarredModule.getStarredModules(ctx); expect(starredModules.length).toEqual(1); - expect(starredModule.moduleFk).toEqual('Orders'); + expect(starredModule.moduleFk).toEqual('order'); expect(starredModule.workerFk).toEqual(activeCtx.accessToken.userId); expect(starredModule.position).toEqual(starredModules.length); - await app.models.StarredModule.toggleStarredModule(ctx, 'Orders'); + await app.models.StarredModule.toggleStarredModule(ctx, 'order'); starredModules = await app.models.StarredModule.getStarredModules(ctx); expect(starredModules.length).toEqual(0); diff --git a/front/salix/components/home/home.spec.js b/front/salix/components/home/home.spec.js index 4a8a58a55..5559ca1d4 100644 --- a/front/salix/components/home/home.spec.js +++ b/front/salix/components/home/home.spec.js @@ -19,7 +19,7 @@ describe('Salix Component vnHome', () => { describe('getStarredModules()', () => { it('should not set any of the modules as starred if there are no starred modules for the user', () => { const expectedResponse = []; - controller._modules = [{module: 'client', name: 'Clients'}]; + controller._modules = [{code: 'client', name: 'Clients'}]; $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse); $httpBackend.expectGET('starredModules/getStarredModules').respond(expectedResponse); @@ -31,8 +31,8 @@ describe('Salix Component vnHome', () => { }); it('should set the example module as starred since its the starred module for the user', () => { - const expectedResponse = [{id: 1, moduleFk: 'Clients', workerFk: 9}]; - controller._modules = [{module: 'client', name: 'Clients'}]; + const expectedResponse = [{id: 1, moduleFk: 'customer', workerFk: 9}]; + controller._modules = [{code: 'client', name: 'Clients'}]; $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse); $httpBackend.expectGET('starredModules/getStarredModules').respond(expectedResponse); @@ -48,7 +48,7 @@ describe('Salix Component vnHome', () => { it(`should set the received module as starred if it wasn't starred`, () => { const expectedResponse = [{id: 1, moduleFk: 'Clients', workerFk: 9}]; const event = new Event('target'); - controller._modules = [{module: 'client', name: 'Clients'}]; + controller._modules = [{code: 'client', name: 'Clients'}]; $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(expectedResponse); $httpBackend.expectPOST('starredModules/toggleStarredModule').respond(expectedResponse); @@ -61,7 +61,7 @@ describe('Salix Component vnHome', () => { it('should set the received module as regular if it was starred', () => { const event = new Event('target'); - controller._modules = [{module: 'client', name: 'Clients', starred: true}]; + controller._modules = [{code: 'client', name: 'Clients', starred: true}]; $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond([]); $httpBackend.expectPOST('starredModules/toggleStarredModule').respond(undefined); @@ -76,18 +76,18 @@ describe('Salix Component vnHome', () => { describe('moveModule()', () => { it('should perform a query to setPosition and the apply the position to the moved and pushed modules', () => { const starredModules = [ - {id: 1, moduleFk: 'Clients', workerFk: 9}, - {id: 2, moduleFk: 'Orders', workerFk: 9} + {id: 1, moduleFk: 'customer', workerFk: 9}, + {id: 2, moduleFk: 'order', workerFk: 9} ]; const movedModules = { - movingModule: {position: 2, moduleFk: 'Clients'}, - pushedModule: {position: 1, moduleFk: 'Orders'} + movingModule: {position: 2, moduleFk: 'customer'}, + pushedModule: {position: 1, moduleFk: 'order'} }; const event = new Event('target'); controller._modules = [ - {module: 'client', name: 'Clients', position: 1}, - {module: 'orders', name: 'Orders', position: 2} + {code: 'client', name: 'Clients', position: 1}, + {code: 'order', name: 'Orders', position: 2} ]; $httpBackend.whenRoute('GET', 'starredModules/getStarredModules').respond(starredModules); From 5cc8764a3f5f710e7c039ef42baa7b79d4811108 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 15 Dec 2022 13:54:17 +0100 Subject: [PATCH 4/8] acquireTimeout 10000 --- loopback/server/datasources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 00f6bf624..1e8e4820b 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -15,7 +15,7 @@ "legacyUtcDateProcessing": false, "timezone": "local", "connectTimeout": 40000, - "acquireTimeout": 20000, + "acquireTimeout": 10000, "waitForConnections": true }, "osticket": { From bab6fa0c9d2644b9fedd20331e590d44758e8fab Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 15 Dec 2022 14:02:18 +0100 Subject: [PATCH 5/8] acquireTimeout: 60000 --- loopback/server/datasources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 1e8e4820b..f5f277ffc 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -15,7 +15,7 @@ "legacyUtcDateProcessing": false, "timezone": "local", "connectTimeout": 40000, - "acquireTimeout": 10000, + "acquireTimeout": 60000, "waitForConnections": true }, "osticket": { From 4b16b413dc7f8a847a888c7333f5e772fd33fea3 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 15 Dec 2022 14:09:35 +0100 Subject: [PATCH 6/8] fixes #4990 acquireTimeout to 60000 --- loopback/server/datasources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 00f6bf624..f5f277ffc 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -15,7 +15,7 @@ "legacyUtcDateProcessing": false, "timezone": "local", "connectTimeout": 40000, - "acquireTimeout": 20000, + "acquireTimeout": 60000, "waitForConnections": true }, "osticket": { From 5b23ee6d5af16d98a04586d8567dfbeeb8e84db7 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 16 Dec 2022 08:10:39 +0100 Subject: [PATCH 7/8] Removed deprecated fields --- db/dump/fixtures.sql | 50 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 92b84be43..591f9b70d 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -216,18 +216,18 @@ INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) (3, 'PICKUP', 'Recogida'), (4, 'OTHER', 'Otros'); -INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `bankFk__`, `warehouseAliasFk`) +INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `warehouseAliasFk`) VALUES - (1, 'inhouse pickup' , 1, 1, 1), - (2, 'Super-Man delivery' , 1, 1, 1), - (3, 'Teleportation device' , 1, 1, 1), - (4, 'Entanglement' , 1, 1, 1), - (5, 'Quantum break device' , 1, 1, 1), - (6, 'Walking' , 1, 1, 1), - (7, 'Gotham247' , 1, 1, 1), - (8, 'Gotham247Expensive' , 1, 1, 1), - (9, 'Refund' , 1, 1, 1), - (10, 'Other agency' , 1, 1, 1); + (1, 'inhouse pickup' , 1, 1), + (2, 'Super-Man delivery' , 1, 1), + (3, 'Teleportation device' , 1, 1), + (4, 'Entanglement' , 1, 1), + (5, 'Quantum break device' , 1, 1), + (6, 'Walking' , 1, 1), + (7, 'Gotham247' , 1, 1), + (8, 'Gotham247Expensive' , 1, 1), + (9, 'Refund' , 1, 1), + (10, 'Other agency' , 1, 1); UPDATE `vn`.`agencyMode` SET `id` = 1 WHERE `name` = 'inhouse pickup'; UPDATE `vn`.`agencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery'; @@ -921,21 +921,21 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`) (3, 'Perdida', 'LOST'); -INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `itemFk__`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`) +INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`) VALUES - (1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1, 'pc1'), - (2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1, NULL), - (3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 18, 'UR9000006041', 94, 2, NULL), - (4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 18, 'UR9000006041', 94, 2, NULL), - (5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 3, NULL), - (6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 18, NULL, 94, 3, NULL), - (7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 18, NULL, 94, NULL,NULL), - (8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 18, NULL, 94, 1, NULL), - (9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 2, NULL), - (10, 7, 7, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL), - (11, 7, 8, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL), - (12, 7, 9, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL), - (13, 1, 10,71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL); + (1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, 'UR9000006041', 94, 1, 'pc1'), + (2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 18, 'UR9000006041', 94, 1, NULL), + (3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 18, 'UR9000006041', 94, 2, NULL), + (4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 18, 'UR9000006041', 94, 2, NULL), + (5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 3, NULL), + (6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 18, NULL, 94, 3, NULL), + (7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL), + (8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL), + (9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL), + (10, 7, 7, 71, NOW(), 1, 18, NULL, 94, 3, NULL), + (11, 7, 8, 71, NOW(), 1, 18, NULL, 94, 3, NULL), + (12, 7, 9, 71, NOW(), 1, 18, NULL, 94, 3, NULL), + (13, 1, 10,71, NOW(), 1, 18, NULL, 94, 3, NULL); INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`) From e7883d1c59c74ec8d947bc817deb20a6fe2944ef Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 16 Dec 2022 08:39:59 +0100 Subject: [PATCH 8/8] Removed deprecated foreign key --- db/dump/structure.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/dump/structure.sql b/db/dump/structure.sql index 403534787..f1d64d553 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -22282,7 +22282,7 @@ CREATE TABLE `agency` ( `name` varchar(25) COLLATE utf8mb3_unicode_ci NOT NULL, `warehouseFk` smallint(5) unsigned DEFAULT NULL COMMENT 'A nulo si se puede enrutar desde todos los almacenes', `isVolumetric__` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Si el calculo del porte se hacer por volumen', - `bankFk__` int(11) NOT NULL DEFAULT 8 COMMENT 'para realizar los reembolsos', + `bankFk__` int(11) DEFAULT 8 COMMENT 'para realizar los reembolsos', `warehouseAliasFk` smallint(5) unsigned DEFAULT NULL, `isOwn` tinyint(1) NOT NULL DEFAULT 0, `labelZone__` tinyint(4) NOT NULL DEFAULT 0, @@ -22297,7 +22297,6 @@ CREATE TABLE `agency` ( KEY `agency_ibfk_4_idx` (`supplierFk__`), CONSTRAINT `agency_FK` FOREIGN KEY (`warehouseAliasFk`) REFERENCES `warehouseAlias` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `agency_ibfk_2` FOREIGN KEY (`bankFk__`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_3` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */;