7430_devToTest #2490
|
@ -0,0 +1,9 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
ALTER TABLE vn.absenceType ADD isFestive BOOL DEFAULT 1 NOT NULL COMMENT 'Para marcar un tipo de absence';
|
||||||
|
|
||||||
|
UPDATE vn.absenceType
|
||||||
|
SET isFestive=0
|
||||||
|
WHERE id=1;
|
||||||
|
UPDATE vn.absenceType
|
||||||
|
SET isFestive=0
|
||||||
|
WHERE id=6;
|
|
@ -95,6 +95,8 @@ module.exports = Self => {
|
||||||
const hasHalfHoliday = result.halfHolidayCounter > 0;
|
const hasHalfHoliday = result.halfHolidayCounter > 0;
|
||||||
const isHalfHoliday = absenceType.code === 'halfHoliday';
|
const isHalfHoliday = absenceType.code === 'halfHoliday';
|
||||||
|
|
||||||
|
const isFestive = absenceType.isFestive;
|
||||||
|
|
||||||
const workCenter = await models.Business.findOne({
|
const workCenter = await models.Business.findOne({
|
||||||
where: {id: args.businessFk}
|
where: {id: args.businessFk}
|
||||||
},);
|
},);
|
||||||
|
@ -105,10 +107,10 @@ module.exports = Self => {
|
||||||
workCenterFk: workCenter.workCenterFk
|
workCenterFk: workCenter.workCenterFk
|
||||||
}
|
}
|
||||||
},);
|
},);
|
||||||
if (holiday)
|
if (holiday && isFestive)
|
||||||
throw new UserError(`Cannot add holidays on this day`);
|
throw new UserError(`Cannot add holidays on this day`);
|
||||||
|
|
||||||
if (isHalfHoliday && hasHalfHoliday)
|
if ((isHalfHoliday && hasHalfHoliday) && isFestive)
|
||||||
throw new UserError(`Cannot add more than one '1/2 day vacation'`);
|
throw new UserError(`Cannot add more than one '1/2 day vacation'`);
|
||||||
|
|
||||||
const absence = await models.Calendar.create({
|
const absence = await models.Calendar.create({
|
||||||
|
|
|
@ -22,7 +22,10 @@
|
||||||
},
|
},
|
||||||
"holidayEntitlementRate": {
|
"holidayEntitlementRate": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
}
|
},
|
||||||
|
"isFestive": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
{
|
{
|
||||||
|
@ -32,4 +35,4 @@
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue