#6924 Notify absences only to department boss #3175

Merged
jon merged 12 commits from 6924-NotifyOnlyToBoss into dev 2024-11-21 07:06:28 +00:00
1 changed files with 6 additions and 3 deletions
Showing only changes of commit 25891e0bad - Show all commits

View File

@ -87,7 +87,8 @@ module.exports = Self => {
`SELECT COUNT(*) halfHolidayCounter
FROM vn.calendar c
JOIN vn.business b ON b.id = c.businessFk
WHERE c.dayOffTypeFk = 6
JOIN vn.absenceType at ON at.id = c.dayOffTypeFk
WHERE at.code = 'halfHoliday'
AND b.workerFk = ?
AND c.dated BETWEEN util.firstDayOfYear(?)
AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]);
@ -120,10 +121,12 @@ module.exports = Self => {
}, myOptions);
const department = labour.department();
if (department && department.notificationEmail) {
if (department) {
Outdated
Review

Diria que ja no cal mirar ni el department

Diria que ja no cal mirar ni el department
const absenceType = await models.AbsenceType.findById(args.absenceTypeId, null, myOptions);
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 boss = await models.VnUser.findById(worker.bossFk, null, myOptions);
const url = await Self.app.models.Url.getUrl();
const body = $t('Created absence', {
author: account.nickname,
@ -135,7 +138,7 @@ module.exports = Self => {
await models.Mail.create({
subject: $t('Absence change notification on the labour calendar'),
body: body,
receiver: department.notificationEmail
receiver: boss.email
}, myOptions);
}