コード例 #1
0
 /** 트랜잭션 처리가 필요한 로직이 지정된 시간내에 완료되지 못하면 rollback을 한다. */
 @Test(expected = EmptyResultDataAccessException.class)
 public void shouldRollbackWhenTimedOut() {
   ExecuteFunction<Employee, Integer> func =
       new ExecuteFunction<Employee, Integer>() {
         public Integer apply(Employee emp) {
           Integer result = empService.addNewEmployee(emp);
           try {
             Thread.sleep(1000);
           } catch (Exception e) {
           }
           return result;
         }
       };
   empService.deleteById("committedOutOfTime");
   Employee emp = new Employee();
   emp.setId("committedOutOfTime");
   emp.setName("committedOutOfTime");
   try {
     timeoutSvc.executeInTransaction(func, emp, 100);
     Assert.fail("ExecuteTimeoutException should be thrown");
   } catch (ExecuteTimeoutException e) {
     // because insert execution has been rollbacked
     // the following method should throw EmptyResultDataAccessException
     empService.findById("committedOutOfTime");
   }
 }
コード例 #2
0
ファイル: VacationService.java プロジェクト: itru/timesheet
  public List<Vacation> getVacationList(VacationsForm vacationsForm) {
    Integer divisionId = vacationsForm.getDivisionId();
    Integer employeeId = vacationsForm.getEmployeeId();
    Date dateFrom = DateTimeUtil.parseStringToDateForDB(vacationsForm.getCalFromDate());
    Date dateTo = DateTimeUtil.parseStringToDateForDB(vacationsForm.getCalToDate());
    Integer projectId = vacationsForm.getProjectId();
    Integer managerId = vacationsForm.getManagerId();
    List<Integer> regions = vacationsForm.getRegions();
    DictionaryItem vacationType =
        vacationsForm.getVacationType() != 0
            ? dictionaryItemService.find(vacationsForm.getVacationType())
            : null;

    List<Vacation> vacations = new ArrayList<Vacation>();
    if (employeeId != null && employeeId != ALL_VALUE) {
      vacations.addAll(findVacations(employeeId, dateFrom, dateTo, vacationType));
    } else {
      List<Employee> employees =
          employeeService.getEmployees(
              employeeService.createDivisionList(divisionId),
              employeeService.createManagerList(managerId),
              employeeService.createRegionsList(regions),
              employeeService.createProjectList(projectId),
              dateFrom,
              dateTo,
              true);
      vacations.addAll(findVacations(employees, dateFrom, dateTo, vacationType));
    }
    sortVacations(vacations);
    return vacations;
  }
コード例 #3
0
  private void generateEmployees() {

    Employee employee = new Employee();
    employee.setFirstName("Bipin");
    employee.setLastName("Butala");
    employee.setBackground("Java Developer");
    employeeService.saveEmployee(employee);

    Employee employee1 = new Employee();
    employee1.setFirstName("Tony");
    employee1.setLastName("Morano");
    employee1.setBackground("Java Developer as well");
    employeeService.saveEmployee(employee1);

    Employee employee2 = new Employee();
    employee2.setFirstName("Dan");
    employee2.setLastName("Simmer");
    employee2.setBackground("DotNet Developer");
    employeeService.saveEmployee(employee2);

    Employee employee3 = new Employee();
    employee3.setFirstName("Sean");
    employee3.setLastName("Nilsen");
    employee3.setBackground("Contact Center Engineer");
    employeeService.saveEmployee(employee3);
  }
コード例 #4
0
  @Transactional
  public String deleteVacationApprovalByIdAndCheckIsApproved(Integer approvalId) {
    final JsonArrayNodeBuilder builder = anArrayBuilder();
    VacationApproval vacationApproval = find(approvalId);
    final Employee employee = securityService.getSecurityPrincipal().getEmployee();
    final boolean isAdmin = employeeService.isEmployeeAdmin(employee.getId());
    String message = null;
    if (isAdmin) {
      if (vacationApproval != null) {
        deleteVacationApproval(vacationApproval);
      } else {
        message = "Ошибка при удалении, данные отсутствуют";
      }
    } else {
      message = "Ошибка доступа";
    }

    Vacation vacation = vacationApproval.getVacation();
    if (vacation == null) {
      message = "Ошибка при удалении, данные отсутствуют";
    }

    try {
      vacationApprovalProcessService.checkVacationIsApproved(vacation);
    } catch (VacationApprovalServiceException e) {
      message = e.getLocalizedMessage();
    }

    builder.withElement(
        anObjectBuilder()
            .withField("status", aNumberBuilder(message == null ? "0" : "-1"))
            .withField("message", aStringBuilder(message == null ? "" : message)));

    return JsonUtil.format(builder);
  }
