From b14268ef1bfd0091526255e390255ad664f3839a Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 16 Dec 2024 08:15:14 +0100 Subject: [PATCH 1/3] fix: hotfix createAbsence --- modules/worker/back/methods/worker/createAbsence.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/worker/back/methods/worker/createAbsence.js b/modules/worker/back/methods/worker/createAbsence.js index e46ce9577..93ca7fd89 100644 --- a/modules/worker/back/methods/worker/createAbsence.js +++ b/modules/worker/back/methods/worker/createAbsence.js @@ -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(); From 863f20424740c0d2dcbb99f9572466adfc23bd42 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 16 Dec 2024 14:12:43 +0100 Subject: [PATCH 2/3] fix(deleteZone): contrary condition --- loopback/locale/en.json | 3 ++- loopback/locale/es.json | 3 ++- modules/zone/back/methods/zone/deleteZone.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 7372ac9a6..54d004400 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -247,5 +247,6 @@ "The raid information is not correct": "The raid information is not correct", "Payment method is required": "Payment method is required", "Sales already moved": "Sales already moved", - "Holidays to past days not available": "Holidays to past days not available" + "Holidays to past days not available": "Holidays to past days not available", + "There are tickets to be invoiced": "There are tickets to be invoiced" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 8bb38fee0..e891b8720 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -390,6 +390,7 @@ "The web user's email already exists": "El correo del usuario web ya existe", "Sales already moved": "Ya han sido transferidas", "The raid information is not correct": "La información de la redada no es correcta", - "Holidays to past days not available": "Las vacaciones a días pasados no están disponibles" + "Holidays to past days not available": "Las vacaciones a días pasados no están disponibles", + "There are tickets to be invoiced": "Hay ticket por facturar" } diff --git a/modules/zone/back/methods/zone/deleteZone.js b/modules/zone/back/methods/zone/deleteZone.js index e2e01a949..a147ee588 100644 --- a/modules/zone/back/methods/zone/deleteZone.js +++ b/modules/zone/back/methods/zone/deleteZone.js @@ -51,7 +51,7 @@ module.exports = Self => { }; const ticketList = await models.Ticket.find(filter, myOptions); - const hasRefFk = ticketList.some(ticket => ticket.refFk); + const hasRefFk = ticketList.some(ticket => !ticket.refFk); if (hasRefFk) throw new UserError('There are tickets to be invoiced'); From 26b0ea647d3525ce7f03174db30a67d33e8aa54a Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 17 Dec 2024 07:01:44 +0100 Subject: [PATCH 3/3] refactor: change translation --- loopback/locale/es.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index e891b8720..e536e7e7d 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -391,6 +391,6 @@ "Sales already moved": "Ya han sido transferidas", "The raid information is not correct": "La información de la redada no es correcta", "Holidays to past days not available": "Las vacaciones a días pasados no están disponibles", - "There are tickets to be invoiced": "Hay ticket por facturar" + "There are tickets to be invoiced": "La zona tiene tickets por facturar" }