refs #6184 fixSaveSign #2096

Merged
guillermo merged 5 commits from 6184-fixSaveSign into test 2024-02-26 13:00:35 +00:00
1 changed files with 9 additions and 13 deletions
Showing only changes of commit a359ace1b8 - Show all commits

View File

@ -59,19 +59,15 @@ module.exports = Self => {
}
async function hasSignDms(ticketId) {
const ticketDms = await models.TicketDms.findOne({
where: {ticketFk: ticketId},
include: [
{
relation: 'dms',
fields: ['id'],
scope: {
where: {dmsTypeFk: dmsTypeTicket.id}
}
}
]
});
if (ticketDms?.dms()?.id) return true;
const hasTicketDms = await Self.rawSql(`
SELECT d.id
FROM ticketDms td
JOIN dms d ON d.id = td.dmsFk
WHERE td.ticketFk = ?
AND d.dmsTypeFk = ?
`, [ticketId, dmsTypeTicket.id]);
if (hasTicketDms.length) return true;
}
async function createGestDoc() {