use of com.axelor.apps.message.db.Message in project axelor-open-suite by axelor.
the class TimesheetController method refuse.
// action called when refusing a timesheet. Changing status + Sending mail to Applicant
public void refuse(ActionRequest request, ActionResponse response) throws AxelorException {
try {
Timesheet timesheet = request.getContext().asType(Timesheet.class);
timesheet = Beans.get(TimesheetRepository.class).find(timesheet.getId());
Message message = Beans.get(TimesheetService.class).refuseAndSendRefusalEmail(timesheet);
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.message.db.Message in project axelor-open-suite by axelor.
the class TimesheetController method cancel.
public void cancel(ActionRequest request, ActionResponse response) {
try {
Timesheet timesheet = request.getContext().asType(Timesheet.class);
timesheet = Beans.get(TimesheetRepository.class).find(timesheet.getId());
Message message = Beans.get(TimesheetService.class).cancelAndSendCancellationEmail(timesheet);
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.message.db.Message in project axelor-open-suite by axelor.
the class TimesheetController method confirm.
/**
* Action called when confirming a timesheet. Changing status + Sending mail to Manager
*
* @param request
* @param response
*/
public void confirm(ActionRequest request, ActionResponse response) {
try {
Timesheet timesheet = request.getContext().asType(Timesheet.class);
timesheet = Beans.get(TimesheetRepository.class).find(timesheet.getId());
Message message = Beans.get(TimesheetService.class).confirmAndSendConfirmationEmail(timesheet);
if (message != null && message.getStatusSelect() == MessageRepository.STATUS_SENT) {
response.setFlash(String.format(I18n.get("Email sent to %s"), Beans.get(MessageServiceBaseImpl.class).getToRecipients(message)));
}
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(e);
response.setError(e.getMessage());
}
}
use of com.axelor.apps.message.db.Message in project axelor-open-suite by axelor.
the class ExpenseController method refuse.
// refusing expense and sending mail to applicant
public void refuse(ActionRequest request, ActionResponse response) throws AxelorException {
try {
Expense expense = request.getContext().asType(Expense.class);
expense = Beans.get(ExpenseRepository.class).find(expense.getId());
ExpenseService expenseService = Beans.get(ExpenseService.class);
expenseService.refuse(expense);
Message message = expenseService.sendRefusalEmail(expense);
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.message.db.Message in project axelor-open-suite by axelor.
the class ExpenseController method send.
// sending expense and sending mail to manager
public void send(ActionRequest request, ActionResponse response) throws AxelorException {
try {
Expense expense = request.getContext().asType(Expense.class);
expense = Beans.get(ExpenseRepository.class).find(expense.getId());
ExpenseService expenseService = Beans.get(ExpenseService.class);
expenseService.confirm(expense);
Message message = expenseService.sendConfirmationEmail(expense);
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