refs #6915 test_master24_8 #2067
|
@ -34,6 +34,7 @@ module.exports = Self => {
|
||||||
const myOptions = {userId: ctx.req.accessToken.userId};
|
const myOptions = {userId: ctx.req.accessToken.userId};
|
||||||
let tx;
|
let tx;
|
||||||
let ticket;
|
let ticket;
|
||||||
|
let externalTickets = [];
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -89,7 +90,6 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let externalTickets = [];
|
|
||||||
for (const ticketId of tickets) {
|
for (const ticketId of tickets) {
|
||||||
ticket = await models.Ticket.findById(ticketId, {
|
ticket = await models.Ticket.findById(ticketId, {
|
||||||
include: [{
|
include: [{
|
||||||
|
@ -154,11 +154,10 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
await models.Route.cmrEmail(ctx, externalTickets);
|
|
||||||
return;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx && tx.isActive()) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
await models.Route.cmrEmail(ctx, externalTickets);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue