From cc800e56d5f0509de8efb411605d212b1c85c7c9 Mon Sep 17 00:00:00 2001 From: Cristian Lucchesi Date: Mon, 12 Sep 2022 16:52:57 +0200 Subject: [PATCH 1/4] Aggiunta configurazione per la comunicazione delle assenze livelli I-III --- app/controllers/Configurations.java | 19 +++++++++++++-- app/helpers/TemplateUtility.java | 8 +++++++ app/manager/configurations/EpasParam.java | 24 +++++++++++++++++++ app/models/GeneralSetting.java | 7 ++++++ app/views/Administration/_generalSetting.html | 12 ++++++++++ conf/messages.it | 4 ++++ db/evolutions/192.sql | 9 +++++++ 7 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 db/evolutions/192.sql diff --git a/app/controllers/Configurations.java b/app/controllers/Configurations.java index 9e4d8b762..76c010c0f 100755 --- a/app/controllers/Configurations.java +++ b/app/controllers/Configurations.java @@ -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; @@ -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) { @@ -256,10 +258,23 @@ public static void show(Long officeId, EpasParamCategory paramCategory) { .filter(conf -> conf.epasParam.category == EpasParam.EpasParamCategory.AUTOCERTIFICATION) .collect(Collectors.toList()); - final List flows = configurations.stream() + List 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_MANAGER_NOTIFICATION) && + !conf.epasParam.equals(EpasParam.ABSENCE_TOP_LEVEL_OFFICE_HEAD_NOTIFICATION)) + .collect(Collectors.toList()); + } final List competenceFlows = configurations.stream() .filter(conf -> conf.epasParam.category == EpasParam.EpasParamCategory.COMPETENCE_FLOWS) .collect(Collectors.toList()); diff --git a/app/helpers/TemplateUtility.java b/app/helpers/TemplateUtility.java index 37d7d42ce..99fbf6c32 100644 --- a/app/helpers/TemplateUtility.java +++ b/app/helpers/TemplateUtility.java @@ -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; + } } diff --git a/app/manager/configurations/EpasParam.java b/app/manager/configurations/EpasParam.java index ac9fd1e99..280ee6b19 100644 --- a/app/manager/configurations/EpasParam.java +++ b/app/manager/configurations/EpasParam.java @@ -681,6 +681,30 @@ public enum EpasParam { Lists.newArrayList(), Office.class), + /** + * Il responsabile di sede deve ricevere le notifiche delle comunicazioni di ferie deli livelli I-III. + */ + ABSENCE_TOP_LEVEL_OFFICE_HEAD_NOTIFICATION( + "absence_top_level_office_head_notification", + EpasParamCategory.FLOWS, + EpasParamTimeType.PERIODIC, + EpasParamValueType.BOOLEAN, + EpasParamValueType.formatValue(true), + Lists.newArrayList(), + Office.class), + + /** + * Il responsabile di gruppo deve ricevere le notifiche delle comunicazioni di ferie deli livelli I-III. + */ + ABSENCE_TOP_LEVEL_MANAGER_NOTIFICATION( + "absence_top_level_manager_notification", + EpasParamCategory.FLOWS, + EpasParamTimeType.PERIODIC, + EpasParamValueType.BOOLEAN, + EpasParamValueType.formatValue(false), + Lists.newArrayList(), + Office.class), + //##################################################################### //FLOWS PARAMS COMPETENCES diff --git a/app/models/GeneralSetting.java b/app/models/GeneralSetting.java index a269a12ca..cc9ac82a8 100644 --- a/app/models/GeneralSetting.java +++ b/app/models/GeneralSetting.java @@ -98,5 +98,12 @@ public class GeneralSetting extends BaseModel { * inserire timbrature via REST. */ public int maxDaysInPastForRestStampings = 90; + + /* + * Indica se è possibile o meno configurare per i livelli I-III + * la richiesta di approvazione ferie da parte di un responsabile di + * gruppo o del responsabile di sede. + */ + public boolean enableAbsenceTopLevelAuthorization = true; } \ No newline at end of file diff --git a/app/views/Administration/_generalSetting.html b/app/views/Administration/_generalSetting.html index f90ed3d70..053fb8854 100644 --- a/app/views/Administration/_generalSetting.html +++ b/app/views/Administration/_generalSetting.html @@ -64,6 +64,18 @@

