refs #6915 test_master24_8 #2067
|
@ -342,5 +342,6 @@
|
||||||
"Bank entity must be specified": "La entidad bancaria es obligatoria",
|
"Bank entity must be specified": "La entidad bancaria es obligatoria",
|
||||||
"An email is necessary": "Es necesario un email",
|
"An email is necessary": "Es necesario un email",
|
||||||
"You cannot update these fields": "No puedes actualizar estos campos",
|
"You cannot update these fields": "No puedes actualizar estos campos",
|
||||||
"CountryFK cannot be empty": "El país no puede estar vacío"
|
"CountryFK cannot be empty": "El país no puede estar vacío",
|
||||||
|
"Cmr file does not exist": "El archivo del cmr no existe"
|
||||||
}
|
}
|
|
@ -34,8 +34,6 @@ 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);
|
||||||
|
@ -86,8 +84,8 @@ module.exports = Self => {
|
||||||
contentType: 'image/png',
|
contentType: 'image/png',
|
||||||
hasFile: true
|
hasFile: true
|
||||||
};
|
};
|
||||||
dms = await models.Dms.uploadFile(ctxUploadFile, myOptions);
|
const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions);
|
||||||
gestDocCreated = true;
|
await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -137,9 +135,8 @@ 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) && !gestDocCreated)
|
if (!await hasSignDms(ticketId))
|
||||||
await createGestDoc(ticketId);
|
await createGestDoc(ticketId);
|
||||||
await models.TicketDms.create({ticketFk: ticketId, 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({
|
||||||
|
@ -160,7 +157,7 @@ module.exports = Self => {
|
||||||
await models.Route.cmrEmail(ctx, externalTickets);
|
await models.Route.cmrEmail(ctx, externalTickets);
|
||||||
return;
|
return;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx && tx.isActive()) await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue