use of com.axelor.apps.hr.db.ExtraHours in project axelor-open-suite by axelor.
the class ExtraHoursController method valid.
/**
* validating request and sending mail to applicant
*
* @param request
* @param response
* @throws AxelorException
*/
public void valid(ActionRequest request, ActionResponse response) throws AxelorException {
try {
ExtraHours extraHours = request.getContext().asType(ExtraHours.class);
extraHours = Beans.get(ExtraHoursRepository.class).find(extraHours.getId());
Beans.get(ExtraHoursService.class).validate(extraHours);
Message message = Beans.get(ExtraHoursService.class).sendValidationEmail(extraHours);
if (message != null && message.getStatusSelect() == MessageRepository.STATUS_SENT) {
response.setFlash(String.format(I18n.get("Email sent to %s"), Beans.get(MessageServiceBaseImpl.class).getToRecipients(message)));
}
Beans.get(PeriodService.class).checkPeriod(extraHours.getCompany(), extraHours.getValidationDate());
} catch (Exception e) {
TraceBackService.trace(response, e);
} finally {
response.setReload(true);
}
}
Aggregations