refs #4632 removed alert level id from code
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2023-03-16 09:04:57 +01:00
parent a99bd2577a
commit 6e2269b428
1 changed files with 8 additions and 3 deletions

View File

@ -114,12 +114,17 @@ module.exports = Self => {
fields: ['alertLevel']
}, myOptions);
if (ticketState.alertLevel >= 2 && !await gestDocExists(args.tickets[i])) {
const boxedAlertLevel = await models.AlertLevel.findOne({where: {code: 'PACKED'},
fields: ['id']
}, myOptions);
if (ticketState.alertLevel < boxedAlertLevel.id)
throw new UserError('This ticket cannot be signed because it has not been boxed');
else if (!await gestDocExists(args.tickets[i])) {
if (args.location) setLocation(args.tickets[i]);
await createGestDoc(args.tickets[i]);
await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [args.tickets[i], 'DELIVERED'], myOptions);
} else if (ticketState.alertLevel < 2)
throw new UserError('This ticket cannot be signed because it has not been boxed');
}
}
if (tx) await tx.commit();