コード例 #5
0
  private boolean updateLeader(Division dbDiv, DivisionLdap ldapDiv) {
    String dbObjectSid;
    String ldapObjectSid;
    boolean forceUpdate;
    if (dbDiv.getLeader() != null) {
      dbObjectSid = dbDiv.getLeader().getObjectSid();
      forceUpdate = false;
    } else {
      logger.error("For employee [{}] no objectSid", dbDiv.getLeader());
      forceUpdate = true;
      dbObjectSid = "";
    }

    if (ldapDiv.getLeaderSid() != null) {
      ldapObjectSid = ldapDiv.getLeaderSid();
    } else {
      logger.error("No leader's objectSid for division [{}]", ldapDiv.getLdap_name());
      return false;
    }

    if (forceUpdate || !(dbObjectSid.equals(ldapObjectSid))) {
      Employee employee = employeeService.findByObjectSid(ldapObjectSid);
      dbDiv.setLeader(employee);
      return true;
    }
    return false;
  }
コード例 #6
0
ファイル: VacationService.java プロジェクト: itru/timesheet
  private Integer getVacationDaysCountForPeriod(
      String beginDateString, Integer employeeId, Integer vacationTypeId) {
    Employee employee = employeeService.find(employeeId);
    final Timestamp beginDate =
        DateTimeUtil.stringToTimestamp(beginDateString, CreateVacationForm.DATE_FORMAT);
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(employee.getStartDate());
    Integer beginDay = calendar.get(Calendar.DAY_OF_MONTH);

    calendar.setTime(beginDate);
    Integer vacDay = calendar.get(Calendar.DAY_OF_MONTH);
    Integer month = calendar.get(Calendar.MONTH);
    Integer year = calendar.get(Calendar.YEAR);
    //  Если день начала отпуска меньше даты устройства на работу
    //  то оставляем месяц без изменений т.к. calendar.get(Calendar.MONTH) дает -1 один месяц
    if (vacDay > beginDay) {
      ++month;
    }
    Integer count = null;
    if (vacationTypeId.equals(VacationTypesEnum.WITH_PAY.getId())) {
      count = getFactVacationDaysCount(employee, year, month);
    } else {
      count = getPlanVacationDaysCount(employee, year, month);
    }
    return count;
  }
コード例 #7
0
 private Set<Employee> getEmpoyees(List<String> employeesObjetSid) {
   Set<Employee> result = new HashSet<Employee>();
   for (String objectSid : employeesObjetSid) {
     Employee hold = employeeService.findByObjectSid(objectSid);
     result.add(hold);
   }
   return result;
 }
コード例 #8
0
 public ActionForward update(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   EmployeeService service = new EmployeeService();
   DynaActionForm employeeForm = (DynaActionForm) form;
   EmployeeDTO employeeDTO = new EmployeeDTO();
   BeanUtils.copyProperties(employeeDTO, employeeForm);
   service.updateEmployee(employeeDTO);
   ActionMessages messages = new ActionMessages();
   ActionMessage message = new ActionMessage("message.employee.update.success");
   messages.add(ActionMessages.GLOBAL_MESSAGE, message);
   saveMessages(request, messages);
   return (mapping.findForward("updateSuccess"));
 }
コード例 #9
0
ファイル: EmployeeEditor.java プロジェクト: musictang/algem
 void delete() {
   try {
     service.delete(view.get());
     old = null;
     view.clear();
   } catch (EmployeeException ex) {
     GemLogger.logException(ex);
   }
 }
コード例 #10
0
ファイル: EmployeeEditor.java プロジェクト: musictang/algem
  void update() {
    Employee e = view.get();

    try {
      if (old == null) {
        if (!e.isEmpty()) {
          service.create(e);
          old = e;
        }
      } else if (!old.equals(e)) {
        service.update(e);
        old = e;
      }
    } catch (EmployeeException ex) {
      MessagePopup.warning(
          this, MessageUtil.getMessage("employee.update.warning") + ":\n" + ex.getMessage());
      GemLogger.logException(ex);
    }
  }
