use of com.axelor.apps.hr.db.ExtraHours in project axelor-open-suite by axelor.
the class ExtraHoursController method cancel.
// canceling request and sending mail to applicant
public void cancel(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).cancel(extraHours);
Message message = Beans.get(ExtraHoursService.class).sendCancellationEmail(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)));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
} finally {
response.setReload(true);
}
}
use of com.axelor.apps.hr.db.ExtraHours in project axelor-open-suite by axelor.
the class ExtraHoursController method refuse.
// refusing request and sending mail to applicant
public void refuse(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).refuse(extraHours);
Message message = Beans.get(ExtraHoursService.class).sendRefusalEmail(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)));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
} finally {
response.setReload(true);
}
}
use of com.axelor.apps.hr.db.ExtraHours in project axelor-open-suite by axelor.
the class ExtraHoursController method editExtraHoursSelected.
public void editExtraHoursSelected(ActionRequest request, ActionResponse response) {
Map extraHoursMap = (Map) request.getContext().get("extraHoursSelect");
ExtraHours extraHours = Beans.get(ExtraHoursRepository.class).find(new Long((Integer) extraHoursMap.get("id")));
response.setView(ActionView.define("Extra hours").model(ExtraHours.class.getName()).add("form", "extra-hours-form").param("forceEdit", "true").domain("self.id = " + extraHoursMap.get("id")).context("_showRecord", String.valueOf(extraHours.getId())).map());
}
use of com.axelor.apps.hr.db.ExtraHours in project axelor-open-suite by axelor.
the class ExtraHoursController method compute.
// counting total hours while computing extra hours lines
public void compute(ActionRequest request, ActionResponse response) {
try {
ExtraHours extraHours = request.getContext().asType(ExtraHours.class);
Beans.get(ExtraHoursService.class).compute(extraHours);
response.setValue("totalQty", extraHours.getTotalQty());
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.hr.db.ExtraHours in project axelor-open-suite by axelor.
the class ExtraHoursController method confirm.
// confirming request and sending mail to manager
public void confirm(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).confirm(extraHours);
Message message = Beans.get(ExtraHoursService.class).sendConfirmationEmail(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)));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
} finally {
response.setReload(true);
}
}
Aggregations