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