コード例 #11
0
  @RequestMapping(value = "/create", method = RequestMethod.GET)
  public String showCreateForm(Model model) {
    TicketsInvoice ticketsInvoice = new TicketsInvoice();
    List<Employee> employees =
        employeeService.findAll(Employee.EmployeePosition.MAIN_CASIER.getId());

    model.addAttribute("ticketsInvoice", ticketsInvoice);
    model.addAttribute("employees", employees);

    return "ticketsInvoice/edit";
  }
コード例 #12
0
  /** 지정된 시간 내에 처리가 완료되면 트랜잭션은 commit이 되야 한다. */
  @Test
  public void shouldCommitWhenExecutedInTime() {
    ExecuteFunction<Employee, Integer> func =
        new ExecuteFunction<Employee, Integer>() {
          public Integer apply(Employee emp) {
            return empService.addNewEmployee(emp);
          }
        };
    empService.deleteById("committedInTime");
    Employee emp = new Employee();
    emp.setId("committedInTime");
    emp.setName("committedInTime");
    ExecuteResult<Integer> result =
        timeoutSvc.<Employee, Integer>executeInTransaction(func, emp, 1000);

    assertThat(result.getReturnObject()).isEqualTo(1);
    Employee actual = empService.findById("committedInTime");
    assertThat(actual).isNotNull();
    assertThat(actual.getId()).isEqualTo("committedInTime");
  }
コード例 #13
0
  @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  public String findOne(@PathVariable("id") int id, Model model) {
    TicketsInvoice ticketsInvoice = ticketsInvoiceService.find(id);
    if (ticketsInvoice == null) throw new ResourceNotFoundException();

    List<Employee> employees =
        employeeService.findAll(Employee.EmployeePosition.MAIN_CASIER.getId());

    model.addAttribute("employees", employees);
    model.addAttribute("ticketsInvoice", ticketsInvoice);
    return "ticketsInvoice/edit";
  }
コード例 #14
0
 public HashMap<String, String> deleteGroup(Long id) {
   Employee employee = employeeService.selectCurrentAuthModel();
   Long groupId = employee.getGroup().getId();
   HashMap<String, String> res = new HashMap<>();
   if (!groupId.equals(id)) {
     groupRepository.delete(id);
     res.put("status", "ok");
   } else {
     res.put("status", "error");
   }
   return res;
 }
コード例 #15
0
  @RequestMapping(value = "/{id}/control-letters/create", method = RequestMethod.GET)
  public String showControlLetterCreateForm(@PathVariable("id") int id, Model model) {
    ControlLetter controlLetter = new ControlLetter();
    // TODO: Validate income id that coming from form
    controlLetter.setIncomeId(id);

    List<Employee> employees = employeeService.findAll(Employee.EmployeePosition.CASIER.getId());

    model.addAttribute("controlLetter", controlLetter);
    model.addAttribute("employees", employees);

    return "controlLetter/edit";
  }
コード例 #16
0
  @Before
  public void setUp() {
    try {
      sessionFactory = HibernateUtility.getSessionFactory();
      dao = new HibernateEmployeeDao();
      dao.setSessionFactory(sessionFactory);

      service = new EmployeeService();
      service.setDao(dao);
    } finally {
      sessionFactory.getCurrentSession().beginTransaction();
    }
  }
コード例 #17
0
ファイル: EmployeeEditor.java プロジェクト: musictang/algem
 void setEmployee(int idper) {
   Employee e = null;
   try {
     e = service.find(idper);
     old = e;
   } catch (EmployeeException ex) {
     GemLogger.logException(ex);
   }
   if (e == null) {
     e = new Employee(idper);
   }
   view.set(e);
 }
コード例 #18
0
  @RequestMapping(value = "/{invoiceId}/control-letters/{id}")
  public String showControlLetter(
      @PathVariable("invoiceId") int invoiceId, @PathVariable("id") int id, Model model) {

    ControlLetter controlLetter = controlLetterService.find(id);
    if (controlLetter == null) throw new ResourceNotFoundException();
    controlLetter.setIncomeId(invoiceId);

    List<Employee> employees = employeeService.findAll(Employee.EmployeePosition.CASIER.getId());

    model.addAttribute("employees", employees);
    model.addAttribute("controlLetter", controlLetter);
    return "controlLetter/edit";
  }
