use of com.axelor.auth.db.User in project axelor-open-suite by axelor.
the class EmployeeController method showAnnualReport.
public void showAnnualReport(ActionRequest request, ActionResponse response) throws JSONException, NumberFormatException, AxelorException {
String employeeId = request.getContext().get("_id").toString();
String year = request.getContext().get("year").toString();
int yearId = new JSONObject(year).getInt("id");
String yearName = new JSONObject(year).getString("name");
User user = AuthUtils.getUser();
String name = I18n.get("Annual expenses report") + " : " + user.getFullName() + " (" + yearName + ")";
String fileLink = ReportFactory.createReport(IReport.EMPLOYEE_ANNUAL_REPORT, name).addParam("EmployeeId", Long.valueOf(employeeId)).addParam("Timezone", getTimezone(Beans.get(EmployeeRepository.class).find(Long.valueOf(employeeId)).getUser())).addParam("YearId", Long.valueOf(yearId)).addParam("Locale", ReportSettings.getPrintingLocale(null)).toAttach(Beans.get(EmployeeRepository.class).find(Long.valueOf(employeeId))).generate().getFileLink();
response.setView(ActionView.define(name).add("html", fileLink).map());
response.setCanClose(true);
}
use of com.axelor.auth.db.User in project axelor-open-suite by axelor.
the class EmployeeController method printEmployeePhonebook.
public void printEmployeePhonebook(ActionRequest request, ActionResponse response) throws AxelorException {
User user = AuthUtils.getUser();
String name = I18n.get("Employee PhoneBook");
String fileLink = ReportFactory.createReport(IReport.EMPLOYEE_PHONEBOOK, name + "-${date}").addParam("Locale", ReportSettings.getPrintingLocale(null)).addParam("UserId", user.getId()).addParam("Timezone", getTimezone(user)).generate().getFileLink();
LOG.debug("Printing " + name);
response.setView(ActionView.define(name).add("html", fileLink).map());
}
use of com.axelor.auth.db.User in project axelor-open-suite by axelor.
the class TimesheetController method historicTimesheetLine.
public void historicTimesheetLine(ActionRequest request, ActionResponse response) {
User user = AuthUtils.getUser();
Employee employee = user.getEmployee();
ActionViewBuilder actionView = ActionView.define(I18n.get("See timesheet lines")).model(TimesheetLine.class.getName()).add("grid", "timesheet-line-grid").add("form", "timesheet-line-form");
actionView.domain("self.timesheet.company = :_activeCompany AND (self.timesheet.statusSelect = 3 OR self.timesheet.statusSelect = 4)").context("_activeCompany", user.getActiveCompany());
if (employee == null || !employee.getHrManager()) {
actionView.domain(actionView.get().getDomain() + " AND self.timesheet.user.employee.managerUser = :_user").context("_user", user);
}
response.setView(actionView.map());
}
use of com.axelor.auth.db.User in project axelor-open-suite by axelor.
the class TimesheetReportController method fillTimesheetReportReminderUsers.
public void fillTimesheetReportReminderUsers(ActionRequest request, ActionResponse response) {
TimesheetReport timesheetReport = request.getContext().asType(TimesheetReport.class);
Set<User> reminderUserSet = Beans.get(TimesheetReportService.class).getUserToBeReminded(timesheetReport);
if (!ObjectUtils.isEmpty(reminderUserSet)) {
response.setValue("reminderUserSet", reminderUserSet);
} else {
response.setValue("reminderUserSet", null);
response.setNotify(I18n.get(ITranslation.TS_REPORT_FILL_NO_USER));
}
}
use of com.axelor.auth.db.User in project axelor-open-suite by axelor.
the class ExtraHoursController method validateExtraHours.
public void validateExtraHours(ActionRequest request, ActionResponse response) throws AxelorException {
User user = AuthUtils.getUser();
Employee employee = user.getEmployee();
ActionViewBuilder actionView = ActionView.define(I18n.get("Extra hours to Validate")).model(ExtraHours.class.getName()).add("grid", "extra-hours-validate-grid").add("form", "extra-hours-form").param("search-filters", "extra-hours-filters");
Beans.get(HRMenuValidateService.class).createValidateDomain(user, employee, actionView);
response.setView(actionView.map());
}
Aggregations