fix: #6184 Now creates only one dms in saveSign
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ed43b6be2d
commit
65268487b9
|
@ -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 gestDocCreated;
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -83,8 +85,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: id, dmsFk: dms[0].id}, myOptions);
|
gestDocCreated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -134,8 +136,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))
|
if (!await hasSignDms(ticketId) && !gestDocCreated)
|
||||||
await createGestDoc(ticketId);
|
await createGestDoc(ticketId);
|
||||||
|
await models.TicketDms.create({ticketFk: 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({
|
||||||
|
|
Loading…
Reference in New Issue