use of com.axelor.apps.hr.db.HrBatch in project axelor-open-suite by axelor.
the class HrBatchController method launchHrBatch.
/**
* Launch any type of HR batch
*
* @param request
* @param response
* @throws AxelorException
*/
public void launchHrBatch(ActionRequest request, ActionResponse response) throws AxelorException {
HrBatch hrBatch = request.getContext().asType(HrBatch.class);
Batch batch = Beans.get(HrBatchService.class).run(Beans.get(HrBatchRepository.class).find(hrBatch.getId()));
if (batch != null) {
response.setFlash(batch.getComments());
}
response.setReload(true);
}
use of com.axelor.apps.hr.db.HrBatch in project axelor-open-suite by axelor.
the class HrBatchService method run.
@Override
public Batch run(Model batchModel) throws AxelorException {
HrBatch hrBatch = (HrBatch) batchModel;
Batch batch = null;
switch(hrBatch.getActionSelect()) {
case HrBatchRepository.ACTION_LEAVE_MANAGEMENT:
batch = leaveManagement(hrBatch);
break;
case HrBatchRepository.ACTION_SENIORITY_LEAVE_MANAGEMENT:
batch = seniorityLeaveManagement(hrBatch);
break;
case HrBatchRepository.ACTION_PAYROLL_PREPARATION_GENERATION:
batch = payrollPreparationGeneration(hrBatch);
break;
case HrBatchRepository.ACTION_PAYROLL_PREPARATION_EXPORT:
batch = payrollPreparationExport(hrBatch);
break;
case HrBatchRepository.ACTION_LEAVE_MANAGEMENT_RESET:
batch = leaveManagementReset(hrBatch);
break;
case HrBatchRepository.ACTION_EMPLOYMENT_CONTRACT_EXPORT:
batch = employmentContractExport(hrBatch);
break;
case HrBatchHRRepository.ACTION_TIMESHEET_REMINDER:
batch = runTimesheetReminderBatch(hrBatch);
break;
default:
throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_1), hrBatch.getActionSelect(), hrBatch.getCode());
}
return batch;
}
use of com.axelor.apps.hr.db.HrBatch in project axelor-open-suite by axelor.
the class HrBatchHRRepository method copy.
@Override
public HrBatch copy(HrBatch entity, boolean deep) {
HrBatch copy = super.copy(entity, deep);
copy.setBatchList(null);
return copy;
}
Aggregations