refs #6882 absence #2271

Merged
carlossa merged 13 commits from 6682-notHolidays into dev 2024-05-08 10:27:21 +00:00
3 changed files with 18 additions and 4 deletions
Showing only changes of commit f77cf619db - Show all commits

View File

@ -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';
carlossa marked this conversation as resolved Outdated
Outdated
Review

No me acaba el nom

No me acaba el nom
UPDATE vn.absenceType
SET isFestive=0
WHERE id=1;
carlossa marked this conversation as resolved Outdated
Outdated
Review

ficant el code se veu mes visual

ficant el code se veu mes visual
UPDATE vn.absenceType
SET isFestive=0
WHERE id=6;

View File

@ -95,6 +95,8 @@ module.exports = Self => {
const hasHalfHoliday = result.halfHolidayCounter > 0;
const isHalfHoliday = absenceType.code === 'halfHoliday';
const isFestive = absenceType.isFestive;
const workCenter = await models.Business.findOne({
where: {id: args.businessFk}
},);
@ -105,10 +107,10 @@ module.exports = Self => {
workCenterFk: workCenter.workCenterFk
}
},);
if (holiday)
if (holiday && isFestive)
throw new UserError(`Cannot add holidays on this day`);
carlossa marked this conversation as resolved Outdated
Outdated
Review

if (isHalfHoliday && (hasHalfHoliday || isFestive))

if (isHalfHoliday && (hasHalfHoliday || isFestive))
if (isHalfHoliday && hasHalfHoliday)
if ((isHalfHoliday && hasHalfHoliday) && isFestive)
carlossa marked this conversation as resolved Outdated
Outdated
Review

El error este el posaria de lo primer (aixina no cal fer peticions) i sobra el isFestive

El error este el posaria de lo primer (aixina no cal fer peticions) i sobra el isFestive
throw new UserError(`Cannot add more than one '1/2 day vacation'`);
const absence = await models.Calendar.create({

View File

@ -22,7 +22,10 @@
},
"holidayEntitlementRate": {
"type": "number"
}
},
"isFestive": {
"type": "boolean"
}
},
"acls": [
{
@ -32,4 +35,4 @@
"permission": "ALLOW"
}
]
}
}