Skip to content

Commit

Permalink
Merge branch 'master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
criluc committed Sep 27, 2022
2 parents f5fad29 + 24df16f commit e7cda93
Show file tree
Hide file tree
Showing 28 changed files with 1,106 additions and 210 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@ All notable changes to this project will be documented in this file.
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.6.0] - UNRELEASED
### Added
- Completata la gestione delle comunicazioni ferie/riposi compensativi per i livelli I-III
nel caso il parametro generale sia configurato per non permettere approvazioni per i
livelli I-III
- Aggiunti nuovi codici di assenza per congedo parentale per il padre.
- Modificati i codici d congedo parentale al 30% secondo le linee guida dettate dalle modifiche al
regolamento del CNR.

## [2.5.5] - 2022-09-19
### Changed
- Corretta la rimozione dai gruppi, servizi di reperibità e turno delle persone
con contratto scaduto.

## [2.5.4] - 2022-09-16
### Added
- Aggiunta la possibilità di disabilitare la configurabilità delle approvazioni delle ferie
e riposi compensati dei livelli I-III. Con l'apposita configurazione generale abilitata
i livelli I-III hanno dei flussi solo per comunicare le asssenze, senza autorizzazioni e
con le etichette dei flussi modificati da "richiesta" a "comunicazione"
- Aggiunta la possibilità di disattivare e cancellare gli orari di lavoro predefiniti
non utilizzati.
- Aggiunta la possibilità di rinominare gli orari di lavoro predefiniti.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.5
2.6.0-rc2
15 changes: 14 additions & 1 deletion app/controllers/AbsenceRequests.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.common.collect.Lists;
import common.security.SecurityRules;
import dao.AbsenceRequestDao;
import dao.GeneralSettingDao;
import dao.GroupDao;
import dao.PersonDao;
import dao.PersonReperibilityDayDao;
Expand Down Expand Up @@ -131,6 +132,8 @@ public class AbsenceRequests extends Controller {
@Inject
static PersonReperibilityDayDao personReperibilityDayDao;

@Inject
static GeneralSettingDao generalSettingDao;

/**
* Lista delle richiesta di assenza di tipo ferie.
Expand Down Expand Up @@ -550,7 +553,17 @@ public static void save(@Required @Valid AbsenceRequest absenceRequest,
if (isNewRequest || !absenceRequest.flowStarted) {
absenceRequestManager.executeEvent(absenceRequest, absenceRequest.person,
AbsenceRequestEventType.STARTING_APPROVAL_FLOW, Optional.absent());
if (absenceRequest.person.isSeatSupervisor() || (absenceRequest.person.isGroupManager()

//Nel caso si tratti di una "comunicazione" di assenza da parte di
//un livelli I-III e non sia necessaria nessuna autorizzazione, allora
//si invia solo una notifica al responsabile sede e/o responsabile gruppo
//(dipendente dalla configurazione)
if (!generalSettingDao.generalSetting().enableAbsenceTopLevelAuthorization &&
absenceRequest.person.isTopQualification() &&
absenceRequest.type.canBeInsertedByTopLevelWithoutApproval) {
absenceRequestManager.topLevelSelfApproval(absenceRequest, Security.getUser().get().person);
notificationManager.sendEmailAbsenceNotification(absenceRequest);
} else if (absenceRequest.person.isSeatSupervisor() || (absenceRequest.person.isGroupManager()
&& !absenceRequest.officeHeadApprovalForManagerRequired)) {
approval(absenceRequest.id);
} else {
Expand Down
20 changes: 18 additions & 2 deletions app/controllers/Configurations.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Verify;
import common.security.SecurityRules;
import dao.GeneralSettingDao;
import dao.OfficeDao;
import dao.PersonDao;
import java.io.File;
Expand Down Expand Up @@ -75,7 +76,8 @@ public class Configurations extends Controller {
static PeriodManager periodManager;
@Inject
static SecurityRules rules;

@Inject
static GeneralSettingDao generalSettingDao;

private static IPropertyInPeriod compute(IPropertyInPeriod configuration, EpasParam epasParam,
ConfigurationDto configurationDto) {
Expand Down Expand Up @@ -256,10 +258,24 @@ public static void show(Long officeId, EpasParamCategory paramCategory) {
.filter(conf -> conf.epasParam.category == EpasParam.EpasParamCategory.AUTOCERTIFICATION)
.collect(Collectors.toList());

final List<Configuration> flows = configurations.stream()
List<Configuration> flows = configurations.stream()
.filter(conf -> conf.epasParam.category == EpasParam.EpasParamCategory.FLOWS)
.collect(Collectors.toList());

if (!generalSettingDao.generalSetting().enableAbsenceTopLevelAuthorization) {
flows = flows.stream().filter(conf ->
!conf.epasParam.equals(EpasParam.COMPENSATORY_REST_REQUEST_I_III_MANAGER_APPROVAL_REQUIRED) &&
!conf.epasParam.equals(EpasParam.COMPENSATORY_REST_REQUEST_I_III_OFFICE_HEAD_APPROVAL_REQUIRED) &&
!conf.epasParam.equals(EpasParam.VACATION_REQUEST_I_III_MANAGER_APPROVAL_REQUIRED) &&
!conf.epasParam.equals(EpasParam.VACATION_REQUEST_I_III_OFFICE_HEAD_APPROVAL_REQUIRED))
.collect(Collectors.toList());
} else {
flows = flows.stream().filter(conf ->
!conf.epasParam.equals(EpasParam.ABSENCE_TOP_LEVEL_GROUP_MANAGER_NOTIFICATION) &&
!conf.epasParam.equals(EpasParam.ABSENCE_TOP_LEVEL_OFFICE_HEAD_NOTIFICATION) &&
!conf.epasParam.equals(EpasParam.ABSENCE_TOP_LEVEL_OF_GROUP_MANAGER_OFFICE_HEAD_NOTIFICATION))
.collect(Collectors.toList());
}
final List<Configuration> competenceFlows = configurations.stream()
.filter(conf -> conf.epasParam.category == EpasParam.EpasParamCategory.COMPETENCE_FLOWS)
.collect(Collectors.toList());
Expand Down
8 changes: 8 additions & 0 deletions app/helpers/TemplateUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -909,4 +909,12 @@ public String getCompanyUrl() {
return CompanyConfig.url();
}


/**
* Indica se è permessa la configurabilità delle richieste di assenza
* per i livelli I-III.
*/
public boolean absenceRequestAuthorizationTopLevelEnabled () {
return generalSettingDao.generalSetting().enableAbsenceTopLevelAuthorization;
}
}
2 changes: 1 addition & 1 deletion app/jobs/AbsencesRedefinitionsJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
*/
@Slf4j
@OnApplicationStart(async = true)
@OnApplicationStart
public class AbsencesRedefinitionsJob extends Job<Void> {

@Inject
Expand Down
88 changes: 88 additions & 0 deletions app/jobs/ParentalCodesFix.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package jobs;

import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import dao.absences.AbsenceComponentDao;
import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import models.Person;
import models.absences.Absence;
import org.joda.time.LocalDate;
import play.Play;
import play.jobs.Job;
import play.jobs.OnApplicationStart;

@Slf4j
@OnApplicationStart(async = true)
public class ParentalCodesFix extends Job {

@Inject
static AbsenceComponentDao absenceComponentDao;

@Override
public void doJob() {

//in modo da inibire l'esecuzione dei job in base alla configurazione
if (!"true".equals(Play.configuration.getProperty(Bootstrap.JOBS_CONF))) {
log.info("{} interrotto. Disattivato dalla configurazione.", getClass().getName());
return;
}
log.info("Start Job parental codes fix");
List<String> codes = ImmutableList.of("25O", "252O", "253O", "254O", "25MO", "252MO", "253MO",
"254MO", "25OH7", "252OH7", "253OH7", "254OH7");
List<Absence> allChildrenCodes = absenceComponentDao.absences(codes);
List<Absence> childrenCodesFiltered = allChildrenCodes.stream()
.filter(ab -> !ab.personDay.date.isBefore(new LocalDate(2022, 8, 13)))
.collect(Collectors.toList());
log.debug("Ci sono {} assenze da modificare", childrenCodesFiltered.size() );
for (Absence abs : childrenCodesFiltered) {
switch (abs.absenceType.code) {
case "25O":
abs.absenceType = absenceComponentDao.absenceTypeByCode("25").get();
break;
case "252O":
abs.absenceType = absenceComponentDao.absenceTypeByCode("252").get();
break;
case "253O":
abs.absenceType = absenceComponentDao.absenceTypeByCode("253").get();
break;
case "254O":
abs.absenceType = absenceComponentDao.absenceTypeByCode("254").get();
break;
case "25MO":
abs.absenceType = absenceComponentDao.absenceTypeByCode("25M").get();
break;
case "252MO":
abs.absenceType = absenceComponentDao.absenceTypeByCode("252M").get();
break;
case "253MO":
abs.absenceType = absenceComponentDao.absenceTypeByCode("253M").get();
break;
case "254MO":
abs.absenceType = absenceComponentDao.absenceTypeByCode("254M").get();
break;
case "25OH7":
abs.absenceType = absenceComponentDao.absenceTypeByCode("25H7").get();
break;
case "252OH7":
abs.absenceType = absenceComponentDao.absenceTypeByCode("252H7").get();
break;
case "253OH7":
abs.absenceType = absenceComponentDao.absenceTypeByCode("253H7").get();
break;
case "254OH7":
abs.absenceType = absenceComponentDao.absenceTypeByCode("254H7").get();
break;
default:
break;
}
abs.save();
}

log.info("End Job parental codes fix");

}
}
Loading

0 comments on commit e7cda93

Please sign in to comment.