From f145649fc73d979b2429cbd638e6b2c79aafe1c3 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 19 Nov 2024 13:40:31 +0100 Subject: [PATCH] fix: refs #6924 requested change --- modules/worker/back/methods/worker/createAbsence.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/worker/back/methods/worker/createAbsence.js b/modules/worker/back/methods/worker/createAbsence.js index 8e6380c3b..419659083 100644 --- a/modules/worker/back/methods/worker/createAbsence.js +++ b/modules/worker/back/methods/worker/createAbsence.js @@ -58,7 +58,8 @@ module.exports = Self => { if (!isSubordinate || (isSubordinate && userId == id && !isTeamBoss)) 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)) throw new UserError(`The contract was not active during the selected date`);