8144-devToTest_2444 #3137

Merged
alexm merged 90 commits from 8144-devToTest_2444 into test 2024-10-22 06:07:15 +00:00
3 changed files with 8 additions and 35 deletions
Showing only changes of commit 681f82a3ae - Show all commits

View File

@ -37,7 +37,7 @@ module.exports = Self => {
const tickets = await models.Ticket.find({
where: {refFk: invoiceOut.ref}
}, myOptions);
const [bookEntry] = await models.Xdiario.find({
where: {
SERIE: invoiceOut.ref[0],
@ -55,13 +55,13 @@ module.exports = Self => {
if (bookEntry) {
if (bookEntry.enlazadoSage) {
const params = {
bookEntry: bookEntry.ASIEN,
bookEntry: bookEntry.ASIEN,
invoiceOutRef: invoiceOut.ref
}
};
await Self.rawSql(`SELECT util.notification_send('book-entry-deleted', ?, NULL)`,
[JSON.stringify(params)],
myOptions);
};
}
await models.Xdiario.destroyAll({
ASIEN: bookEntry.ASIEN

View File

@ -19,8 +19,7 @@ module.exports = async function(ctx, Self, tickets, options) {
const failedtickets = [];
for (const ticket of tickets) {
try {
await Self.rawSql(`CALL util.debugAdd('invoicingTicket', ?)`, [ticket.id], {userId},
myOptions);
await Self.rawSql(`CALL util.debugAdd('invoicingTicket', ?)`, [ticket.id], myOptions);
await Self.app.models.InvoiceOut.getSerial(
ticket.clientFk,

View File

@ -1,7 +1,7 @@
const models = require('vn-loopback/server/server').models;
const LoopBackContext = require('loopback-context');
fdescribe('Ticket Closure - closeAll function', () => {
describe('Ticket Closure - closeAll function', () => {
let ctx = {
req: {
getLocale: () => 'es',
@ -17,6 +17,7 @@ fdescribe('Ticket Closure - closeAll function', () => {
beforeEach(async() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({active: ctx.req});
tx = await models.Ticket.beginTransaction({});
options = {transaction: tx};
originalVnNew = Date.vnNew;
@ -32,34 +33,7 @@ fdescribe('Ticket Closure - closeAll function', () => {
await tx.rollback();
});
xit('should successfully close all tickets when conditions are met', async() => {
const ticketsBefore = await models.Ticket.find({
where: {
packages: {neq: 0}
}
}, options);
const packedTicketsIds = ticketsBefore.map(ticket => ticket.id);
const packedTicketsBefore = await models.TicketLastState.find({
where: {
ticketFk: {inq: packedTicketsIds},
lastState: 'Encajado'
}
}, options);
await models.Ticket.closeAll(ctx, options);
const packedTicketsAfter = await models.TicketLastState.find({
where: {
ticketFk: {inq: packedTicketsIds},
lastState: 'Encajado'
}
}, options);
expect(packedTicketsBefore.length).toBeGreaterThan(packedTicketsAfter.length);
});
fit('should set routeFk to NULL when conditions are met', async() => {
it('should set routeFk to NULL when conditions are met', async() => {
const ticketsBefore = await models.Ticket.find({
where: {
routeFk: {neq: null}