• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/service/worktime/violation/fixedscheduleviolationbuilder.php
  • Класс: BitrixTimemanServiceWorktimeViolationFixedScheduleViolationBuilder
  • Вызов: FixedScheduleViolationBuilder::buildRelativeStopViolations
private function buildRelativeStopViolations($recordedStopSeconds)
{
	$violations = [];
	$violationsConfig = $this->getViolationRules();
	$stopFrom = $violationsConfig->getRelativeEndFrom();
	if (ViolationRules::isViolationConfigured($stopFrom))
	{
		if ($recordedStopSeconds < $stopFrom)
		{
			$violations[] = $this->createViolation(
				WorktimeViolation::TYPE_EARLY_ENDING,
				$this->getRecord()->getRecordedStopTimestamp(),
				$recordedStopSeconds - $stopFrom
			);
		}
	}

	$stopTo = $violationsConfig->getRelativeEndTo();
	if (ViolationRules::isViolationConfigured($stopTo))
	{
		if ($recordedStopSeconds > $stopTo)
		{
			$violations[] = $this->createViolation(
				WorktimeViolation::TYPE_LATE_ENDING,
				$this->getRecord()->getRecordedStopTimestamp(),
				$recordedStopSeconds - $stopTo
			);
		}
	}
	return $violations;
}