diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js index b9084d8d2..9d638ecf4 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js @@ -2,18 +2,24 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); describe('invoiceOut delete()', () => { - const invoiceId = 2; + const invoiceOutId = 2; const userId = 106; const activeCtx = { accessToken: {userId: userId}, }; + + beforeEach(() => { + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); it('should check that there is one ticket in the target invoiceOut', async() => { const tx = await models.InvoiceOut.beginTransaction({}); const options = {transaction: tx}; try { - const invoiceOut = await models.InvoiceOut.findById(invoiceId, {}, options); + const invoiceOut = await models.InvoiceOut.findById(invoiceOutId , {}, options); const tickets = await models.Ticket.find({where: {refFk: invoiceOut.ref}}, options); expect(tickets.length).toEqual(1); @@ -31,14 +37,10 @@ describe('invoiceOut delete()', () => { const options = {transaction: tx}; try { - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - active: activeCtx - }); - - await models.InvoiceOut.delete(invoiceId, options); + await models.InvoiceOut.delete(invoiceOutId, options); const originalTicket = await models.Ticket.findById(3, {}, options); - const deletedInvoiceOut = await models.InvoiceOut.findById(invoiceId, {}, options); + const deletedInvoiceOut = await models.InvoiceOut.findById(invoiceOutId, {}, options); expect(deletedInvoiceOut).toBeNull(); expect(originalTicket.refFk).toBeNull(); @@ -54,11 +56,7 @@ describe('invoiceOut delete()', () => { const tx = await models.InvoiceOut.beginTransaction({}); const options = {transaction: tx}; - try { - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - active: activeCtx - }); - + try { const filter = { where: { ASIEN: 2 @@ -110,10 +108,6 @@ describe('invoiceOut delete()', () => { const options = {transaction: tx}; try { - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - active: activeCtx - }); - const filter = { where: { ASIEN: 1 diff --git a/print/templates/email/book-entry-deleted/locale/en.yml b/print/templates/email/book-entry-deleted/locale/en.yml index c7408f114..11c18f2c9 100644 --- a/print/templates/email/book-entry-deleted/locale/en.yml +++ b/print/templates/email/book-entry-deleted/locale/en.yml @@ -2,4 +2,4 @@ Subject: Linked Accounting Entry Deleted Title: Linked Accounting Entry Deleted Description: The linked accounting entry that was associated with SAGE has been deleted.

Entry No. {0}

-This entry has been deleted because the associated invoice {0} has been removed. +This entry has been deleted because the associated invoice {1} has been removed. diff --git a/print/templates/email/book-entry-deleted/locale/es.yml b/print/templates/email/book-entry-deleted/locale/es.yml index ff2073b64..c40cf25fd 100644 --- a/print/templates/email/book-entry-deleted/locale/es.yml +++ b/print/templates/email/book-entry-deleted/locale/es.yml @@ -2,4 +2,4 @@ subject: Asiento contable enlazado eliminado title: Asiento contable enlazado eliminado description: Se ha borrado el asiento contable que se encuentraba enlazado a SAGE

Asientos nÂș {0}

- Este asiento se ha borrado porque se ha eliminado la factura asociada {0} + Este asiento se ha borrado porque se ha eliminado la factura asociada {1}