#6924 Notify absences only to department boss #3175
|
@ -120,27 +120,23 @@ module.exports = Self => {
|
||||||
dated: args.dated
|
dated: args.dated
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const department = labour.department();
|
const account = await models.VnUser.findById(userId, null, myOptions);
|
||||||
if (department) {
|
const subordinated = await models.VnUser.findById(id, null, myOptions);
|
||||||
const absenceType = await models.AbsenceType.findById(args.absenceTypeId, null, myOptions);
|
const worker = await models.Worker.findById(subordinated.id, null, myOptions);
|
||||||
const account = await models.VnUser.findById(userId, null, myOptions);
|
const departmentBoss = await models.VnUser.findById(worker.bossFk, null, myOptions);
|
||||||
const subordinated = await models.VnUser.findById(id, null, myOptions);
|
const url = await Self.app.models.Url.getUrl();
|
||||||
const worker = await models.Worker.findById(subordinated.id, null, myOptions);
|
const body = $t('Created absence', {
|
||||||
const boss = await models.VnUser.findById(worker.bossFk, null, myOptions);
|
author: account.nickname,
|
||||||
const url = await Self.app.models.Url.getUrl();
|
employee: subordinated.nickname,
|
||||||
const body = $t('Created absence', {
|
absenceType: absenceType.name,
|
||||||
author: account.nickname,
|
dated: formatDate(args.dated),
|
||||||
employee: subordinated.nickname,
|
workerUrl: `${url}worker/${id}/calendar`
|
||||||
absenceType: absenceType.name,
|
});
|
||||||
dated: formatDate(args.dated),
|
await models.Mail.create({
|
||||||
workerUrl: `${url}worker/${id}/calendar`
|
subject: $t('Absence change notification on the labour calendar'),
|
||||||
});
|
body: body,
|
||||||
await models.Mail.create({
|
receiver: departmentBoss.email
|
||||||
subject: $t('Absence change notification on the labour calendar'),
|
}, myOptions);
|
||||||
body: body,
|
|
||||||
receiver: boss.email
|
|
||||||
}, myOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue