Skip to content

Commit

Permalink
Aggiunto codice per terzo parente disabile. Aggiunte regole drools per
Browse files Browse the repository at this point in the history
consentire a un dipendente autorizzato a poterselo inserire in
autonomia.
  • Loading branch information
Dario Tagliaferri committed Oct 30, 2024
1 parent e917400 commit b4454cb
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.19.1] - UNRELEASED
### Added
- Aggiunto codice 183 giornaliero e ore e minuti per terzo parente disabile

### Changed
- Il codice 98 è ora inseribile anche nei festivi
- Corretto typo nella visualizzazione della pagina Categorie gruppi assenze
Expand Down
9 changes: 9 additions & 0 deletions app/manager/configurations/EpasParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ public enum EpasParam {
EpasParamValueType.formatValue(false),
Lists.<RecomputationType>newArrayList(),
Person.class),

THIRD_DISABLED_RELATIVE_PERMISSION("third_disabled_relative_permission",

EpasParamCategory.GENERAL,
EpasParamTimeType.GENERAL,
EpasParamValueType.BOOLEAN,
EpasParamValueType.formatValue(false),
Lists.<RecomputationType>newArrayList(),
Person.class),

OFF_SITE_ABSENCE_WITH_CONVENTION("off_site_absence_with_convention",

Expand Down
6 changes: 6 additions & 0 deletions app/manager/services/absences/AbsenceService.java
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ public List<GroupAbsenceType> groupsPermitted(Person person, boolean readOnly) {
.groupAbsenceTypeByName(DefaultGroup.G_18_PARENTI_DIPENDENTI.name()).get();
final GroupAbsenceType secondDisabledRelativeAbsence = absenceComponentDao
.groupAbsenceTypeByName(DefaultGroup.G_182_PARENTI_DIPENDENTI.name()).get();
final GroupAbsenceType thirdDisabledRelativeAbsence = absenceComponentDao
.groupAbsenceTypeByName(DefaultGroup.G_183_PARENTI_DIPENDENTI.name()).get();
final GroupAbsenceType medicalExams = absenceComponentDao
.groupAbsenceTypeByName(DefaultGroup.G_631_DIPENDENTI.name()).get();
final GroupAbsenceType cod39LA = absenceComponentDao
Expand Down Expand Up @@ -607,6 +609,7 @@ public List<GroupAbsenceType> groupsPermitted(Person person, boolean readOnly) {
groupsPermitted.remove(disabledRelativeAbsence);
groupsPermitted.remove(additionalHours);
groupsPermitted.remove(secondDisabledRelativeAbsence);
groupsPermitted.remove(thirdDisabledRelativeAbsence);
//groupsPermitted.remove(parentalLeaveForFathers);
//groupsPermitted.remove(parentalLeaveTwinsForFathers);
//groupsPermitted.remove(lagile);
Expand Down Expand Up @@ -682,6 +685,9 @@ public List<GroupAbsenceType> groupsPermitted(Person person, boolean readOnly) {
if ((Boolean) confManager.configValue(person,
EpasParam.SECOND_DISABLED_RELATIVE_PERMISSION)) {
groupsPermitted.add(secondDisabledRelativeAbsence);
if ((Boolean) confManager.configValue(person, EpasParam.THIRD_DISABLED_RELATIVE_PERMISSION)) {
groupsPermitted.add(thirdDisabledRelativeAbsence);
}
}
}

Expand Down
48 changes: 48 additions & 0 deletions app/models/absences/definitions/DefaultAbsenceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,54 @@ public enum DefaultAbsenceType {
0, false, MealTicketBehaviour.notAllowMealTicket, 0, JustifiedTypeName.all_day,
Sets.newHashSet(), null, null, false, true, true, null),

A_183("183", "Permesso assistenza terzo parenti/affini disabili L. 104/92 intera giornata",
false, ImmutableSet.of(JustifiedTypeName.all_day), 0, false,
MealTicketBehaviour.notAllowMealTicket, 0, null,
Sets.newHashSet(), null, null, false, true, true, null),
A_183M("183M", "Permesso assistenza terzo parenti/affini disabili L. 104/92 in ore e minuti",
true, ImmutableSet.of(JustifiedTypeName.specified_minutes), 0, false,
MealTicketBehaviour.notAllowMealTicket, 0, null,
Sets.newHashSet(new Behaviour(JustifiedBehaviourName.no_overtime)), null, null,
false, true, true, null),
A_183H1("183H1", "Permesso assistenza terzo parenti/affini disabili L.104/92 compl. 1 ora",
false, ImmutableSet.of(JustifiedTypeName.nothing), 0, false,
MealTicketBehaviour.notAllowMealTicket, 60,
JustifiedTypeName.absence_type_minutes, Sets.newHashSet(), null, null, false, true, true, null),
A_183H2("183H2", "Permesso assistenza terzo parenti/affini disabili L.104/92 compl. 2 ore",
false, ImmutableSet.of(JustifiedTypeName.nothing), 0, false,
MealTicketBehaviour.notAllowMealTicket, 120,
JustifiedTypeName.absence_type_minutes, Sets.newHashSet(), null, null, false, true, true, null),
A_183H3("183H3", "Permesso assistenza terzo parenti/affini disabili L.104/92 compl. 3 ore",
false, ImmutableSet.of(JustifiedTypeName.nothing), 0, false,
MealTicketBehaviour.notAllowMealTicket, 180,
JustifiedTypeName.absence_type_minutes, Sets.newHashSet(), null, null, false, true, true, null),
A_183H4("183H4", "Permesso assistenza terzo parenti/affini disabili L.104/92 compl. 4 ore",
false, ImmutableSet.of(JustifiedTypeName.nothing), 0, false,
MealTicketBehaviour.notAllowMealTicket, 240,
JustifiedTypeName.absence_type_minutes, Sets.newHashSet(), null, null, false, true, true, null),
A_183H5("183H5", "Permesso assistenza terzo parenti/affini disabili L.104/92 compl. 5 ore",
false, ImmutableSet.of(JustifiedTypeName.nothing), 0, false,
MealTicketBehaviour.notAllowMealTicket,
300, JustifiedTypeName.absence_type_minutes, Sets.newHashSet(), null, null,
false, true, true, null),
A_183H6("183H6", "Permesso assistenza terzo parenti/affini disabili L.104/92 compl. 6 ore",
false, ImmutableSet.of(JustifiedTypeName.nothing), 0, false,
MealTicketBehaviour.notAllowMealTicket, 360, JustifiedTypeName.absence_type_minutes,
Sets.newHashSet(), null, null, false, true, true, null),
A_183H7("183H7", "Permesso assistenza terzo parenti/affini disabili L.104/92 compl. 7 ore",
false, ImmutableSet.of(JustifiedTypeName.nothing), 0, false,
MealTicketBehaviour.notAllowMealTicket, 420, JustifiedTypeName.absence_type_minutes,
Sets.newHashSet(), null, null, false, true, true, null),
A_183H8("183H8", "Permesso assistenza terzo parenti/affini disabili L.104/92 compl. 8 ore",
false, ImmutableSet.of(JustifiedTypeName.nothing), 0, false,
MealTicketBehaviour.notAllowMealTicket,
480, JustifiedTypeName.absence_type_minutes, Sets.newHashSet(), null, null,
false, true, true, null),
A_183H9("183H9", "Permesso assistenza terzo parenti/affini disabili L.104/92 compl. 9 ore",
false, ImmutableSet.of(JustifiedTypeName.nothing), 0, false,
MealTicketBehaviour.notAllowMealTicket, 540,
JustifiedTypeName.absence_type_minutes, Sets.newHashSet(), null, null, false, true, true, null),

A_19M("19M", "Permesso per dipendente disabile L. 104/92 in ore e minuti", true,
ImmutableSet.of(JustifiedTypeName.specified_minutes), 0, false,
MealTicketBehaviour.notAllowMealTicket, 0, null,
Expand Down
12 changes: 12 additions & 0 deletions app/models/absences/definitions/DefaultComplation.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ public enum DefaultComplation {
DefaultAbsenceType.A_182H7,
DefaultAbsenceType.A_182H8,
DefaultAbsenceType.A_182H9)),

C_183(AmountType.minutes,
ImmutableSet.of(DefaultAbsenceType.A_183M),
ImmutableSet.of(DefaultAbsenceType.A_183H1,
DefaultAbsenceType.A_183H2,
DefaultAbsenceType.A_183H3,
DefaultAbsenceType.A_183H4,
DefaultAbsenceType.A_183H5,
DefaultAbsenceType.A_183H6,
DefaultAbsenceType.A_183H7,
DefaultAbsenceType.A_183H8,
DefaultAbsenceType.A_183H9)),

C_182P(AmountType.units,
ImmutableSet.of(DefaultAbsenceType.A_182PM),
Expand Down
13 changes: 13 additions & 0 deletions app/models/absences/definitions/DefaultGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ public enum DefaultGroup {
+ "secondo parente tre giorni mese", "", DefaultCategoryType.L_104_PARENTI_DIPENDENTI, 2,
GroupAbsenceTypePattern.programmed, PeriodType.month, DefaultTakable.T_182,
DefaultComplation.C_182, null, false, false),

G_183("183 - Permesso assistenza terzo parenti/affini disabili L. 104/92 tre gg. mese", "",
DefaultCategoryType.L_104, 1, GroupAbsenceTypePattern.programmed, PeriodType.month,
DefaultTakable.T_183, DefaultComplation.C_183, null, false, false),
G_183_PARENTI_DIPENDENTI("183 - Permesso assistenza parenti/affini disabili L. 104/92 "
+ "terzo parente tre giorni mese", "", DefaultCategoryType.L_104_PARENTI_DIPENDENTI, 2,
GroupAbsenceTypePattern.programmed, PeriodType.month, DefaultTakable.T_183,
DefaultComplation.C_183, null, false, false),

G_182P("182P - Permesso provv. assist. secondo parenti/affini dis. L. 104/92 tre gg. mese", "",
DefaultCategoryType.PERMESSI_PROVVISORI_104, 0, GroupAbsenceTypePattern.programmed,
PeriodType.month, DefaultTakable.T_182P, DefaultComplation.C_182P, null, false, false),
Expand Down Expand Up @@ -568,6 +577,10 @@ public static List<String> employeeSecondDisabledRelativeCodes() {
return getCodes(DefaultGroup.G_182_PARENTI_DIPENDENTI);
}

public static List<String> employeeThirdDisabledRelativeCodes() {
return getCodes(DefaultGroup.G_183_PARENTI_DIPENDENTI);
}

public static List<String> employeeAgileWorkOrDisabledPeopleAssistanceCodes() {
return getCodes(DefaultGroup.G_39LA);
}
Expand Down
6 changes: 6 additions & 0 deletions app/models/absences/definitions/DefaultTakable.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public enum DefaultTakable {
DefaultAbsenceType.A_182PM),
ImmutableSet.of(DefaultAbsenceType.A_182P, DefaultAbsenceType.A_182PM),
3, null),

T_183(AmountType.units,
ImmutableSet.of(DefaultAbsenceType.A_183,
DefaultAbsenceType.A_183M),
ImmutableSet.of(DefaultAbsenceType.A_183, DefaultAbsenceType.A_183M),
3, TakeAmountAdjustment.workingTimePercent),

T_19(AmountType.units,
ImmutableSet.of(DefaultAbsenceType.A_19,
Expand Down
6 changes: 6 additions & 0 deletions app/views/Configurations/_tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@
autonomamente il codice di assenza per legge 104 per un secondo parente disabile del dipendente (182).
</p>
#{/if}

#{if configuration.epasParam.equals(manager.configurations.EpasParam.THIRD_DISABLED_RELATIVE_PERMISSION) }
<p>Abilitando questa funzionalità sarà possibile per il dipendente <strong>${configuration.person.fullname}</strong> inserire
autonomamente il codice di assenza per legge 104 per un terzo parente disabile del dipendente (183).
</p>
#{/if}

#{if configuration.epasParam.equals(manager.configurations.EpasParam.AGILE_WORK_OR_DISABLED_PEOPLE_ASSISTANCE) }
<p>Abilitando questa funzionalità sarà possibile per il dipendente <strong>${configuration.person.fullname}</strong> inserire
Expand Down
1 change: 1 addition & 0 deletions conf/messages.it
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,7 @@ COVID_19=Auto inserimento codice per emergenza COVID-19
ADDITIONAL_HOURS=Auto inserimento ore aggiuntive
PARENTAL_LEAVE_AND_CHILD_ILLNESS=Auto inserimento congedi parentali e malattie figlio
SECOND_DISABLED_RELATIVE_PERMISSION=Auto inserimento assenze 104 secondo parente disabile
THIRD_DISABLED_RELATIVE_PERMISSION=Auto inserimento assenze 104 terzo parente disabile
PEOPLE_ALLOWED_INSERT_MEDICAL_EXAM=Abilita personale all'auto inserimento di permessi per visita medica
AGILE_WORK_OR_DISABLED_PEOPLE_ASSISTANCE=Auto inserimento lavoro agile per dipendenti fragili o assistenza disabile/immunodepresso
SMARTWORKING =Auto inserimento codice di assenza per smartworking
Expand Down
17 changes: 17 additions & 0 deletions conf/permissions.drl
Original file line number Diff line number Diff line change
Expand Up @@ -3180,6 +3180,7 @@ when
|| (epasParam == EpasParam.ADDITIONAL_HOURS && fieldValue == true)
|| (epasParam == EpasParam.PARENTAL_LEAVE_AND_CHILD_ILLNESS && fieldValue == true)
|| (epasParam == EpasParam.SECOND_DISABLED_RELATIVE_PERMISSION && fieldValue == true)
|| (epasParam == EpasParam.THIRD_DISABLED_RELATIVE_PERMISSION && fieldValue == true)
|| (epasParam == EpasParam.AGILE_WORK_OR_DISABLED_PEOPLE_ASSISTANCE && fieldValue == true)
|| (epasParam == EpasParam.SMARTWORKING && fieldValue == true)
|| (epasParam == EpasParam.AGILE_WORK && fieldValue == true)
Expand Down Expand Up @@ -3369,6 +3370,22 @@ then
$c.grant();
end

/*********************************************************************************************
* L'impiegato può modificare/salvare una determinata assenza per terzo parente disabile se:
*********************************************************************************************/
rule EmployeeCanEditThirdDisabledRelativeAbsence
when
$uro: UsersRolesOffices(role.name == Role.EMPLOYEE)
$p: Person() from currentOperator.person
PersonConfiguration(epasParam == EpasParam.THIRD_DISABLED_RELATIVE_PERMISSION, fieldValue == true) from $p.personConfigurations
$target: Absence(DefaultGroup.employeeSecondDisabledRelativeCodes().contains(this.getCode()), this.getOwner() == $p)
$c: PermissionCheck(action in ("AbsenceGroups.insert", "AbsenceGroups.edit", "AbsenceGroups.save", "AbsenceGroups.delete"), target == $target, granted == false )
eval (!$target.isPersistent() || HistoricalDao.lastRevisionOperator($target) == currentOperator)
eval($target.getYearMonth().isAfter(YearMonth.now().minusMonths(2)) && $p.checkLastCertificationDate($target.getYearMonth()))
then
$c.grant();
end

/******************************************************************************************************************************************
* L'impiegato può modificare/salvare una determinata assenza per lavoro agile per dipendenti fragili o assistenza disabile/immunodepresso:
******************************************************************************************************************************************/
Expand Down

0 comments on commit b4454cb

Please sign in to comment.