Merge pull request 'fix: hotfix createAbsence' (!3308) from hotfix-6924createAbsence2 into master
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #3308 Reviewed-by: Jon Elias <jon@verdnatura.es>
This commit is contained in:
commit
72f369dc49
|
@ -128,7 +128,10 @@ module.exports = Self => {
|
||||||
const account = await models.VnUser.findById(userId, null, myOptions);
|
const account = await models.VnUser.findById(userId, null, myOptions);
|
||||||
const subordinated = await models.VnUser.findById(id, null, myOptions);
|
const subordinated = await models.VnUser.findById(id, null, myOptions);
|
||||||
const worker = await models.Worker.findById(subordinated.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 url = await Self.app.models.Url.getUrl();
|
||||||
const body = $t('Created absence', {
|
const body = $t('Created absence', {
|
||||||
author: account.nickname,
|
author: account.nickname,
|
||||||
|
@ -140,7 +143,7 @@ module.exports = Self => {
|
||||||
await models.Mail.create({
|
await models.Mail.create({
|
||||||
subject: $t('Absence change notification on the labour calendar'),
|
subject: $t('Absence change notification on the labour calendar'),
|
||||||
body: body,
|
body: body,
|
||||||
receiver: departmentBoss.email
|
receiver: receiver.email
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
Loading…
Reference in New Issue