コード例 #19
0
ファイル: VacationService.java プロジェクト: itru/timesheet
 /* функция возвращает можно ли удалить планируемый отпуск в таблице заявлений на отпуск */
 public Boolean isVacationDeletePermission(Vacation vacation, Employee employee) {
   if (employee != null && vacation != null) {
     /* проверим Админ ли текущий пользователь */
     if (employeeService.isEmployeeAdmin(employee.getId())) {
       return Boolean.TRUE;
     } else {
       /* для запланированных отпусков проверяем что это либо создатель отпуска либо сам отпускник
        * либо является лин. рук. отпускника */
       if (vacation.getType().getId() == VacationTypesEnum.PLANNED.getId()
           && (vacation.getEmployee().equals(employee)
               || vacation.getAuthor().equals(employee)
               || employeeService.getLinearEmployees(vacation.getEmployee()).contains(employee))) {
         return Boolean.TRUE;
       }
       /* пользователь создатель или отпускник и статус не отклонено и не утверждено */
       if ((vacation.getEmployee().equals(employee) || vacation.getAuthor().equals(employee))
           && vacation.getStatus().getId() != VacationStatusEnum.REJECTED.getId()
           && vacation.getStatus().getId() != VacationStatusEnum.APPROVED.getId()) {
         return Boolean.TRUE;
       }
     }
   }
   return Boolean.FALSE;
 }
コード例 #20
0
ファイル: VacationService.java プロジェクト: itru/timesheet
  public String checkVacationCountDaysJSON(
      String beginDateString, String endDateString, Integer employeeId, Integer vacationTypeId) {
    Employee employee = employeeService.find(employeeId);

    final Timestamp beginDate =
        DateTimeUtil.stringToTimestamp(beginDateString, CreateVacationForm.DATE_FORMAT);
    final Timestamp endDate =
        DateTimeUtil.stringToTimestamp(endDateString, CreateVacationForm.DATE_FORMAT);

    Integer factCount =
        getVacationDaysCountForPeriod(
            beginDateString, employeeId, VacationTypesEnum.WITH_PAY.getId());
    Integer planCount =
        getVacationDaysCountForPeriod(
            beginDateString, employeeId, VacationTypesEnum.PLANNED.getId());

    // Получаем кол-во дней в отпуске за исключением неучитываемых праздников
    Integer vacationDayCountExCons =
        calendarService.getCountDaysForPeriodForRegionExConsiderHolidays(
            beginDate, endDate, employee.getRegion());

    boolean factError =
        factCount - vacationDayCountExCons < 0
            && vacationTypeId.equals(VacationTypesEnum.WITH_PAY.getId());
    boolean planError = planCount - vacationDayCountExCons < 0;

    JsonObjectNodeBuilder builder =
        anObjectBuilder()
            .withField(
                "error",
                factError
                    ? JsonUtil.aNumberBuilder(-1)
                    : planError ? JsonUtil.aNumberBuilder(1) : JsonUtil.aNumberBuilder(0))
            .withField(
                "message",
                aStringBuilder(
                    factError
                        ? String.format(
                            "Внимание! Вы не можете запланировать отпуск на количество дней, больше %s дней",
                            factCount.toString())
                        : planError
                            ? "Внимание! Создаваемый отпуск превышает допустимое количество дней. Продолжить?"
                            : ""));

    return JsonUtil.format(builder);
  }
コード例 #21
0
  @Test
  public void test3PaycheckCreation() {
    Calendar start = Calendar.getInstance();
    start.add(Calendar.DAY_OF_YEAR, -21);

    Calendar end = Calendar.getInstance();
    end.add(Calendar.DAY_OF_YEAR, -7);

    PayCheck check = service.createPaycheck("12341234", start.getTime(), end.getTime(), 40);

    flushSession();

    assertTrue(check.getId() > 0);
    assertEquals(1, check.getAssociatedEmployee().getPayChecks().size());
    assertNotNull(check.getCreatedOn());
    assertEquals("Anonymous", check.getCreatedBy());
  }
