• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/service/schedule/shiftservice.php
  • Класс: BitrixTimemanServiceScheduleShiftService
  • Вызов: ShiftService::update
public function update($shiftOrId, ShiftForm $shiftForm)
{
	$shift = $shiftOrId;
	if (!($shift instanceof Shift))
	{
		$shift = $this->shiftRepository->findByIdWithSchedule((int)$shiftOrId);
	}
	if (!$shift)
	{
		return (new ShiftServiceResult())->addShiftNotFoundError();
	}

	$shift->edit(
		$shiftForm->name,
		$shiftForm->startTime,
		$shiftForm->endTime,
		$shiftForm->breakDuration,
		$shiftForm->workDays
	);
	$res = $this->shiftRepository->save($shift);
	if ($res->isSuccess())
	{
		return (new ShiftServiceResult())->setShift($shift);
	}
	return ShiftServiceResult::createByResult($res);
}