6995-testToMaster_2410 #2139

Merged
alexm merged 236 commits from 6995-testToMaster_2410 into master 2024-03-07 07:09:08 +00:00
1 changed files with 7 additions and 3 deletions
Showing only changes of commit c1c64d0f89 - Show all commits

View File

@ -34,6 +34,8 @@ 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 dms;
let isSignUploaded;
let externalTickets = []; let externalTickets = [];
if (typeof options == 'object') if (typeof options == 'object')
@ -80,8 +82,8 @@ module.exports = Self => {
description: `Firma del cliente - Ruta ${ticket.route().id}`, description: `Firma del cliente - Ruta ${ticket.route().id}`,
hasFile: true hasFile: true
}; };
const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); dms = await models.Dms.uploadFile(ctxUploadFile, myOptions);
await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); isSignUploaded = true;
} }
try { try {
@ -130,7 +132,9 @@ module.exports = Self => {
throw new UserError('Ticket is already signed'); throw new UserError('Ticket is already signed');
if (location) await setLocation(ticketId); if (location) await setLocation(ticketId);
if (!await hasSignDms(ticketId)) await createGestDoc(ticketId); if (!await hasSignDms(ticketId) && !isSignUploaded)
await createGestDoc(ticketId);
await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions);
await ticket.updateAttribute('isSigned', true, myOptions); await ticket.updateAttribute('isSigned', true, myOptions);
const deliveryState = await models.State.findOne({ const deliveryState = await models.State.findOne({