use of com.axelor.apps.hr.db.Employee in project axelor-open-suite by axelor.
the class EmploymentContractService method employmentContractExportSilae.
public void employmentContractExportSilae(EmploymentContract employmentContract, List<String[]> list) {
String[] item = new String[21];
item[0] = employmentContract.getId().toString();
item[1] = employmentContract.getStartDate() == null ? "" : employmentContract.getStartDate().toString();
item[2] = employmentContract.getEndDate() == null ? "" : employmentContract.getEndDate().toString();
Employee employee = employmentContract.getEmployee();
item[4] = employee.getMaritalName();
Partner contactPartner = employee.getContactPartner();
if (contactPartner != null) {
item[3] = contactPartner.getName();
item[5] = contactPartner.getFirstName();
Address mainAddress = contactPartner.getMainAddress();
if (mainAddress != null) {
item[6] = mainAddress.getAddressL4();
item[7] = mainAddress.getAddressL2();
item[8] = mainAddress.getZip();
if (mainAddress.getCity() != null) {
item[9] = mainAddress.getCity().getName();
} else {
item[9] = "";
}
}
item[10] = contactPartner.getMobilePhone();
item[11] = contactPartner.getFixedPhone();
item[12] = contactPartner.getEmailAddress() == null ? "" : contactPartner.getEmailAddress().getAddress();
}
item[13] = employee.getBirthDate() == null ? "" : employee.getBirthDate().toString();
Department birthDepartment = employee.getDepartmentOfBirth();
if (birthDepartment != null) {
item[14] = birthDepartment.getName();
item[16] = !birthDepartment.getCode().equals("99") ? "FR - FRANCE" : "Oui";
}
item[15] = employee.getCityOfBirth() == null ? "" : employee.getCityOfBirth().getName();
item[17] = employee.getSocialSecurityNumber();
item[18] = employmentContract.getPayCompany().getName();
item[19] = employmentContract.getContractType() == null ? "" : employmentContract.getContractType().getId().toString();
item[20] = employee.getMaidenName();
list.add(item);
}
use of com.axelor.apps.hr.db.Employee in project axelor-open-suite by axelor.
the class HRMenuTagService method countRecordsTag.
/**
* @param modelConcerned
* @param status 1 : Draft 2 : Confirmed 3 : Validated 4 : Refused 5 : Canceled
* @return The number of records
*/
public <T extends Model> String countRecordsTag(Class<T> modelConcerned, int status) {
User user = AuthUtils.getUser();
Employee employee = user.getEmployee();
String filter = "self.statusSelect = :_statusSelect";
if (employee != null && employee.getHrManager()) {
return Long.toString(JPA.all(modelConcerned).filter(filter).bind("_statusSelect", status).count());
} else {
filter += (employee == null || employee.getManagerUser() == null) ? " AND (self.user.id = :_userId OR self.user.employee.managerUser.id = :_userId)" : " AND self.user.employee.managerUser.id = :_userId";
return Long.toString(JPA.all(modelConcerned).filter(filter).bind("_userId", user.getId()).bind("_statusSelect", status).count());
}
}
use of com.axelor.apps.hr.db.Employee in project axelor-open-suite by axelor.
the class BatchLeaveManagementReset method resetLeaveManagementLines.
public void resetLeaveManagementLines(List<Employee> employeeList) {
for (Employee employee : employeeList.stream().filter(Objects::nonNull).collect(Collectors.toList())) {
employee = employeeRepository.find(employee.getId());
if (EmployeeHRRepository.isEmployeeFormerNewOrArchived(employee)) {
continue;
}
try {
resetLeaveManagement(employee);
} catch (AxelorException e) {
TraceBackService.trace(e, ExceptionOriginRepository.LEAVE_MANAGEMENT, batch.getId());
incrementAnomaly();
if (e.getCategory() == TraceBackRepository.CATEGORY_NO_VALUE) {
noValueAnomaly++;
}
if (e.getCategory() == TraceBackRepository.CATEGORY_CONFIGURATION_ERROR) {
confAnomaly++;
}
} finally {
total++;
JPA.clear();
}
}
}
use of com.axelor.apps.hr.db.Employee in project axelor-open-suite by axelor.
the class BatchTimesheetReminder method getEmployeesWithoutRecentTimesheet.
private List<Employee> getEmployeesWithoutRecentTimesheet(Company company) {
LocalDate now = appBaseService.getTodayDate(company);
long daysBeforeReminder = batch.getHrBatch().getDaysBeforeReminder();
List<Employee> employees = employeeRepository.all().filter("self.timesheetReminder = 't' AND self.mainEmploymentContract.payCompany = :companyId").bind("companyId", batch.getHrBatch().getCompany().getId()).fetch();
employees.removeIf(employee -> hasRecentTimesheet(now, daysBeforeReminder, employee) || EmployeeHRRepository.isEmployeeFormerNewOrArchived(employee));
return employees;
}
use of com.axelor.apps.hr.db.Employee in project axelor-open-suite by axelor.
the class EmployeeHRRepository method copy.
@Override
public Employee copy(Employee entity, boolean deep) {
entity.setContactPartner(null);
entity.setFixedProPhone(null);
entity.setMobileProPhone(null);
entity.setPhoneAtCustomer(null);
entity.setEmergencyContact(null);
entity.setEmergencyNumber(null);
entity.setHireDate(null);
entity.setSeniorityDate(null);
entity.setProfitSharingBeneficiary(null);
entity.setMainEmploymentContract(null);
entity.setExportCode(null);
entity.setEmploymentContractList(null);
entity.setLunchVoucherAdvanceList(null);
entity.setEmployeeAdvanceList(null);
entity.setKilometricLogList(null);
entity.setLeaveLineList(null);
Employee copy = super.copy(entity, deep);
return copy;
}
Aggregations