コード例 #22
0
  @RequestMapping(value = "/", method = RequestMethod.POST)
  public String createOrUpdate(
      @ModelAttribute("ticketsInvoice") @Validated TicketsInvoice ticketsInvoice,
      BindingResult bindingResult,
      Model model,
      RedirectAttributes redirectAttributes) {
    ticketsInvoiceValidator.validate(ticketsInvoice, bindingResult);
    if (bindingResult.hasErrors()) {
      List<Employee> employees =
          employeeService.findAll(Employee.EmployeePosition.MAIN_CASIER.getId());
      model.addAttribute("employees", employees);

      return "ticketsInvoice/edit";
    }

    return handleSaving(ticketsInvoice, ticketsInvoiceService, redirectAttributes, null);
  }
コード例 #23
0
ファイル: PlanEditService.java プロジェクト: janmak/timesheet
  private void processJsonDataItems(
      List<EmployeePlan> employeePlans,
      List<EmployeeProjectPlan> employeeProjectPlans,
      JsonRootNode rootNode,
      Integer year,
      Integer month) {
    Integer employeeId;

    for (JsonNode jsonNode : rootNode.getArrayNode(JSON_DATA_ITEMS)) {
      employeeId = JsonUtil.getDecNumberValue(jsonNode, EMPLOYEE_ID);

      final Employee employee = employeeService.find(employeeId);

      addEmployeePlans(employeePlans, year, month, employee, jsonNode);

      addEmployeeProjectPlans(employeeProjectPlans, year, month, employee, jsonNode);
    }
  }
コード例 #24
0
  @RequestMapping(
      value = "/{invoiceId}/control-letters/{id}/rows/create",
      method = RequestMethod.GET)
  public String showControlLetterRowCreateForm(
      @PathVariable("invoiceId") int invoiceId, @PathVariable("id") int id, Model model) {
    ControlLetterRow controlLetterRow = new ControlLetterRow();
    // TODO: Validate id that coming from form
    controlLetterRow.setControlLetterId(id);

    List<Employee> employees = employeeService.findAll(Employee.EmployeePosition.CONDUCTOR.getId());
    List<Route> routes = routeService.findAll();

    model.addAttribute("controlLetterRow", controlLetterRow);
    model.addAttribute("routes", routes);
    model.addAttribute("employees", employees);
    model.addAttribute("invoiceId", invoiceId);

    return "controlLetterRow/edit";
  }
コード例 #25
0
  @Test
  public void test2SalaryEmployeeCreation() {

    SalaryPayRate spr = new SalaryPayRate();
    spr.setJobRole("Programmer");
    spr.setYearlyRate(50000.00);

    Employee employee =
        service.createNewEmployee("David", "Dobel", "11111111", spr, createDefaultAddress());

    flushSession();

    assertTrue(employee.getId() > 0);
    assertTrue(employee.getPay() instanceof SalaryPayRate);
    assertNotNull(employee.getCreatedOn());
    assertEquals("Anonymous", employee.getCreatedBy());
    assertNotNull(employee.getUpdatedBy());
    assertNotNull(employee.getUpdatedOn());
  }
コード例 #26
0
  @Test
  public void test1HourlyEmployeeCreation() {
    HourlyPayRate hpr = new HourlyPayRate();
    hpr.setJobRole("Programmer");
    hpr.setHourlyPayRate(50.00);
    hpr.setOvertimeRate(75.00);

    Employee employee =
        service.createNewEmployee("Sid", "Waterman", "12341234", hpr, createDefaultAddress());

    flushSession();

    assertTrue(employee.getId() > 0);
    assertTrue(employee.getPay() instanceof HourlyPayRate);
    assertNotNull(employee.getCreatedOn());
    assertEquals("Anonymous", employee.getCreatedBy());
    assertNotNull(employee.getUpdatedBy());
    assertNotNull(employee.getUpdatedOn());
  }
コード例 #27
0
 private StringBuffer add(List<DivisionLdap> forAppend) {
   StringBuffer sb = new StringBuffer();
   for (DivisionLdap ldapDiv : forAppend) {
     Division division = new Division();
     division.setName(ldapDiv.getLdap_name());
     division.setLdapName(ldapDiv.getLdap_name());
     division.setLdap_objectSid(ldapDiv.getLdapObjectSid());
     Employee leader = employeeService.findByObjectSid(ldapDiv.getLeaderSid());
     if (leader == null) {
       logger.debug("div name {}", ldapDiv.getLdap_name());
       logger.debug("not found leader sid {}", ldapDiv.getLeaderSid());
     }
     division.setLeader(leader);
     Set<Employee> employees = getEmpoyees(ldapDiv.getMembers());
     division.setEmployees(employees);
     division.setActive(true);
     sb.append(divisionDAO.setDivision(division));
   }
   return sb;
 }
