8524-devToTest #3415
|
@ -40,21 +40,23 @@ module.exports = Self => {
|
|||
|
||||
try {
|
||||
for (let ticket of tickets) {
|
||||
const originFullPath = `${url}ticket/${ticket.originId}/summary`;
|
||||
const destinationFullPath = `${url}ticket/${ticket.destinationId}/summary`;
|
||||
const message = $t('Ticket merged', {
|
||||
originDated: dateUtil.toString(new Date(ticket.originShipped)),
|
||||
destinationDated: dateUtil.toString(new Date(ticket.destinationShipped)),
|
||||
originId: ticket.originId,
|
||||
destinationId: ticket.destinationId,
|
||||
originFullPath,
|
||||
destinationFullPath
|
||||
});
|
||||
if (!ticket.originId || !ticket.destinationId) continue;
|
||||
|
||||
await models.Sale.updateAll({ticketFk: ticket.originId}, {ticketFk: ticket.destinationId}, myOptions);
|
||||
if (await models.Ticket.setDeleted(ctx, ticket.originId, myOptions))
|
||||
await models.Chat.sendCheckingPresence(ctx, ticket.workerFk, message);
|
||||
if (await models.Ticket.setDeleted(ctx, ticket.originId, myOptions)) {
|
||||
if (!ticket.salesPersonFk) continue;
|
||||
const originFullPath = `${url}ticket/${ticket.originId}/summary`;
|
||||
const destinationFullPath = `${url}ticket/${ticket.destinationId}/summary`;
|
||||
const message = $t('Ticket merged', {
|
||||
originDated: dateUtil.toString(new Date(ticket.originShipped)),
|
||||
destinationDated: dateUtil.toString(new Date(ticket.destinationShipped)),
|
||||
originId: ticket.originId,
|
||||
destinationId: ticket.destinationId,
|
||||
originFullPath,
|
||||
destinationFullPath
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, ticket.salesPersonFk, message);
|
||||
}
|
||||
}
|
||||
if (tx)
|
||||
await tx.commit();
|
||||
|
|
Loading…
Reference in New Issue