refs #3520 feat:uncheckedTicket

This commit is contained in:
Sergio De la torre 2024-03-26 11:06:14 +01:00
parent dc5f588c8e
commit caf99a9738
1 changed files with 7 additions and 2 deletions

View File

@ -19,7 +19,12 @@ module.exports = Self => {
} }
}); });
Self.getUncheckedTicket = async ticketFk => { Self.getUncheckedTicket = async(ticketFk, options) => {
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const result = await Self.rawSql(` const result = await Self.rawSql(`
SELECT tc2.ticketFk SELECT tc2.ticketFk
FROM vn.ticketCollection tc FROM vn.ticketCollection tc
@ -29,7 +34,7 @@ module.exports = Self => {
JOIN vn.state s2 ON s2.code = 'CHECKED' JOIN vn.state s2 ON s2.code = 'CHECKED'
WHERE tc.ticketFk = ? AND s.order < s2.id WHERE tc.ticketFk = ? AND s.order < s2.id
LIMIT 1;`, LIMIT 1;`,
[ticketFk]); [ticketFk], myOptions);
return result.length > 0 && result[0]['ticketFk'] > 0; return result.length > 0 && result[0]['ticketFk'] > 0;
}; };
}; };