use of com.axelor.apps.hr.db.HRConfig in project axelor-open-suite by axelor.
the class LunchVoucherAdvanceServiceImpl method onNewAdvance.
@Override
@Transactional(rollbackOn = { Exception.class })
public void onNewAdvance(LunchVoucherAdvance lunchVoucherAdvance) throws AxelorException {
HRConfig config = hrConfigService.getHRConfig(lunchVoucherAdvance.getEmployee().getMainEmploymentContract().getPayCompany());
config.setAvailableStockLunchVoucher(config.getAvailableStockLunchVoucher() - lunchVoucherAdvance.getNbrLunchVouchers());
Beans.get(LunchVoucherAdvanceRepository.class).save(lunchVoucherAdvance);
Beans.get(HRConfigRepository.class).save(config);
}
use of com.axelor.apps.hr.db.HRConfig in project axelor-open-suite by axelor.
the class TimesheetServiceImpl method sendConfirmationEmail.
@Override
@Transactional(rollbackOn = { Exception.class })
public Message sendConfirmationEmail(Timesheet timesheet) throws AxelorException, ClassNotFoundException, InstantiationException, IllegalAccessException, MessagingException, IOException, JSONException {
HRConfig hrConfig = hrConfigService.getHRConfig(timesheet.getCompany());
Template template = hrConfig.getSentTimesheetTemplate();
if (hrConfig.getTimesheetMailNotification() && template != null) {
return templateMessageService.generateAndSendMessage(timesheet, template);
}
return null;
}
use of com.axelor.apps.hr.db.HRConfig in project axelor-open-suite by axelor.
the class LunchVoucherMgtLineServiceImpl method fillLunchVoucherFormat.
@Override
public void fillLunchVoucherFormat(Employee employee, LunchVoucherMgt lunchVoucherMgt, LunchVoucherMgtLine lunchVoucherMgtLine) throws AxelorException {
int employeeFormat = employee.getLunchVoucherFormatSelect();
if (employeeFormat != 0) {
lunchVoucherMgtLine.setLunchVoucherFormatSelect(employeeFormat);
} else {
Company company = lunchVoucherMgt.getCompany();
HRConfig hrConfig = Beans.get(HRConfigService.class).getHRConfig(company);
lunchVoucherMgtLine.setLunchVoucherFormatSelect(hrConfig.getLunchVoucherFormatSelect());
}
}
use of com.axelor.apps.hr.db.HRConfig in project axelor-open-suite by axelor.
the class TimesheetServiceImpl method sendValidationEmail.
@Override
@Transactional(rollbackOn = { Exception.class })
public Message sendValidationEmail(Timesheet timesheet) throws AxelorException, ClassNotFoundException, InstantiationException, IllegalAccessException, MessagingException, IOException, JSONException {
HRConfig hrConfig = hrConfigService.getHRConfig(timesheet.getCompany());
Template template = hrConfig.getValidatedTimesheetTemplate();
if (hrConfig.getTimesheetMailNotification() && template != null) {
return templateMessageService.generateAndSendMessage(timesheet, template);
}
return null;
}
use of com.axelor.apps.hr.db.HRConfig in project axelor-open-suite by axelor.
the class TimesheetServiceImpl method sendRefusalEmail.
@Override
@Transactional(rollbackOn = { Exception.class })
public Message sendRefusalEmail(Timesheet timesheet) throws AxelorException, ClassNotFoundException, InstantiationException, IllegalAccessException, MessagingException, IOException, JSONException {
HRConfig hrConfig = hrConfigService.getHRConfig(timesheet.getCompany());
Template template = hrConfig.getRefusedTimesheetTemplate();
if (hrConfig.getTimesheetMailNotification() && template != null) {
return templateMessageService.generateAndSendMessage(timesheet, template);
}
return null;
}
Aggregations