&{actionSelected+'.table'}

#{/b.buttons} #{/form} #{/accordionItem} + #{accordionItem 'enableAbsenceTopLevelRequestAuthorization', parent:'generalSetting', + title:'Abilitazione dei flussi di approvazione per i livelli I-III', open:false} + #{form action:@saveGeneralSetting(), method:'POST', class:'form form-horizontal'} + #{f.hidden 'generalSetting.id' /} + #{alert color:'info'}Permette di configurazione l'approvazione delle richieste di assenza per i livelli I-III. Se impostato a "no" per i livelli I-III sarà possibile solo configurare le notifiche per le comunicazioni di assenza. #{/alert} + #{f.booleanRadio 'generalSetting.enableAbsenceTopLevelAuthorization' /} + #{b.buttons} + #{b.save /} + #{/b.buttons} + #{/form} + #{/accordionItem} + #{accordionItem 'handleGroupsByInstitute', parent:'generalSetting', title:'Gestione gruppi per istituto', open:false} #{form action:@saveGeneralSetting(), method:'POST', class:'form form-horizontal'} #{f.hidden 'generalSetting.id' /} diff --git a/conf/messages.it b/conf/messages.it index cde42bc90..e623012d1 100755 --- a/conf/messages.it +++ b/conf/messages.it @@ -449,6 +449,7 @@ generalSetting.enableAutoconfigCovid19=Abilita visione auto inserimento covid19 generalSetting.enableAutoconfigSmartworking=Abilita visione auto inserimento smartworking in configurazione generalSetting.enableDailyPresenceForManager=Abilita visualizzazione presenza giornaliera dipendenti appartenenti a gruppo generalSetting.holidayShiftInNightToo=Considera come festivi i turni notturni effettuati nei festivi +generalSetting.enableAbsenceTopLevelAuthorization=Possibilità di configurare le autorizzazioni per le assenze dei livelli I-III group.label =Nome gruppo group.limitType =Periodo di utililzzo limite @@ -1267,6 +1268,9 @@ PERSONAL_PERMISSION_REQUEST_I_III_MANAGER_APPROVAL_REQUIRED =Richiesta approvazi PERSONAL_PERMISSION_REQUEST_IV_VIII_MANAGER_APPROVAL_REQUIRED =Richiesta approvazione permessi personali per i livelli IV-VIII da parte del Responsabile gruppo di lavoro PERSONAL_PERMISSION_REQUEST_MANAGER_OFFICE_HEAD_APPROVAL_REQUIRED =Richiesta approvazione permessi personali per i Responsabili di gruppo da parte del Responsabile di Sede +ABSENCE_TOP_LEVEL_OFFICE_HEAD_NOTIFICATION=Invio notifica a responsabile di sede per comunicazione assenza livelli I-III +ABSENCE_TOP_LEVEL_MANAGER_NOTIFICATION=Invio notifica a responsabile di gruppo per comunicazione assenza livelli I-III + ENABLE_COMPETENCE_FLOWS =Abilitazione flusso di richiesta competenze CHANGE_REPERIBILITY_REQUEST_REPERIBILITY_MANAGER_APPROVAL_REQUIRED =Richiesta approvazione del responsabile del servizio per cambio giorno di reperibilità CHANGE_REPERIBILITY_REQUEST_EMPLOYEE_APPROVAL_REQUIRED =Richiesta approvazione del reperibile per cambio giorno di reperibilità diff --git a/db/evolutions/192.sql b/db/evolutions/192.sql new file mode 100644 index 000000000..c936e7ddb --- /dev/null +++ b/db/evolutions/192.sql @@ -0,0 +1,9 @@ +# ---!Ups + +ALTER TABLE general_setting ADD COLUMN enable_absence_top_level_authorization BOOLEAN DEFAULT TRUE; +ALTER TABLE general_setting_history ADD COLUMN enable_absence_top_level_authorization BOOLEAN; + +# ---!Downs + +ALTER TABLE general_setting DROP COLUMN enable_absence_top_level_authorization; +ALTER TABLE general_setting_history DROP enable_absence_top_level_authorization; \ No newline at end of file From 70bc6df2e2f16145bf1849ae74af8ebc04ee023c Mon Sep 17 00:00:00 2001 From: Cristian Lucchesi Date: Wed, 14 Sep 2022 18:19:35 +0200 Subject: [PATCH 2/4] Versione non ancora funzionante comunicazione assenze liv. I-III --- app/controllers/Configurations.java | 5 +- app/manager/NotificationManager.java | 120 +++++++++++++++++- app/manager/configurations/EpasParam.java | 16 ++- app/manager/flows/AbsenceRequestManager.java | 23 +++- .../absences/AbsenceEngineUtility.java | 1 - .../absences/model/AbsencePeriod.java | 1 - app/models/PersonalWorkingTime.java | 7 - app/views/AbsenceRequests/edit.html | 10 +- app/views/AbsenceRequests/list.html | 14 +- app/views/_workflowsMenu.html | 29 +++-- app/views/tags/secure/li.html | 5 +- conf/messages.it | 15 ++- 12 files changed, 199 insertions(+), 47 deletions(-) diff --git a/app/controllers/Configurations.java b/app/controllers/Configurations.java index 76c010c0f..ce7163dfe 100755 --- a/app/controllers/Configurations.java +++ b/app/controllers/Configurations.java @@ -271,8 +271,9 @@ public static void show(Long officeId, EpasParamCategory paramCategory) { .collect(Collectors.toList()); } else { flows = flows.stream().filter(conf -> - !conf.epasParam.equals(EpasParam.ABSENCE_TOP_LEVEL_MANAGER_NOTIFICATION) && - !conf.epasParam.equals(EpasParam.ABSENCE_TOP_LEVEL_OFFICE_HEAD_NOTIFICATION)) + !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 competenceFlows = configurations.stream() diff --git a/app/manager/NotificationManager.java b/app/manager/NotificationManager.java index 1e3103ed1..254ea7bb9 100644 --- a/app/manager/NotificationManager.java +++ b/app/manager/NotificationManager.java @@ -20,9 +20,11 @@ import com.google.common.base.Optional; import com.google.common.base.Strings; import com.google.common.base.Verify; +import com.google.common.collect.Sets; import com.google.inject.Inject; import controllers.Security; import dao.AbsenceDao; +import dao.GeneralSettingDao; import dao.GroupDao; import dao.InformationRequestDao; import dao.RoleDao; @@ -89,7 +91,8 @@ public class NotificationManager { private GroupDao groupDao; private ConfigurationManager configurationManager; private InformationRequestDao requestDao; - + private GeneralSettingDao generalSettingDao; + final String dateFormatter = "dd/MM/YYYY"; /** @@ -98,7 +101,8 @@ public class NotificationManager { @Inject public NotificationManager(SecureManager secureManager, RoleDao roleDao, AbsenceDao absenceDao, AbsenceComponentDao componentDao, GroupDao groupDao, - ConfigurationManager configurationManager, InformationRequestDao requestDao) { + ConfigurationManager configurationManager, InformationRequestDao requestDao, + GeneralSettingDao generalSettingDao) { this.secureManager = secureManager; this.roleDao = roleDao; this.absenceDao = absenceDao; @@ -106,7 +110,7 @@ public NotificationManager(SecureManager secureManager, RoleDao roleDao, Absence this.groupDao = groupDao; this.configurationManager = configurationManager; this.requestDao = requestDao; - + this.generalSettingDao = generalSettingDao; } private static final String WORKDAY_REPERIBILITY = "207"; @@ -749,6 +753,15 @@ private void sendEmailAbsenceRequest(AbsenceRequest absenceRequest) { Verify.verifyNotNull(absenceRequest); final Person person = absenceRequest.person; + //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 == false && + absenceRequest.person.isTopQualification()) { + sendEmailAbsenceNotification(absenceRequest); + } + final Role roleDestination = getProperRole(absenceRequest); if (roleDestination == null) { log.warn( @@ -794,6 +807,67 @@ private void sendEmailAbsenceRequest(AbsenceRequest absenceRequest) { }); } + private void sendEmailAbsenceNotification(AbsenceRequest absenceRequest) { + Set recipients = Sets.newHashSet(); + //si invia solo una notifica al responsabile sede e/o responsabile gruppo + //(dipendente dalla configurazione) + + //Email al responsabile di sede per i livelli I-III che NON SONO + //responsabili di gruppo + if (configurationManager.configValue(absenceRequest.person.office, + EpasParam.ABSENCE_TOP_LEVEL_OFFICE_HEAD_NOTIFICATION, LocalDate.now()).equals(Boolean.TRUE) + && !absenceRequest.person.isGroupManager()) { + recipients = + absenceRequest.person.office.usersRolesOffices.stream() + .filter(uro -> uro.role.name.equals(Role.SEAT_SUPERVISOR)).map(uro -> uro.user.person) + .collect(Collectors.toSet()); + } + //Email al responsabile di sede per i livelli I-III che SONO + //responsabili di gruppo + if (configurationManager.configValue(absenceRequest.person.office, + EpasParam.ABSENCE_TOP_LEVEL_OF_GROUP_MANAGER_OFFICE_HEAD_NOTIFICATION, LocalDate.now()).equals(Boolean.TRUE) + && absenceRequest.person.isGroupManager()) { + recipients = + absenceRequest.person.office.usersRolesOffices.stream() + .filter(uro -> uro.role.name.equals(Role.SEAT_SUPERVISOR)).map(uro -> uro.user.person) + .collect(Collectors.toSet()); + } + //Email al responsabile di gruppo per i livelli I-III del suo gruppo (se sono attive + //notifiche al responsabile di gruppo nella configurazione del gruppo). + if (configurationManager.configValue(absenceRequest.person.office, + EpasParam.ABSENCE_TOP_LEVEL_GROUP_MANAGER_NOTIFICATION, LocalDate.now()).equals(Boolean.TRUE)) { + recipients.addAll(groupDao.myGroups(absenceRequest.person).stream() + .filter(group -> group.sendFlowsEmail) + .map(group -> group.manager) + .collect(Collectors.toSet())); + } + + if (!recipients.isEmpty()) { + SimpleEmail simpleEmail = new SimpleEmail(); + recipients.forEach(r -> { + try { + simpleEmail.addTo(r.email); + simpleEmail.setSubject( + String.format("ePas Comunicazione assenza (%s)", absenceRequest.id)); + val mailBody = createAbsenceNotificationEmail(absenceRequest, r.user); + try { + simpleEmail.setMsg(mailBody); + } catch (EmailException e) { + e.printStackTrace(); + } + Mail.send(simpleEmail); + log.info( + "Inviata email per richiesta di flusso richiesta: {}. " + + "Mail: \n\tTo: {}\n\tSubject: {}\n\tbody: {}", + absenceRequest, r.user.person.email, simpleEmail.getSubject(), mailBody); + } catch (EmailException e) { + log.error("Impossibile inviare l'email a {} che è destinatario del email " + + "per la comunicazione dell'assenza di {}", + r.getFullname(), absenceRequest.person.getFullname(), e); + } + }); + } + } /** * Metodo privato che invia la mail al richiedente la ferie/riposo compensativo. * @@ -825,10 +899,10 @@ private void sendEmailAbsenceRequestConfirmation(AbsenceRequest absenceRequest, approver = " da " + Security.getUser().get().person.getFullname(); } if (approval) { - message.append(String.format("\r\nè stata APPROVATA%s la sua richiesta di : %s", + message.append(String.format("\r\nè stata APPROVATA%s la sua %s", approver, requestType)); } else { - message.append(String.format("\r\nè stata RESPINTA%s la sua richiesta di : %s", + message.append(String.format("\r\nè stata RESPINTA%s la sua %s", approver, requestType)); } @@ -842,7 +916,7 @@ private void sendEmailAbsenceRequestConfirmation(AbsenceRequest absenceRequest, } Mail.send(simpleEmail); log.info( - "Inviata email per approvazione di flusso richiesta: {}. " + "Inviata email per approvazione di flusso {}. " + "Mail: \n\tTo: {}\n\tSubject: {}\n\tbody: {}", absenceRequest, person.email, simpleEmail.getSubject(), mailBody); @@ -891,6 +965,40 @@ private String createAbsenceRequestEmail(AbsenceRequest absenceRequest, User use return message.toString(); } + /** + * Metodo che compone il corpo della mail da inviare. + * + * @param absenceRequest la richiesta d'assenza + * @param user l'utente a cui inviare la mail + * @return il corpo della mail da inviare all'utente responsabile dell'approvazione. + */ + private String createAbsenceNotificationEmail(AbsenceRequest absenceRequest, User user) { + + String requestType = ""; + if (absenceRequest.type == AbsenceRequestType.COMPENSATORY_REST) { + requestType = Messages.get("AbsenceRequestType.COMPENSATORY_REST"); + } else if (absenceRequest.type == AbsenceRequestType.VACATION_PAST_YEAR_AFTER_DEADLINE_REQUEST) { + requestType = Messages.get("AbsenceRequestType.VACATION_PAST_YEAR_AFTER_DEADLINE_REQUEST_TOP_LEVEL"); + } else { + requestType = Messages.get("AbsenceRequestType.VACATION_REQUEST"); + } + final StringBuilder message = + new StringBuilder().append(String.format("Gentile %s,\r\n", user.person.fullName())); + message.append(String.format("\r\nLe è stata notificata da %s", + absenceRequest.person.fullName())); + message.append(String.format("\r\n una assenza di tipo: %s", requestType)); + if (absenceRequest.startAt.isEqual(absenceRequest.endTo)) { + message.append(String.format("\r\n per il giorno: %s", + absenceRequest.startAt.toLocalDate().toString(dateFormatter))); + } else { + message.append(String.format("\r\n dal: %s", + absenceRequest.startAt.toLocalDate().toString(dateFormatter))); + message.append( + String.format(" al: %s", absenceRequest.endTo.toLocalDate().toString(dateFormatter))); + } + return message.toString(); + } + ////////////////////////////////////////////////////////////////////////////////////////// // Notifiche per competence request ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/app/manager/configurations/EpasParam.java b/app/manager/configurations/EpasParam.java index 280ee6b19..530283b3e 100644 --- a/app/manager/configurations/EpasParam.java +++ b/app/manager/configurations/EpasParam.java @@ -693,11 +693,23 @@ public enum EpasParam { Lists.newArrayList(), Office.class), + /** + * Il responsabile di sede deve ricevere le notifiche delle comunicazioni di ferie deli livelli I-III. + */ + ABSENCE_TOP_LEVEL_OF_GROUP_MANAGER_OFFICE_HEAD_NOTIFICATION( + "absence_top_level_of_group_manager_office_head_notification", + EpasParamCategory.FLOWS, + EpasParamTimeType.PERIODIC, + EpasParamValueType.BOOLEAN, + EpasParamValueType.formatValue(true), + Lists.newArrayList(), + Office.class), + /** * Il responsabile di gruppo deve ricevere le notifiche delle comunicazioni di ferie deli livelli I-III. */ - ABSENCE_TOP_LEVEL_MANAGER_NOTIFICATION( - "absence_top_level_manager_notification", + ABSENCE_TOP_LEVEL_GROUP_MANAGER_NOTIFICATION( + "absence_top_level_group_manager_notification", EpasParamCategory.FLOWS, EpasParamTimeType.PERIODIC, EpasParamValueType.BOOLEAN, diff --git a/app/manager/flows/AbsenceRequestManager.java b/app/manager/flows/AbsenceRequestManager.java index 9f0115b93..470cc4c7c 100644 --- a/app/manager/flows/AbsenceRequestManager.java +++ b/app/manager/flows/AbsenceRequestManager.java @@ -22,6 +22,7 @@ import com.google.common.collect.Maps; import controllers.Security; import dao.AbsenceRequestDao; +import dao.GeneralSettingDao; import dao.GroupDao; import dao.PersonReperibilityDayDao; import dao.PersonShiftDayDao; @@ -97,7 +98,8 @@ public class AbsenceRequestManager { private GroupDao groupDao; private PersonReperibilityDayDao personReperibilityDayDao; private PersonShiftDayDao personShiftDayDao; - + private GeneralSettingDao generalSettingDao; + /** * DTO per la configurazione delle AbsenceRequest. */ @@ -127,7 +129,8 @@ public AbsenceRequestManager(ConfigurationManager configurationManager, AbsenceService absenceService, AbsenceManager absenceManager, AbsenceComponentDao absenceDao, PersonDayManager personDayManager, ConsistencyManager consistencyManager, AbsenceRequestDao absenceRequestDao, GroupDao groupDao, - PersonReperibilityDayDao personReperibilityDayDao, PersonShiftDayDao personShiftDayDao) { + PersonReperibilityDayDao personReperibilityDayDao, PersonShiftDayDao personShiftDayDao, + GeneralSettingDao generalSettingDao) { this.configurationManager = configurationManager; this.uroDao = uroDao; this.roleDao = roleDao; @@ -141,6 +144,7 @@ public AbsenceRequestManager(ConfigurationManager configurationManager, this.groupDao = groupDao; this.personReperibilityDayDao = personReperibilityDayDao; this.personShiftDayDao = personShiftDayDao; + this.generalSettingDao = generalSettingDao; } private static final String FERIE_CNR = "FERIE_CNR"; @@ -205,8 +209,14 @@ public List checkconfiguration(AbsenceRequestType requestType, Person pe public AbsenceRequestConfiguration getConfiguration(AbsenceRequestType requestType, Person person) { val absenceRequestConfiguration = new AbsenceRequestConfiguration(person, requestType); + + //Per i livelli I-III in configurazione generale può esserci scritto di + //non abilitare la possibilità di chiedere autorizzazioni, in questo caso i flussi + //dei livelli I-III non hanno mai approvazioni richieste. + val skipTopLevelAuthorization = + person.isTopQualification() && !generalSettingDao.generalSetting().enableAbsenceTopLevelAuthorization; - if (requestType.alwaysSkipAdministrativeApproval) { + if (requestType.alwaysSkipAdministrativeApproval || skipTopLevelAuthorization) { absenceRequestConfiguration.administrativeApprovalRequired = false; } else { if (person.isTopQualification() @@ -223,7 +233,8 @@ public AbsenceRequestConfiguration getConfiguration(AbsenceRequestType requestTy } } - if (requestType.alwaysSkipManagerApproval || person.isGroupManager()) { + if (requestType.alwaysSkipManagerApproval || person.isGroupManager() || + skipTopLevelAuthorization) { absenceRequestConfiguration.managerApprovalRequired = false; } else { if (person.isTopQualification() && requestType.managerApprovalRequiredTopLevel.isPresent()) { @@ -238,7 +249,7 @@ public AbsenceRequestConfiguration getConfiguration(AbsenceRequestType requestTy requestType.managerApprovalRequiredTechnicianLevel.get(), LocalDate.now()); } } - if (requestType.alwaysSkipOfficeHeadApproval) { + if (requestType.alwaysSkipOfficeHeadApproval || skipTopLevelAuthorization) { absenceRequestConfiguration.officeHeadApprovalRequired = false; } else { if (person.isTopQualification() @@ -255,7 +266,7 @@ public AbsenceRequestConfiguration getConfiguration(AbsenceRequestType requestTy } } - if (requestType.alwaysSkipOfficeHeadApprovalForManager) { + if (requestType.alwaysSkipOfficeHeadApprovalForManager || skipTopLevelAuthorization) { absenceRequestConfiguration.officeHeadApprovalForManagerRequired = false; } else { if (person.isGroupManager()) { diff --git a/app/manager/services/absences/AbsenceEngineUtility.java b/app/manager/services/absences/AbsenceEngineUtility.java index 2eaee1629..6edad6bb2 100644 --- a/app/manager/services/absences/AbsenceEngineUtility.java +++ b/app/manager/services/absences/AbsenceEngineUtility.java @@ -34,7 +34,6 @@ import models.Contract; import models.ContractWorkingTimeType; import models.Person; -import models.PersonDay; import models.absences.Absence; import models.absences.AbsenceType; import models.absences.AbsenceTypeJustifiedBehaviour; diff --git a/app/manager/services/absences/model/AbsencePeriod.java b/app/manager/services/absences/model/AbsencePeriod.java index d91674a52..89fdefb07 100644 --- a/app/manager/services/absences/model/AbsencePeriod.java +++ b/app/manager/services/absences/model/AbsencePeriod.java @@ -28,7 +28,6 @@ import java.util.Map; import java.util.Set; import java.util.SortedMap; -import javax.inject.Inject; import manager.PersonDayManager; import manager.services.absences.AbsenceEngineUtility; import manager.services.absences.errors.ErrorsBox; diff --git a/app/models/PersonalWorkingTime.java b/app/models/PersonalWorkingTime.java index 67b0d989a..d4f9f8996 100644 --- a/app/models/PersonalWorkingTime.java +++ b/app/models/PersonalWorkingTime.java @@ -17,22 +17,15 @@ package models; -import com.google.common.base.Optional; import javax.persistence.Entity; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; -import javax.persistence.Transient; import lombok.Getter; import lombok.ToString; -import manager.configurations.EpasParam.EpasParamValueType.LocalTimeInterval; import models.base.IPropertiesInPeriodOwner; import models.base.IPropertyInPeriod; import models.base.PropertyInPeriod; -import org.joda.time.LocalTime; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; -import org.testng.util.Strings; import play.data.validation.Required; /** diff --git a/app/views/AbsenceRequests/edit.html b/app/views/AbsenceRequests/edit.html index 796bf9dcb..dabb08204 100644 --- a/app/views/AbsenceRequests/edit.html +++ b/app/views/AbsenceRequests/edit.html @@ -1,13 +1,19 @@ #{extends 'main.html' /} #{set header:'navbar' /} -#{set absenceRequestTypeLabel: messages.get('AbsenceRequestType.' + absenceRequest.type.toString() + 'S') /} +#{if currentUser.person != null && currentUser.person.isTopQualification()} + #{set absenceRequestTypeLabel: messages.get('AbsenceRequestType.' + absenceRequest.type.toString() + 'S_TOP_LEVEL') /} + #{set typeLabel: messages.get('AbsenceRequestType.' + absenceRequest.type.toString() + '_TOP_LEVEL') /} +#{/if}#{else} + #{set absenceRequestTypeLabel: messages.get('AbsenceRequestType.' + absenceRequest.type.toString() + 'S') /} + #{set typeLabel: messages.get('AbsenceRequestType.' + absenceRequest.type.toString()) /} +#{/else} #{set title:('ePAS - ' + absenceRequest.isPersistent() ? 'Modifica ' : 'Inserimento ' + absenceRequest.type.label()) /} #{set breadcrumbs:[(absenceRequestTypeLabel):@AbsenceRequests.list(absenceRequest.type), ('Modifica'):null] /}
#{breadcrumbs breadcrumbs /} - #{title title:(absenceRequest.isPersistent() ? 'Modifica ' : 'Inserimento ' + absenceRequest.type.label()) /} + #{title title:(absenceRequest.isPersistent() ? 'Modifica ' : 'Inserimento ' + messages.get(typeLabel)) /}
diff --git a/app/views/AbsenceRequests/list.html b/app/views/AbsenceRequests/list.html index a1e3e9b3a..48c10206a 100644 --- a/app/views/AbsenceRequests/list.html +++ b/app/views/AbsenceRequests/list.html @@ -1,6 +1,12 @@ #{extends 'main.html' /} #{set header:'navbar' /} -#{set absenceRequestTypeLabel: messages.get('AbsenceRequestType.' + type.toString() + 'S') /} +#{if currentUser.person != null && currentUser.person.isTopQualification()} + #{set absenceRequestTypeLabel: messages.get('AbsenceRequestType.' + type.toString() + 'S_TOP_LEVEL') /} + #{set topLevelNoAuth:true /} +#{/if}#{else} + #{set absenceRequestTypeLabel: messages.get('AbsenceRequestType.' + type.toString() + 'S') /} + #{set topLevelNoAuth:false /} +#{/else} #{set title:('ePAS - ' + absenceRequestTypeLabel) /} #{set breadcrumbs:[(absenceRequestTypeLabel):null] /} @@ -34,12 +40,14 @@ #{tabContentItem id:'attivo', active:true} #{b.buttons center:true} - &{'AbsenceRequestType.' + type + '.blank'} + + #{if topLevelNoAuth}&{'AbsenceRequestType.' + type + '_TOP_LEVEL.blank'}#{/if} + #{else}&{'AbsenceRequestType.' + type + '.blank'}#{/else} #{/b.buttons} #{if myResults.isEmpty()} #{alert color:'info'} -

Al momento non ci sono flussi di richiesta assenza in esecuzione.

+

Al momento non ci sono flussi di richiesta/comunicazione assenza in esecuzione.

#{/alert} #{/if} #{else} diff --git a/app/views/_workflowsMenu.html b/app/views/_workflowsMenu.html index 1ad7f168c..2dbaddcdb 100644 --- a/app/views/_workflowsMenu.html +++ b/app/views/_workflowsMenu.html @@ -29,16 +29,16 @@ + templateUtility.illnessRequests() + templateUtility.changeReperibilityRequests()} - #{/if} + #{/if}
Flussi di lavoro -
+
*{ items }*