fix: hotfix createAbsence
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-12-16 08:15:14 +01:00
parent 58b1426e5c
commit b14268ef1b
1 changed files with 5 additions and 2 deletions

View File

@ -128,7 +128,10 @@ module.exports = Self => {
const account = await models.VnUser.findById(userId, null, myOptions);
const subordinated = await models.VnUser.findById(id, null, myOptions);
const worker = await models.Worker.findById(subordinated.id, null, myOptions);
const departmentBoss = await models.VnUser.findById(worker.bossFk, null, myOptions);
const receiver = await models.EmailUser.findOne({
fields: ['email'],
where: {userFk: worker.bossFk}
}, myOptions);
const url = await Self.app.models.Url.getUrl();
const body = $t('Created absence', {
author: account.nickname,
@ -140,7 +143,7 @@ module.exports = Self => {
await models.Mail.create({
subject: $t('Absence change notification on the labour calendar'),
body: body,
receiver: departmentBoss.email
receiver: receiver.email
}, myOptions);
if (tx) await tx.commit();