• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/service/schedule/scheduleservice.php
  • Класс: BitrixTimemanServiceScheduleScheduleService
  • Вызов: ScheduleService::saveCalendar
private function saveCalendar(ScheduleForm $scheduleForm, Schedule $schedule = null)
{
	if (!$scheduleForm->calendarForm->calendarId)
	{
		return $this->calendarService->add($scheduleForm->calendarForm);
	}

	if ($scheduleForm->calendarForm->calendarId != $schedule->getCalendarId())
	{
		return (new ScheduleServiceResult())->addError(new Error('Calendar Id should match the Calendar Id saved in schedule'));
	}

	$calendarRes = $this->calendarService->update($schedule->getCalendar(), $scheduleForm->calendarForm);
	if (WorktimeServiceResult::isSuccessResult($calendarRes))
	{
		$schedule->setCalendar($calendarRes->getCalendar());
	}
	return $calendarRes;
}