From 2c7473b0649317f63372decee0b88565fd43e18f Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 23 May 2023 15:06:38 +0200 Subject: [PATCH 01/13] =?UTF-8?q?refs=20#5252=20feat:=20permite=20crear=20?= =?UTF-8?q?un=20abono=20con=20o=20sin=20almac=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/changes/232201/00-ticket_warehouse.sql | 1 + .../back/methods/invoiceOut/refund.js | 22 +++++++++---- .../front/descriptor-menu/index.html | 30 ++++++++++------- .../invoiceOut/front/descriptor-menu/index.js | 4 +-- .../front/descriptor-menu/locale/es.yml | 3 +- modules/ticket/back/methods/sale/refund.js | 13 +++++--- modules/ticket/back/methods/ticket/refund.js | 9 ++++-- .../ticket/front/descriptor-menu/index.html | 29 ++++++++++------- modules/ticket/front/descriptor-menu/index.js | 19 +++++------ .../front/descriptor-menu/locale/es.yml | 5 ++- modules/ticket/front/sale/index.html | 32 +++++++++++++------ modules/ticket/front/sale/index.js | 5 ++- modules/ticket/front/sale/locale/es.yml | 4 +-- 13 files changed, 114 insertions(+), 62 deletions(-) create mode 100644 db/changes/232201/00-ticket_warehouse.sql diff --git a/db/changes/232201/00-ticket_warehouse.sql b/db/changes/232201/00-ticket_warehouse.sql new file mode 100644 index 000000000..171538566 --- /dev/null +++ b/db/changes/232201/00-ticket_warehouse.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`ticket` MODIFY COLUMN warehouseFk smallint(6) unsigned DEFAULT 1 NULL; diff --git a/modules/invoiceOut/back/methods/invoiceOut/refund.js b/modules/invoiceOut/back/methods/invoiceOut/refund.js index ad480dc7d..c722d9806 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/refund.js +++ b/modules/invoiceOut/back/methods/invoiceOut/refund.js @@ -2,11 +2,19 @@ module.exports = Self => { Self.remoteMethod('refund', { description: 'Create refund tickets with sales and services if provided', accessType: 'WRITE', - accepts: [{ - arg: 'ref', - type: 'string', - description: 'The invoice reference' - }], + accepts: [ + { + arg: 'ref', + type: 'string', + description: 'The invoice reference', + required: true + }, + { + arg: 'withWarehouse', + type: 'boolean', + required: true + } + ], returns: { type: ['number'], root: true @@ -17,7 +25,7 @@ module.exports = Self => { } }); - Self.refund = async(ref, options) => { + Self.refund = async(ref, withWarehouse, options) => { const models = Self.app.models; const myOptions = {}; let tx; @@ -35,7 +43,7 @@ module.exports = Self => { const tickets = await models.Ticket.find(filter, myOptions); const ticketsIds = tickets.map(ticket => ticket.id); - const refundedTickets = await models.Ticket.refund(ticketsIds, myOptions); + const refundedTickets = await models.Ticket.refund(ticketsIds, withWarehouse, myOptions); if (tx) await tx.commit(); diff --git a/modules/invoiceOut/front/descriptor-menu/index.html b/modules/invoiceOut/front/descriptor-menu/index.html index 389fcf81b..106f8e3cc 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.html +++ b/modules/invoiceOut/front/descriptor-menu/index.html @@ -76,14 +76,27 @@ translate> Show CITES letter - - Refund + Refund... + + + + with warehouse + + + without warehouse + + + @@ -97,12 +110,7 @@ on-accept="$ctrl.bookInvoiceOut()" question="Are you sure you want to book this invoice?"> - - - @@ -148,4 +156,4 @@ - \ No newline at end of file + diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js index 57ea653a8..38c3c9434 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.js +++ b/modules/invoiceOut/front/descriptor-menu/index.js @@ -114,9 +114,9 @@ class Controller extends Section { }); } - refundInvoiceOut() { + refundInvoiceOut(withWarehouse) { const query = 'InvoiceOuts/refund'; - const params = {ref: this.invoiceOut.ref}; + const params = {ref: this.invoiceOut.ref, withWarehouse: withWarehouse}; this.$http.post(query, params).then(res => { const refundTicket = res.data; this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { diff --git a/modules/invoiceOut/front/descriptor-menu/locale/es.yml b/modules/invoiceOut/front/descriptor-menu/locale/es.yml index df0ba57cf..393efd58c 100644 --- a/modules/invoiceOut/front/descriptor-menu/locale/es.yml +++ b/modules/invoiceOut/front/descriptor-menu/locale/es.yml @@ -13,10 +13,11 @@ InvoiceOut deleted: Factura eliminada Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura? Are you sure you want to clone this invoice?: Estas seguro de clonar esta factura? InvoiceOut booked: Factura asentada -Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura? +Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura? Are you sure you want to refund this invoice?: Estas seguro de querer abonar esta factura? Create a single ticket with all the content of the current invoice: Crear un ticket unico con todo el contenido de la factura actual Regenerate PDF invoice: Regenerar PDF factura The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado The email can't be empty: El correo no puede estar vacío The following refund tickets have been created: "Se han creado los siguientes tickets de abono: {{ticketIds}}" +Refund...: Abono... diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index af58a6286..307407a27 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -11,6 +11,11 @@ module.exports = Self => { { arg: 'servicesIds', type: ['number'] + }, + { + arg: 'withWarehouse', + type: 'boolean', + required: true } ], returns: { @@ -23,7 +28,7 @@ module.exports = Self => { } }); - Self.refund = async(salesIds, servicesIds, options) => { + Self.refund = async(salesIds, servicesIds, withWarehouse, options) => { const models = Self.app.models; const myOptions = {}; let tx; @@ -65,7 +70,7 @@ module.exports = Self => { const now = Date.vnNew(); const [firstTicketId] = ticketsIds; - const refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); + const refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions); for (const sale of sales) { const createdSale = await models.Sale.create({ @@ -110,7 +115,7 @@ module.exports = Self => { } }; - async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions) { + async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions) { const models = Self.app.models; const filter = {include: {relation: 'address'}}; @@ -122,7 +127,7 @@ module.exports = Self => { addressFk: ticket.address().id, agencyModeFk: refundAgencyMode.id, nickname: ticket.address().nickname, - warehouseFk: ticket.warehouseFk, + warehouseFk: withWarehouse ? ticket.warehouseFk : null, companyFk: ticket.companyFk, landed: now, zoneFk: refoundZoneId diff --git a/modules/ticket/back/methods/ticket/refund.js b/modules/ticket/back/methods/ticket/refund.js index 91f48cfd6..fe17b7101 100644 --- a/modules/ticket/back/methods/ticket/refund.js +++ b/modules/ticket/back/methods/ticket/refund.js @@ -7,6 +7,11 @@ module.exports = Self => { arg: 'ticketsIds', type: ['number'], required: true + }, + { + arg: 'withWarehouse', + type: 'boolean', + required: true } ], returns: { @@ -19,7 +24,7 @@ module.exports = Self => { } }); - Self.refund = async(ticketsIds, options) => { + Self.refund = async(ticketsIds, withWarehouse, options) => { const models = Self.app.models; const myOptions = {}; let tx; @@ -41,7 +46,7 @@ module.exports = Self => { const services = await models.TicketService.find(filter, myOptions); const servicesIds = services.map(service => service.id); - const refundedTickets = await models.Sale.refund(salesIds, servicesIds, myOptions); + const refundedTickets = await models.Sale.refund(salesIds, servicesIds, withWarehouse, myOptions); if (tx) await tx.commit(); diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index c2ebc3e3a..afa5db41a 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -141,12 +141,27 @@ translate> Recalculate components - - Refund all + Refund all... + + + + with warehouse + + + without warehouse + + + @@ -319,14 +334,6 @@ message="Recalculate components"> - - - - this.vnApp.showSuccess(this.$t('Data saved!'))); } - async refund() { - const params = {ticketsIds: [this.id]}; + refund(withWarehouse) { + const params = {ticketsIds: [this.id], withWarehouse: withWarehouse}; const query = 'Tickets/refund'; - return this.$http.post(query, params).then(res => { - const refundTicket = res.data; - this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { - ticketId: refundTicket.id - })); - this.$state.go('ticket.card.sale', {id: refundTicket.id}); - }); + return this.$http.post(query, params) + .then(res => { + const refundTicket = res.data; + this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { + ticketId: refundTicket.id + })); + this.$state.go('ticket.card.sale', {id: refundTicket.id}); + }); } onSmsSend(sms) { diff --git a/modules/ticket/front/descriptor-menu/locale/es.yml b/modules/ticket/front/descriptor-menu/locale/es.yml index b51637524..3830523cf 100644 --- a/modules/ticket/front/descriptor-menu/locale/es.yml +++ b/modules/ticket/front/descriptor-menu/locale/es.yml @@ -10,7 +10,9 @@ Send CSV: Enviar CSV Send CSV Delivery Note: Enviar albarán en CSV Send PDF Delivery Note: Enviar albarán en PDF Show Proforma: Ver proforma -Refund all: Abonar todo +Refund all...: Abonar todo... +with warehouse: con almacén +without warehouse: sin almacén Invoice sent: Factura enviada The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}" Transfer client: Transferir cliente @@ -18,3 +20,4 @@ SMS Notify changes: SMS Notificar cambios PDF sent!: ¡PDF enviado! Already exist signed delivery note: Ya existe albarán de entrega firmado Are you sure you want to replace this delivery note?: ¿Seguro que quieres reemplazar este albarán de entrega? +Create a single ticket with all the content of the current ticket: Crea un ticket único con todo el contenido del ticket actual diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index b2c0db18d..689e34c63 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -481,7 +481,7 @@ on-accept="$ctrl.transferSales($ctrl.transfer.ticketId)"> - - Add claim + Add claim Unmark as reserved - - Refund - + + Refund... + + + + with warehouse + + + without warehouse + + + + diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index b7cdc22b9..332cf34c1 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -510,13 +510,12 @@ class Controller extends Section { }); } - createRefund() { + createRefund(withWarehouse) { const sales = this.selectedValidSales(); if (!sales) return; const salesIds = sales.map(sale => sale.id); - - const params = {salesIds: salesIds}; + const params = {salesIds: salesIds, withWarehouse: withWarehouse}; const query = 'Sales/refund'; this.$http.post(query, params).then(res => { const refundTicket = res.data; diff --git a/modules/ticket/front/sale/locale/es.yml b/modules/ticket/front/sale/locale/es.yml index 6eb558a56..0b1fd84ea 100644 --- a/modules/ticket/front/sale/locale/es.yml +++ b/modules/ticket/front/sale/locale/es.yml @@ -36,10 +36,10 @@ Warehouse: Almacen Agency: Agencia Shipped: F. envio Packaging: Encajado -Refund: Abono +Refund...: Abono... Promotion mana: Maná promoción Claim mana: Maná reclamación History: Historial Do you want to continue?: ¿Desea continuar? Claim out of time: Reclamación fuera de plazo -Do you want to create a claim?: ¿Quieres crear una reclamación? \ No newline at end of file +Do you want to create a claim?: ¿Quieres crear una reclamación? From 96feb24f122ee9e4edbc5470d4ebd078bc17ba49 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 25 May 2023 13:28:44 +0200 Subject: [PATCH 02/13] refs #5252 fix: back test --- .../invoiceOut/back/methods/invoiceOut/specs/refund.spec.js | 2 +- modules/ticket/back/methods/sale/specs/refund.spec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js index 35f2b4023..e2d17841f 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js @@ -15,7 +15,7 @@ describe('InvoiceOut refund()', () => { const options = {transaction: tx}; try { - const result = await models.InvoiceOut.refund('T1111111', options); + const result = await models.InvoiceOut.refund('T1111111', true, options); expect(result).toBeDefined(); diff --git a/modules/ticket/back/methods/sale/specs/refund.spec.js b/modules/ticket/back/methods/sale/specs/refund.spec.js index 83b3755e2..9c0ec73cc 100644 --- a/modules/ticket/back/methods/sale/specs/refund.spec.js +++ b/modules/ticket/back/methods/sale/specs/refund.spec.js @@ -22,7 +22,7 @@ describe('Sale refund()', () => { try { const options = {transaction: tx}; - const refundedTicket = await models.Sale.refund(salesIds, servicesIds, options); + const refundedTicket = await models.Sale.refund(salesIds, servicesIds, true, options); expect(refundedTicket).toBeDefined(); @@ -40,7 +40,7 @@ describe('Sale refund()', () => { try { const options = {transaction: tx}; - const ticket = await models.Sale.refund(salesIds, servicesIds, options); + const ticket = await models.Sale.refund(salesIds, servicesIds, true, options); const refundedTicket = await models.Ticket.findOne({ where: { From 71d8a355bd126428d85274d8aab799f903f13092 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 25 May 2023 15:03:22 +0200 Subject: [PATCH 03/13] refs #5252 fix: te2e --- e2e/helpers/selectors.js | 1 + e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js | 13 ++++++++++++- modules/ticket/front/sale/index.html | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 086909ebf..821120a74 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -595,6 +595,7 @@ export default { moreMenuUpdateDiscount: 'vn-item[name="discount"]', moreMenuRecalculatePrice: 'vn-item[name="calculatePrice"]', moreMenuRefund: 'vn-item[name="refund"]', + refundWithWarehouse: 'vn-item[name="refundWithWarehouse"]', moreMenuUpdateDiscountInput: 'vn-input-number[ng-model="$ctrl.edit.discount"] input', transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text', transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable', diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js index 2158eec8b..e5ba708cc 100644 --- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js +++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js @@ -224,14 +224,25 @@ describe('Ticket Edit sale path', () => { await page.accessToSection('ticket.card.sale'); }); - it('should select the third sale and create a refund', async() => { + it('should select the first sale and create a refund with warehouse', async() => { await page.waitToClick(selectors.ticketSales.firstSaleCheckbox); await page.waitToClick(selectors.ticketSales.moreMenu); await page.waitToClick(selectors.ticketSales.moreMenuRefund); + await page.waitToClick(selectors.ticketSales.refundWithWarehouse); await page.waitForSnackbar(); await page.waitForState('ticket.card.sale'); }); + // it('should select the first sale and create a refund without warehouse', async() => { + // await page.accessToSearchResult('15'); + // await page.waitToClick(selectors.ticketSales.firstSaleCheckbox); + // await page.waitToClick(selectors.ticketSales.moreMenu); + // await page.waitToClick(selectors.ticketSales.moreMenuRefund); + // await page.waitToClick(selectors.ticketSales.refundWithoutWarehouse); + // await page.waitForSnackbar(); + // await page.waitForState('ticket.card.sale'); + // }); + it('should show error trying to delete a ticket with a refund', async() => { await page.accessToSearchResult('16'); await page.waitToClick(selectors.ticketDescriptor.moreMenu); diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 689e34c63..0ed62641b 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -530,6 +530,7 @@ Unmark as reserved with warehouse without warehouse From 3ecfbe2052cb8acfaead97f91c1b3dd85baf2283 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 26 May 2023 12:03:36 +0200 Subject: [PATCH 04/13] refs #5252 refactor: creadas varaibles --- .../invoiceOut/back/methods/invoiceOut/specs/refund.spec.js | 3 ++- modules/ticket/back/methods/sale/specs/refund.spec.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js index e2d17841f..3d0ea6809 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/refund.spec.js @@ -3,6 +3,7 @@ const LoopBackContext = require('loopback-context'); describe('InvoiceOut refund()', () => { const userId = 5; + const withWarehouse = true; const activeCtx = { accessToken: {userId: userId}, }; @@ -15,7 +16,7 @@ describe('InvoiceOut refund()', () => { const options = {transaction: tx}; try { - const result = await models.InvoiceOut.refund('T1111111', true, options); + const result = await models.InvoiceOut.refund('T1111111', withWarehouse, options); expect(result).toBeDefined(); diff --git a/modules/ticket/back/methods/sale/specs/refund.spec.js b/modules/ticket/back/methods/sale/specs/refund.spec.js index 9c0ec73cc..b870a36f7 100644 --- a/modules/ticket/back/methods/sale/specs/refund.spec.js +++ b/modules/ticket/back/methods/sale/specs/refund.spec.js @@ -6,8 +6,8 @@ describe('Sale refund()', () => { const activeCtx = { accessToken: {userId: userId}, }; - const servicesIds = [3]; + const withWarehouse = true; beforeEach(() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ @@ -22,7 +22,7 @@ describe('Sale refund()', () => { try { const options = {transaction: tx}; - const refundedTicket = await models.Sale.refund(salesIds, servicesIds, true, options); + const refundedTicket = await models.Sale.refund(salesIds, servicesIds, withWarehouse, options); expect(refundedTicket).toBeDefined(); @@ -40,7 +40,7 @@ describe('Sale refund()', () => { try { const options = {transaction: tx}; - const ticket = await models.Sale.refund(salesIds, servicesIds, true, options); + const ticket = await models.Sale.refund(salesIds, servicesIds, withWarehouse, options); const refundedTicket = await models.Ticket.findOne({ where: { From 527116f1ec57527e296cd45c9267c88015d4e922 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 26 May 2023 12:20:02 +0200 Subject: [PATCH 05/13] refs #5252 fix: te2e --- e2e/helpers/selectors.js | 1 + .../05-ticket/01-sale/02_edit_sale.spec.js | 21 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 821120a74..65d446790 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -596,6 +596,7 @@ export default { moreMenuRecalculatePrice: 'vn-item[name="calculatePrice"]', moreMenuRefund: 'vn-item[name="refund"]', refundWithWarehouse: 'vn-item[name="refundWithWarehouse"]', + refundWithoutWarehouse: 'vn-item[name="refundWithoutWarehouse"]', moreMenuUpdateDiscountInput: 'vn-input-number[ng-model="$ctrl.edit.discount"] input', transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text', transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable', diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js index e5ba708cc..8699ee002 100644 --- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js +++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js @@ -220,7 +220,7 @@ describe('Ticket Edit sale path', () => { it('should log in as salesAssistant and navigate to ticket sales', async() => { await page.loginAndModule('salesAssistant', 'ticket'); - await page.accessToSearchResult('16'); + await page.accessToSearchResult('17'); await page.accessToSection('ticket.card.sale'); }); @@ -233,15 +233,15 @@ describe('Ticket Edit sale path', () => { await page.waitForState('ticket.card.sale'); }); - // it('should select the first sale and create a refund without warehouse', async() => { - // await page.accessToSearchResult('15'); - // await page.waitToClick(selectors.ticketSales.firstSaleCheckbox); - // await page.waitToClick(selectors.ticketSales.moreMenu); - // await page.waitToClick(selectors.ticketSales.moreMenuRefund); - // await page.waitToClick(selectors.ticketSales.refundWithoutWarehouse); - // await page.waitForSnackbar(); - // await page.waitForState('ticket.card.sale'); - // }); + it('should select the first sale and create a refund without warehouse', async() => { + await page.accessToSearchResult('18'); + await page.waitToClick(selectors.ticketSales.firstSaleCheckbox); + await page.waitToClick(selectors.ticketSales.moreMenu); + await page.waitToClick(selectors.ticketSales.moreMenuRefund); + await page.waitToClick(selectors.ticketSales.refundWithoutWarehouse); + await page.waitForSnackbar(); + await page.waitForState('ticket.card.sale'); + }); it('should show error trying to delete a ticket with a refund', async() => { await page.accessToSearchResult('16'); @@ -257,7 +257,6 @@ describe('Ticket Edit sale path', () => { it('should select the third sale and create a claim of it', async() => { await page.accessToSearchResult('16'); await page.accessToSection('ticket.card.sale'); - await page.waitToClick(selectors.ticketSales.firstSaleCheckbox); await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox); await page.waitToClick(selectors.ticketSales.moreMenu); await page.waitToClick(selectors.ticketSales.moreMenuCreateClaim); From fe32a2af050dd43bacb57db4029281b1f9479114 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 5 Jun 2023 08:35:07 +0200 Subject: [PATCH 06/13] refs #5667 RoleInherit & Sms: Translations added --- modules/account/back/locale/role-inherit/en.yml | 1 + modules/account/back/locale/role-inherit/es.yml | 1 + modules/client/back/locale/sms/en.yml | 10 ++++++++++ modules/client/back/locale/sms/es.yml | 10 ++++++++++ 4 files changed, 22 insertions(+) create mode 100644 modules/client/back/locale/sms/en.yml create mode 100644 modules/client/back/locale/sms/es.yml diff --git a/modules/account/back/locale/role-inherit/en.yml b/modules/account/back/locale/role-inherit/en.yml index 760881325..8422ecdce 100644 --- a/modules/account/back/locale/role-inherit/en.yml +++ b/modules/account/back/locale/role-inherit/en.yml @@ -1,4 +1,5 @@ name: subrole columns: + id: id role: rol inheritsFrom: inherits diff --git a/modules/account/back/locale/role-inherit/es.yml b/modules/account/back/locale/role-inherit/es.yml index c352c6ff2..10381628c 100644 --- a/modules/account/back/locale/role-inherit/es.yml +++ b/modules/account/back/locale/role-inherit/es.yml @@ -1,4 +1,5 @@ name: subrol columns: + id: id role: rol inheritsFrom: hereda diff --git a/modules/client/back/locale/sms/en.yml b/modules/client/back/locale/sms/en.yml new file mode 100644 index 000000000..cb52f80ec --- /dev/null +++ b/modules/client/back/locale/sms/en.yml @@ -0,0 +1,10 @@ +name: SMS +columns: + id: id + senderFk: sender + sender: sender number + destination: destination + message: message + statusCode: status code + status: status + created: created diff --git a/modules/client/back/locale/sms/es.yml b/modules/client/back/locale/sms/es.yml new file mode 100644 index 000000000..f314921c1 --- /dev/null +++ b/modules/client/back/locale/sms/es.yml @@ -0,0 +1,10 @@ +name: SMS +columns: + id: id + senderFk: remitente + sender: número remitente + destination: destinatario + message: mensaje + statusCode: código estado + status: estado + created: creado From 6ef7055bc97658a499744a1cc62f0497b1234633 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 6 Jun 2023 11:05:04 +0200 Subject: [PATCH 07/13] refs #5563 Display show values in logs --- front/salix/components/log/index.html | 6 ++-- front/salix/components/log/index.js | 41 +++++++++++++++++++++------ front/salix/components/log/style.scss | 4 +++ 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index d5675975b..a50bafe5d 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -75,16 +75,16 @@ {{::prop.nameI18n}}: - , + ,
{{::prop.nameI18n}}: - + - ← + ←
diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index ef1b370b5..362eb8089 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -64,29 +64,47 @@ export default class Controller extends Section { set logs(value) { this._logs = value; if (!value) return; + const empty = {}; const validations = window.validations; + const castJsonValue = this.castJsonValue; + for (const log of value) { - const oldValues = log.oldInstance || empty; - const newValues = log.newInstance || empty; + const notDelete = log.action != 'delete'; + const olds = (notDelete ? log.oldInstance : null) || empty; + const vals = (notDelete ? log.newInstance : log.oldInstance) || empty; const locale = validations[log.changedModel]?.locale || empty; log.changedModelI18n = firstUpper(locale.name) || log.changedModel; - let props = Object.keys(oldValues).concat(Object.keys(newValues)); + let props = Object.keys(olds).concat(Object.keys(vals)); props = [...new Set(props)]; log.props = []; for (const prop of props) { + if (prop.endsWith('$')) continue; log.props.push({ name: prop, nameI18n: firstUpper(locale.columns?.[prop]) || prop, - old: this.castJsonValue(oldValues[prop]), - new: this.castJsonValue(newValues[prop]) + old: getVal(olds, prop), + val: getVal(vals, prop) }); } log.props.sort( (a, b) => a.nameI18n.localeCompare(b.nameI18n)); } + + function getVal(vals, prop) { + let val, id; + const showProp = `${prop}$`; + + if (vals[showProp] != null) { + val = vals[showProp]; + id = vals[prop]; + } else + val = vals[prop]; + + return {val: castJsonValue(val), id}; + } } get models() { @@ -113,10 +131,6 @@ export default class Controller extends Section { : value; } - mainVal(prop, action) { - return action == 'delete' ? prop.old : prop.new; - } - relativeDate(dateVal) { if (dateVal == null) return ''; const date = new Date(dateVal); @@ -238,3 +252,12 @@ ngModule.vnComponent('vnLog', { url: '@' } }); + +ngModule.component('vnLogValue', { + template: + '' + + ' #{{::$ctrl.val.id}}', + bindings: { + val: ' .id-value { + font-size: .9rem; + color: $color-font-secondary; +} From 6f3704c365f4fb4ab90d959a3836743806e3cae0 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 6 Jun 2023 11:42:35 +0200 Subject: [PATCH 08/13] hotfix colors ticket advance ticket future --- db/changes/232202/00-procedurecanAdvance.sql | 127 ++++++++++++++++++ .../232202/00-procedurecanbePostponed.sql | 74 ++++++++++ modules/ticket/front/advance/index.html | 2 +- modules/ticket/front/advance/index.js | 7 - modules/ticket/front/future/index.html | 2 +- 5 files changed, 203 insertions(+), 9 deletions(-) create mode 100644 db/changes/232202/00-procedurecanAdvance.sql create mode 100644 db/changes/232202/00-procedurecanbePostponed.sql diff --git a/db/changes/232202/00-procedurecanAdvance.sql b/db/changes/232202/00-procedurecanAdvance.sql new file mode 100644 index 000000000..d82294b3c --- /dev/null +++ b/db/changes/232202/00-procedurecanAdvance.sql @@ -0,0 +1,127 @@ +DELIMITER $$ +$$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT) +BEGIN +/** + * Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar. + * + * @param vDateFuture Fecha de los tickets que se quieren adelantar. + * @param vDateToAdvance Fecha a cuando se quiere adelantar. + * @param vWarehouseFk Almacén + */ + + DECLARE vDateInventory DATE; + + SELECT inventoried INTO vDateInventory FROM config; + + DROP TEMPORARY TABLE IF EXISTS tmp.stock; + CREATE TEMPORARY TABLE tmp.stock + (itemFk INT PRIMARY KEY, + amount INT) + ENGINE = MEMORY; + + INSERT INTO tmp.stock(itemFk, amount) + SELECT itemFk, SUM(quantity) amount FROM + ( + SELECT itemFk, quantity + FROM itemTicketOut + WHERE shipped >= vDateInventory + AND shipped < vDateFuture + AND warehouseFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM itemEntryIn + WHERE landed >= vDateInventory + AND landed < vDateFuture + AND isVirtualStock = FALSE + AND warehouseInFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM itemEntryOut + WHERE shipped >= vDateInventory + AND shipped < vDateFuture + AND warehouseOutFk = vWarehouseFk + ) t + GROUP BY itemFk HAVING amount != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.filter; + CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) +SELECT + origin.ticketFk futureId, + dest.ticketFk id, + dest.state, + origin.futureState, + origin.futureIpt, + dest.ipt, + origin.workerFk, + origin.futureLiters, + origin.futureLines, + dest.shipped, + origin.shipped futureShipped, + dest.totalWithVat, + origin.totalWithVat futureTotalWithVat, + dest.agency, + origin.futureAgency, + dest.lines, + dest.liters, + origin.futureLines - origin.hasStock AS notMovableLines, + (origin.futureLines = origin.hasStock) AS isFullMovable, + origin.classColor futureClassColor, + dest.classColor + FROM ( + SELECT + s.ticketFk, + t.workerFk, + t.shipped, + t.totalWithVat, + st.name futureState, + t.addressFk, + am.name futureAgency, + count(s.id) futureLines, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt, + CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters, + SUM((s.quantity <= IFNULL(st.amount,0))) hasStock, + st.classColor + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state st ON st.id = ts.stateFk + JOIN agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + LEFT JOIN tmp.stock st ON st.itemFk = i.id + WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id + ) origin + JOIN ( + SELECT + t.id ticketFk, + t.addressFk, + st.name state, + GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt, + t.shipped, + t.totalWithVat, + am.name agency, + CAST(SUM(litros) AS DECIMAL(10,0)) liters, + CAST(COUNT(*) AS DECIMAL(10,0)) `lines`, + st.classColor + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN state st ON st.id = ts.stateFk + JOIN agencyMode am ON t.agencyModeFk = am.id + LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk + WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance) + AND t.warehouseFk = vWarehouseFk + AND st.order <= 5 + GROUP BY t.id + ) dest ON dest.addressFk = origin.addressFk + WHERE origin.hasStock != 0; + DROP TEMPORARY TABLE tmp.stock; +END$$ +DELIMITER ; diff --git a/db/changes/232202/00-procedurecanbePostponed.sql b/db/changes/232202/00-procedurecanbePostponed.sql new file mode 100644 index 000000000..9d42dcc4b --- /dev/null +++ b/db/changes/232202/00-procedurecanbePostponed.sql @@ -0,0 +1,74 @@ +DELIMITER $$ +$$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT) +BEGIN +/** + * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro + * + * @param vOriginDated Fecha en cuestión + * @param vFutureDated Fecha en el futuro a sondear + * @param vWarehouseFk Identificador de vn.warehouse + */ + DROP TEMPORARY TABLE IF EXISTS tmp.filter; + CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) + SELECT sv.ticketFk id, + sub2.id futureId, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt, + CAST(sum(litros) AS DECIMAL(10,0)) liters, + CAST(count(*) AS DECIMAL(10,0)) `lines`, + st.name state, + sub2.iptd futureIpt, + sub2.state futureState, + t.clientFk, + t.warehouseFk, + ts.alertLevel, + t.shipped, + sub2.shipped futureShipped, + t.workerFk, + st.code stateCode, + sub2.code futureStateCode, + st.classColor, + sub2.classColor futureClassColor + FROM vn.saleVolume sv + JOIN vn.sale s ON s.id = sv.saleFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticket t ON t.id = sv.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.country c ON c.id = p.countryFk + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + JOIN vn.alertLevel al ON al.id = ts.alertLevel + LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id + LEFT JOIN ( + SELECT * + FROM ( + SELECT + t.addressFk, + t.id, + t.shipped, + st.name state, + st.code, + st.classColor, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd + FROM vn.ticket t + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + WHERE t.shipped BETWEEN vFutureDated + AND util.dayend(vFutureDated) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id + ) sub + GROUP BY sub.addressFk + ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id + WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated) + AND t.warehouseFk = vWarehouseFk + AND al.code = 'FREE' + AND tp.ticketFk IS NULL + GROUP BY sv.ticketFk + HAVING futureId; +END$$ +DELIMITER ; diff --git a/modules/ticket/front/advance/index.html b/modules/ticket/front/advance/index.html index c937fe2ac..e6f16c965 100644 --- a/modules/ticket/front/advance/index.html +++ b/modules/ticket/front/advance/index.html @@ -150,7 +150,7 @@ {{::ticket.futureIpt | dashIfEmpty}} + class="chip {{ticket.futureClassColor}}"> {{::ticket.futureState | dashIfEmpty}} diff --git a/modules/ticket/front/advance/index.js b/modules/ticket/front/advance/index.js index 7b8008426..0cec41227 100644 --- a/modules/ticket/front/advance/index.js +++ b/modules/ticket/front/advance/index.js @@ -102,13 +102,6 @@ export default class Controller extends Section { return checkedLines; } - stateColor(state) { - if (state === 'OK') - return 'success'; - else if (state === 'Libre') - return 'notice'; - } - dateRange(value) { const minHour = new Date(value); minHour.setHours(0, 0, 0, 0); diff --git a/modules/ticket/front/future/index.html b/modules/ticket/front/future/index.html index 2f0290c27..78b0f9864 100644 --- a/modules/ticket/front/future/index.html +++ b/modules/ticket/front/future/index.html @@ -158,7 +158,7 @@ {{::ticket.futureIpt | dashIfEmpty}} + class="chip {{ticket.futureClassColor}}"> {{::ticket.futureState}} From 05111c9268a6cdf05b2c095c3a0a3ef33bf55cec Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 6 Jun 2023 11:43:14 +0200 Subject: [PATCH 09/13] hotfix test front --- modules/ticket/front/advance/index.spec.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/modules/ticket/front/advance/index.spec.js b/modules/ticket/front/advance/index.spec.js index 6874f914b..da8614ca5 100644 --- a/modules/ticket/front/advance/index.spec.js +++ b/modules/ticket/front/advance/index.spec.js @@ -61,24 +61,6 @@ describe('Component vnTicketAdvance', () => { }); }); - describe('stateColor()', () => { - it('should return success to the OK tickets', () => { - const ok = controller.stateColor(controller.$.model.data[0].state); - const notOk = controller.stateColor(controller.$.model.data[1].state); - - expect(ok).toEqual('success'); - expect(notOk).not.toEqual('success'); - }); - - it('should return success to the FREE tickets', () => { - const notFree = controller.stateColor(controller.$.model.data[0].state); - const free = controller.stateColor(controller.$.model.data[1].state); - - expect(free).toEqual('notice'); - expect(notFree).not.toEqual('notice'); - }); - }); - describe('dateRange()', () => { it('should return two dates with the hours at the start and end of the given date', () => { const now = Date.vnNew(); From bd4eee66066d560b36f5452eb8664d9054d0bde2 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 7 Jun 2023 14:17:46 +0200 Subject: [PATCH 10/13] refs #5252 eliminado warehouseFk = 1 por defecto #5252 --- db/changes/232201/00-ticket_warehouse.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/changes/232201/00-ticket_warehouse.sql b/db/changes/232201/00-ticket_warehouse.sql index 171538566..b5255ee3f 100644 --- a/db/changes/232201/00-ticket_warehouse.sql +++ b/db/changes/232201/00-ticket_warehouse.sql @@ -1 +1 @@ -ALTER TABLE `vn`.`ticket` MODIFY COLUMN warehouseFk smallint(6) unsigned DEFAULT 1 NULL; +ALTER TABLE `vn`.`ticket` MODIFY COLUMN warehouseFk smallint(6) unsigned DEFAULT NULL NULL; From 9a63ce86aa9cccdf060220ba0a125ff04b24ccf5 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 7 Jun 2023 23:54:27 +0200 Subject: [PATCH 11/13] refs #5667 filter by changes, align entity id to right, duplicated code remove from Log models --- front/salix/components/log/index.html | 15 +++-- front/salix/components/log/index.js | 14 +++-- front/salix/components/log/locale/es.yml | 3 + front/salix/components/log/style.scss | 1 + loopback/common/models/log.json | 61 ++++++++++++++++++- modules/account/back/models/role-log.json | 49 --------------- modules/account/back/models/user-log.json | 49 --------------- modules/claim/back/models/claim-log.json | 49 --------------- modules/client/back/models/client-log.json | 49 --------------- modules/entry/back/models/entry-log.json | 49 --------------- .../invoiceIn/back/models/invoice-in-log.json | 52 ---------------- modules/item/back/models/item-log.json | 49 --------------- modules/route/back/models/route-log.json | 49 --------------- .../shelving/back/models/shelving-log.json | 57 ++--------------- .../supplier/back/models/supplier-log.json | 49 --------------- modules/ticket/back/models/ticket-log.json | 57 ++--------------- modules/travel/back/models/travel-log.json | 49 --------------- .../back/models/device-production-log.json | 59 +++--------------- modules/worker/back/models/worker-log.json | 49 --------------- modules/zone/back/models/zone-log.json | 49 --------------- 20 files changed, 97 insertions(+), 761 deletions(-) diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index a50bafe5d..e6ade48fb 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -53,12 +53,10 @@ -
#{{::log.changedModelId}} - {{::log.changedModelValue}} + {{::log.changedModelValue}}
- .model-id { color: $color-font-secondary; font-size: .9rem; + float: right; } } } diff --git a/loopback/common/models/log.json b/loopback/common/models/log.json index 54046f072..6d246371c 100644 --- a/loopback/common/models/log.json +++ b/loopback/common/models/log.json @@ -1,4 +1,61 @@ { - "name": "Log", - "base": "VnModel" + "name": "Log", + "base": "VnModel", + "properties": { + "id": { + "id": true, + "type": "number", + "forceId": false + }, + "originFk": { + "type": "number", + "required": true + }, + "userFk": { + "type": "number" + }, + "action": { + "type": "string", + "required": true + }, + "changedModel": { + "type": "string" + }, + "oldInstance": { + "type": "object" + }, + "newInstance": { + "type": "object" + }, + "oldJson": { + "type": "String", + "mysql": {"columnName": "oldInstance"} + }, + "newJson": { + "type": "String", + "mysql": {"columnName": "newInstance"} + }, + "creationDate": { + "type": "date" + }, + "changedModelId": { + "type": "string" + }, + "changedModelValue": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "VnUser", + "foreignKey": "userFk" + } + }, + "scope": { + "order": ["creationDate DESC", "id DESC"] + } } diff --git a/modules/account/back/models/role-log.json b/modules/account/back/models/role-log.json index 510e98b68..324000b68 100644 --- a/modules/account/back/models/role-log.json +++ b/modules/account/back/models/role-log.json @@ -5,54 +5,5 @@ "mysql": { "table": "account.roleLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "number" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "Account", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/account/back/models/user-log.json b/modules/account/back/models/user-log.json index c5aa08e05..8c0234aca 100644 --- a/modules/account/back/models/user-log.json +++ b/modules/account/back/models/user-log.json @@ -5,54 +5,5 @@ "mysql": { "table": "account.userLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "number" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/claim/back/models/claim-log.json b/modules/claim/back/models/claim-log.json index 9f28af63e..2c061b08f 100644 --- a/modules/claim/back/models/claim-log.json +++ b/modules/claim/back/models/claim-log.json @@ -5,54 +5,5 @@ "mysql": { "table": "claimLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "number" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/client/back/models/client-log.json b/modules/client/back/models/client-log.json index 316dbe972..c0e69df35 100644 --- a/modules/client/back/models/client-log.json +++ b/modules/client/back/models/client-log.json @@ -5,54 +5,5 @@ "mysql": { "table": "clientLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "number" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/entry/back/models/entry-log.json b/modules/entry/back/models/entry-log.json index b4370e3bc..ac4d803d1 100644 --- a/modules/entry/back/models/entry-log.json +++ b/modules/entry/back/models/entry-log.json @@ -5,54 +5,5 @@ "mysql": { "table": "entryLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "string" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/invoiceIn/back/models/invoice-in-log.json b/modules/invoiceIn/back/models/invoice-in-log.json index 70892d0f9..43ebb4c55 100644 --- a/modules/invoiceIn/back/models/invoice-in-log.json +++ b/modules/invoiceIn/back/models/invoice-in-log.json @@ -5,57 +5,5 @@ "mysql": { "table": "invoiceInLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "string" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": [ - "creationDate DESC", - "id DESC" - ] } } diff --git a/modules/item/back/models/item-log.json b/modules/item/back/models/item-log.json index 19c132187..8b8534d11 100644 --- a/modules/item/back/models/item-log.json +++ b/modules/item/back/models/item-log.json @@ -5,54 +5,5 @@ "mysql": { "table": "itemLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "number" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/route/back/models/route-log.json b/modules/route/back/models/route-log.json index 93f570593..63c233bdd 100644 --- a/modules/route/back/models/route-log.json +++ b/modules/route/back/models/route-log.json @@ -5,54 +5,5 @@ "mysql": { "table": "routeLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "number" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/shelving/back/models/shelving-log.json b/modules/shelving/back/models/shelving-log.json index e8245f770..03a5dda1a 100644 --- a/modules/shelving/back/models/shelving-log.json +++ b/modules/shelving/back/models/shelving-log.json @@ -1,58 +1,9 @@ { - "name": "ShelvingLog", + "name": "ShelvingLog", "base": "Log", - "options": { - "mysql": { - "table": "shelvingLog" - } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "number" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" + "options": { + "mysql": { + "table": "shelvingLog" } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/supplier/back/models/supplier-log.json b/modules/supplier/back/models/supplier-log.json index 86fa2e54a..1fe4752a0 100644 --- a/modules/supplier/back/models/supplier-log.json +++ b/modules/supplier/back/models/supplier-log.json @@ -5,54 +5,5 @@ "mysql": { "table": "supplierLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "string" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/ticket/back/models/ticket-log.json b/modules/ticket/back/models/ticket-log.json index df04348da..d5d1e5520 100644 --- a/modules/ticket/back/models/ticket-log.json +++ b/modules/ticket/back/models/ticket-log.json @@ -1,58 +1,9 @@ { - "name": "TicketLog", + "name": "TicketLog", "base": "Log", - "options": { - "mysql": { - "table": "ticketLog" - } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "number" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" + "options": { + "mysql": { + "table": "ticketLog" } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/travel/back/models/travel-log.json b/modules/travel/back/models/travel-log.json index e781c2948..e01d57943 100644 --- a/modules/travel/back/models/travel-log.json +++ b/modules/travel/back/models/travel-log.json @@ -5,54 +5,5 @@ "mysql": { "table": "travelLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "string" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/worker/back/models/device-production-log.json b/modules/worker/back/models/device-production-log.json index 71c54a9c1..b87fe5e6b 100644 --- a/modules/worker/back/models/device-production-log.json +++ b/modules/worker/back/models/device-production-log.json @@ -1,55 +1,14 @@ { - "name": "DeviceProductionLog", - "base": "Log", - "options": { - "mysql": { - "table": "deviceProductionLog" - } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "deviceProduction": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "created": { - "type": "date" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "changedModel": { - "type": "string" - }, - "changedModelId": { - "type": "number" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "Account", - "foreignKey": "userFk" + "name": "DeviceProductionLog", + "base": "Log", + "options": { + "mysql": { + "table": "deviceProductionLog" } }, - "scope": { - "order": ["created DESC", "id DESC"] + "properties": { + "deviceProduction": { + "type": "number" + } } } diff --git a/modules/worker/back/models/worker-log.json b/modules/worker/back/models/worker-log.json index 6eb8b75be..1ca1ac5ff 100644 --- a/modules/worker/back/models/worker-log.json +++ b/modules/worker/back/models/worker-log.json @@ -5,54 +5,5 @@ "mysql": { "table": "workerLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "string" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } diff --git a/modules/zone/back/models/zone-log.json b/modules/zone/back/models/zone-log.json index 72dd305b2..403966ddd 100644 --- a/modules/zone/back/models/zone-log.json +++ b/modules/zone/back/models/zone-log.json @@ -5,54 +5,5 @@ "mysql": { "table": "zoneLog" } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "forceId": false - }, - "originFk": { - "type": "number", - "required": true - }, - "userFk": { - "type": "number" - }, - "action": { - "type": "string", - "required": true - }, - "changedModel": { - "type": "string" - }, - "oldInstance": { - "type": "object" - }, - "newInstance": { - "type": "object" - }, - "creationDate": { - "type": "date" - }, - "changedModelId": { - "type": "string" - }, - "changedModelValue": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - }, - "scope": { - "order": ["creationDate DESC", "id DESC"] } } From 5ba8a153169542d3efab62d0c11d612f4c1af7ff Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 8 Jun 2023 10:25:25 +0200 Subject: [PATCH 12/13] refs #5809 deploy 232401 dev in test --- CHANGELOG.md | 6 ++--- Dockerfile | 4 +-- Jenkinsfile | 8 +++--- .../00-ticket_warehouse.sql | 0 e2e/paths/06-claim/05_summary.spec.js | 6 ++++- .../order/front/catalog-search-panel/index.js | 4 +-- modules/order/front/catalog/index.html | 26 +++++++++---------- package-lock.json | 4 +-- webpack.config.js | 2 +- 9 files changed, 32 insertions(+), 28 deletions(-) rename db/changes/{232201 => 232401}/00-ticket_warehouse.sql (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92c4ee3aa..4f2c0e6e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2324.01] - 2023-06-08 ### Added -- - +- (Tickets -> Abono) Al abonar permite crear el ticket abono con almacén o sin almmacén +- (General -> Desplegables) Mejorada eficiencia de carga de datos ### Changed -- +- (General -> Permisos) Mejorada seguridad ### Fixed - diff --git a/Dockerfile b/Dockerfile index ee87cd0d0..e1173ad73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,9 +11,9 @@ RUN apt-get update \ ca-certificates \ gnupg2 \ graphicsmagick \ - && curl -fsSL https://deb.nodesource.com/setup_14.x | bash - \ + && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ && apt-get install -y --no-install-recommends nodejs \ - && npm install -g npm@8.19.2 + && npm install -g npm@9.6.6 # Puppeteer diff --git a/Jenkinsfile b/Jenkinsfile index 5f329ee61..cf9b8cd67 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,7 +39,7 @@ pipeline { NODE_ENV = "" } steps { - nodejs('node-v14') { + nodejs('node-v20') { sh 'npm install --no-audit --prefer-offline' sh 'gulp install --ci' } @@ -57,14 +57,14 @@ pipeline { parallel { stage('Frontend') { steps { - nodejs('node-v14') { + nodejs('node-v20') { sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' } } } stage('Backend') { steps { - nodejs('node-v14') { + nodejs('node-v20') { sh 'npm run test:back:ci' } } @@ -80,7 +80,7 @@ pipeline { CREDENTIALS = credentials('docker-registry') } steps { - nodejs('node-v14') { + nodejs('node-v20') { sh 'gulp build' } diff --git a/db/changes/232201/00-ticket_warehouse.sql b/db/changes/232401/00-ticket_warehouse.sql similarity index 100% rename from db/changes/232201/00-ticket_warehouse.sql rename to db/changes/232401/00-ticket_warehouse.sql diff --git a/e2e/paths/06-claim/05_summary.spec.js b/e2e/paths/06-claim/05_summary.spec.js index 9656ea656..1333ed01a 100644 --- a/e2e/paths/06-claim/05_summary.spec.js +++ b/e2e/paths/06-claim/05_summary.spec.js @@ -49,7 +49,11 @@ describe('Claim summary path', () => { }); it(`should click on the first sale ID making the item descriptor visible`, async() => { - await page.waitToClick(selectors.claimSummary.firstSaleItemId); + const firstItem = selectors.claimSummary.firstSaleItemId; + await page.evaluate(selectors => { + document.querySelector(selectors).scrollIntoView(); + }, firstItem); + await page.click(firstItem); await page.waitImgLoad(selectors.claimSummary.firstSaleDescriptorImage); const visible = await page.isVisible(selectors.claimSummary.itemDescriptorPopover); diff --git a/modules/order/front/catalog-search-panel/index.js b/modules/order/front/catalog-search-panel/index.js index ed0af1d6e..21c0c50fa 100644 --- a/modules/order/front/catalog-search-panel/index.js +++ b/modules/order/front/catalog-search-panel/index.js @@ -23,7 +23,7 @@ class Controller extends SearchPanel { addValue() { this.filter.values.push({}); - setTimeout(() => this.popover.relocate()); + setTimeout(() => this.parentPopover.relocate()); } changeTag() { @@ -36,7 +36,7 @@ ngModule.vnComponent('vnOrderCatalogSearchPanel', { controller: Controller, bindings: { onSubmit: '&?', - popover: ' @@ -31,7 +31,7 @@ label="Category"> - - @@ -104,20 +104,20 @@ on-close="$ctrl.onPopoverClose()">
- + class="colored"> Id: {{$ctrl.itemId}} - {{$ctrl.itemName}}
- + class="colored"> {{category.selection.name}} - + class="colored"> {{type.selection.name}} + class="colored">
{{::tagGroup.tagSelection.name}}: @@ -163,4 +163,4 @@
- \ No newline at end of file + diff --git a/package-lock.json b/package-lock.json index a224c4bb3..4ed50e256 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "salix-back", - "version": "23.22.01", + "version": "23.24.01", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "salix-back", - "version": "23.22.01", + "version": "23.24.01", "license": "GPL-3.0", "dependencies": { "axios": "^1.2.2", diff --git a/webpack.config.js b/webpack.config.js index 7a94b993d..a102b838e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,7 +9,7 @@ let mode = env == 'development' ? env : 'production'; let baseConfig = { entry: {salix: 'salix'}, - mode: mode, + mode, output: { path: path.join(__dirname, 'dist'), publicPath: '/' From dd72ac910748e175c8c8ec485c5e2d9b1d4b9114 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 8 Jun 2023 10:48:35 +0200 Subject: [PATCH 13/13] refs #5809 version 232601 init --- CHANGELOG.md | 9 +++++++++ db/changes/232601/.gitkeep | 0 package.json | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 db/changes/232601/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f2c0e6e5..ca342abbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2326.01] - 2023-06-29 + +### Added + +### Changed + +### Fixed +- + ## [2324.01] - 2023-06-08 ### Added diff --git a/db/changes/232601/.gitkeep b/db/changes/232601/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/package.json b/package.json index f1b3daca3..4358c86a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.24.01", + "version": "23.26.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0",