コード例 #28
0
  @RequestMapping(value = "/timesheet", method = RequestMethod.GET)
  public ModelAndView showMainForm(
      @RequestParam(value = "date", required = false) String date,
      @RequestParam(value = "id", required = false) Integer id) {
    logger.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>");
    logger.info("Showing Time Sheet main page!");
    ModelAndView mav = new ModelAndView();
    mav.setViewName("timesheet");

    TimeSheetForm tsForm = new TimeSheetForm();

    TimeSheetUser securityUser = securityService.getSecurityPrincipal();

    if (id != null) {
      tsForm.setDivisionId(employeeService.find(id).getDivision().getId());
      tsForm.setEmployeeId(id);
    } else if (securityUser != null) {
      tsForm.setDivisionId(securityUser.getEmployee().getDivision().getId());
      tsForm.setEmployeeId(securityUser.getEmployee().getId());
    }

    if (date != null) {
      tsForm.setCalDate(date);
      mav.addObject(
          "selectedCalDateJson", getSelectedCalDateJson(tsForm)); // выставляем дату для DateTextBox
    } else {
      mav.addObject("selectedCalDateJson", "''");
    }
    mav.addObject("timeSheetForm", tsForm); // command object
    mav.addObject("selectedProjectRolesJson", "[{row:'0', role:''}]");
    mav.addObject("selectedProjectTasksJson", "[{row:'0', task:''}]");
    mav.addObject("selectedProjectsJson", "[{row:'0', project:''}]");
    mav.addObject("selectedWorkplaceJson", "[{row:'0', workplace:''}]");
    mav.addObject("selectedActCategoriesJson", "[{row:'0', actCat:''}]");
    mav.addObject("selectedLongVacationIllnessJson", getSelectedLongVacationIllnessJson(tsForm));
    mav.addObject("getDateByDefault", getDateByDefault(tsForm.getEmployeeId()));
    mav.addObject("getFirstWorkDate", getEmployeeFirstWorkDay(tsForm.getEmployeeId()));

    mav.addAllObjects(getListsToMAV());
    return mav;
  }
コード例 #29
0
  @RequestMapping(value = "/{invoiceId}/control-letters/{controlLetterId}/rows/{id}")
  public String showControlLetterRow(
      @PathVariable("invoiceId") int invoiceId,
      @PathVariable("controlLetterId") int controlLetterId,
      @PathVariable("id") int id,
      Model model) {

    ControlLetterRow controlLetterRow = controlLetterRowService.find(id);
    if (controlLetterRow == null) throw new ResourceNotFoundException();
    controlLetterRow.setControlLetterId(controlLetterId);

    List<Employee> employees = employeeService.findAll(Employee.EmployeePosition.CONDUCTOR.getId());
    List<Route> routes = routeService.findAll();

    model.addAttribute("routes", routes);
    model.addAttribute("employees", employees);
    model.addAttribute("controlLetterRow", controlLetterRow);
    model.addAttribute("invoiceId", invoiceId);

    return "controlLetterRow/edit";
  }
コード例 #30
0
  @RequestMapping(value = "/{id}/control-letters", method = RequestMethod.POST)
  public String createOrUpdateControlLetter(
      @PathVariable("id") int invoiceId,
      @ModelAttribute("controlLetter") @Validated ControlLetter controlLetter,
      BindingResult bindingResult,
      Model model,
      RedirectAttributes redirectAttributes) {

    if (!bindingResult.hasErrors()) controlLetterValidator.validate(controlLetter, bindingResult);

    if (bindingResult.hasErrors()) {
      List<Employee> employees = employeeService.findAll(Employee.EmployeePosition.CASIER.getId());
      model.addAttribute("employees", employees);

      return "controlLetter/edit";
    }

    return handleSaving(
        controlLetter,
        controlLetterService,
        redirectAttributes,
        "tickets-invoices/" + invoiceId + "/control-letters");
  }