fix: refs #6924 requested change

This commit is contained in:
Jon Elias 2024-11-19 13:40:31 +01:00
parent 7be1bc385f
commit f145649fc7
1 changed files with 2 additions and 1 deletions

View File

@ -58,7 +58,8 @@ module.exports = Self => {
if (!isSubordinate || (isSubordinate && userId == id && !isTeamBoss)) if (!isSubordinate || (isSubordinate && userId == id && !isTeamBoss))
throw new UserError(`You don't have enough privileges`); throw new UserError(`You don't have enough privileges`);
const labour = await models.WorkerLabour.findById(args.businessFk, myOptions); const labour = await models.WorkerLabour.findById(args.businessFk,
{fields: ['started', 'ended', 'businessFk']}, myOptions);
if (args.dated < labour.started || (labour.ended != null && args.dated > labour.ended)) if (args.dated < labour.started || (labour.ended != null && args.dated > labour.ended))
throw new UserError(`The contract was not active during the selected date`); throw new UserError(`The contract was not active during the selected date`);