Merge pull request 'fixes #5634 Adelantar el mismo ticket origen a múltiples tickets destino' (!1529) from 5634-ticketAdvance-mismoOrigen-multiplesDestinos into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1529 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
8d3ee18172
|
@ -63,11 +63,12 @@ module.exports = Self => {
|
||||||
newInstance: {mergedTicket: ticket.originId}
|
newInstance: {mergedTicket: ticket.originId}
|
||||||
};
|
};
|
||||||
|
|
||||||
await models.TicketLog.create(ticketDestinationLogRecord, myOptions);
|
|
||||||
await models.Sale.updateAll({ticketFk: ticket.originId}, {ticketFk: ticket.destinationId}, myOptions);
|
await models.Sale.updateAll({ticketFk: ticket.originId}, {ticketFk: ticket.destinationId}, myOptions);
|
||||||
await models.Ticket.setDeleted(ctx, ticket.originId, myOptions);
|
if (await models.Ticket.setDeleted(ctx, ticket.originId, myOptions)) {
|
||||||
|
await models.TicketLog.create(ticketDestinationLogRecord, myOptions);
|
||||||
await models.Chat.sendCheckingPresence(ctx, ticket.workerFk, message);
|
await models.Chat.sendCheckingPresence(ctx, ticket.workerFk, message);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (tx)
|
if (tx)
|
||||||
await tx.commit();
|
await tx.commit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -36,6 +36,9 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const ticketToDelete = await models.Ticket.findById(id, {fields: ['isDeleted']}, myOptions);
|
||||||
|
if (ticketToDelete.isDeleted) return false;
|
||||||
|
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const isEditable = await Self.isEditable(ctx, id, myOptions);
|
const isEditable = await Self.isEditable(ctx, id, myOptions);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue