refs #6682 absence
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2024-04-09 12:30:25 +02:00
parent 9af87f5cf2
commit de75d811c3
3 changed files with 370 additions and 353 deletions

View File

@ -349,5 +349,6 @@
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas", "The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
"The line could not be marked": "La linea no puede ser marcada", "The line could not be marked": "La linea no puede ser marcada",
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario",
"They're not your subordinate": "No es tu subordinado/a." "They're not your subordinate": "No es tu subordinado/a.",
"Cannot add holidays on this day": "No se puede añadir vacaciones en este día."
} }

View File

@ -10,6 +10,9 @@
"id": { "id": {
"type": "number", "type": "number",
"id": true "id": true
},
"workcenterFk" : {
"type": "number"
} }
}, },
"relations": { "relations": {

View File

@ -95,6 +95,19 @@ module.exports = Self => {
const hasHalfHoliday = result.halfHolidayCounter > 0; const hasHalfHoliday = result.halfHolidayCounter > 0;
const isHalfHoliday = absenceType.code === 'halfHoliday'; const isHalfHoliday = absenceType.code === 'halfHoliday';
const workCenter = await models.Business.findOne({
where: {id: args.businessFk}
},);
const [holiday] = await models.CalendarHoliday.find({
where: {
dated: args.dated,
workCenterFk: workCenter.workCenterFk
}
},);
if (holiday)
throw new UserError(`Cannot add holidays on this day`);
if (isHalfHoliday && hasHalfHoliday) if (isHalfHoliday && hasHalfHoliday)
throw new UserError(`Cannot add more than one '1/2 day vacation'`); throw new UserError(`Cannot add more than one '1/2 day vacation'`);