This commit is contained in:
parent
9af87f5cf2
commit
de75d811c3
|
@ -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 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",
|
||||
"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."
|
||||
}
|
|
@ -10,6 +10,9 @@
|
|||
"id": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"workcenterFk" : {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -95,6 +95,19 @@ module.exports = Self => {
|
|||
const hasHalfHoliday = result.halfHolidayCounter > 0;
|
||||
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)
|
||||
throw new UserError(`Cannot add more than one '1/2 day vacation'`);
|
||||
|
||||
|
|
Loading…
Reference in New Issue