Search in sources :

Example 6 with HRConfig

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);
}
Also used : HRConfig(com.axelor.apps.hr.db.HRConfig) HRConfigRepository(com.axelor.apps.hr.db.repo.HRConfigRepository) LunchVoucherAdvanceRepository(com.axelor.apps.hr.db.repo.LunchVoucherAdvanceRepository) Transactional(com.google.inject.persist.Transactional)

Example 7 with HRConfig

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;
}
Also used : HRConfig(com.axelor.apps.hr.db.HRConfig) Template(com.axelor.apps.message.db.Template) Transactional(com.google.inject.persist.Transactional)

Example 8 with HRConfig

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());
    }
}
Also used : Company(com.axelor.apps.base.db.Company) HRConfig(com.axelor.apps.hr.db.HRConfig) HRConfigService(com.axelor.apps.hr.service.config.HRConfigService)

Example 9 with HRConfig

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;
}
Also used : HRConfig(com.axelor.apps.hr.db.HRConfig) Template(com.axelor.apps.message.db.Template) Transactional(com.google.inject.persist.Transactional)

Example 10 with HRConfig

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;
}
Also used : HRConfig(com.axelor.apps.hr.db.HRConfig) Template(com.axelor.apps.message.db.Template) Transactional(com.google.inject.persist.Transactional)

Aggregations

HRConfig (com.axelor.apps.hr.db.HRConfig)16 Transactional (com.google.inject.persist.Transactional)8 Company (com.axelor.apps.base.db.Company)5 Template (com.axelor.apps.message.db.Template)4 BigDecimal (java.math.BigDecimal)4 EventsPlanning (com.axelor.apps.base.db.EventsPlanning)3 Employee (com.axelor.apps.hr.db.Employee)3 HRConfigService (com.axelor.apps.hr.service.config.HRConfigService)3 Product (com.axelor.apps.base.db.Product)2 WeeklyPlanning (com.axelor.apps.base.db.WeeklyPlanning)2 PayrollLeave (com.axelor.apps.hr.db.PayrollLeave)2 User (com.axelor.auth.db.User)2 AxelorException (com.axelor.exception.AxelorException)2 LocalDate (java.time.LocalDate)2 AppBase (com.axelor.apps.base.db.AppBase)1 AppLeave (com.axelor.apps.base.db.AppLeave)1 AppTimesheet (com.axelor.apps.base.db.AppTimesheet)1 PriceList (com.axelor.apps.base.db.PriceList)1 Sequence (com.axelor.apps.base.db.Sequence)1 PublicHolidayService (com.axelor.apps.base.service.publicHoliday.PublicHolidayService)1