• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/service/worktime/worktimeservice.php
  • Класс: BitrixTimemanServiceWorktimeWorktimeService
  • Вызов: WorktimeService::startWorktime
public function startWorktime($recordForm)
{
	$this->recordForm = clone $recordForm;
	if ($this->recordForm->getFirstEventName() === null)
	{
		$this->recordForm->getFirstEventForm()->eventName = WorktimeEventTable::EVENT_TYPE_START;
		if ($this->recordForm->recordedStartSeconds !== null ||
			$this->recordForm->recordedStartTimestamp !== null ||
			$this->recordForm->recordedStartTime !== null
		)
		{
			$this->recordForm->getFirstEventForm()->eventName = WorktimeEventTable::EVENT_TYPE_START_WITH_ANOTHER_TIME;
		}
	}
	return $this->processWorktimeAction($this->recordForm,
		function () {
			$recordStartDate = null;
			if ($this->recordForm->userId > 0 &&
				$this->recordForm->getFirstEventName() === WorktimeEventTable::EVENT_TYPE_START_WITH_ANOTHER_TIME)
			{
				$recordStartDate = $this->recordForm->buildStartTimestampBySecondsAndDate($this->recordForm->userId);
				if ($recordStartDate > 0)
				{
					$recordStartDate = TimeHelper::getInstance()->createUserDateTimeFromFormat('U', $recordStartDate, $this->recordForm->userId);
				}
			}
			return $this->checkActionEligibility(
				$this->buildActionList($this->recordForm->userId, $recordStartDate)->getStartActions()
			);
		}
	);
}