• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/repository/schedule/shiftplanrepository.php
  • Класс: BitrixTimemanRepositoryScheduleShiftPlanRepository
  • Вызов: ShiftPlanRepository::findAllByUserDates
public function findAllByUserDates($userId, Date $dateFrom, Date $dateTo, $shiftIdExcept = null): ShiftPlanCollection
{
	$collectionQuery = $this->getActivePlansQuery()
		->addSelect('*')
		->addSelect('SHIFT')
		->addSelect('SCHEDULE.ID')
		->addSelect('SCHEDULE.NAME')
		->addSelect('SCHEDULE.SCHEDULE_TYPE')
		->registerRuntimeField(new Reference('SHIFT', ShiftTable::class, ['this.SHIFT_ID' => 'ref.ID']))
		->registerRuntimeField(new Reference('SCHEDULE', ScheduleTable::class, ['this.SHIFT.SCHEDULE_ID' => 'ref.ID']))
		->where('USER_ID', $userId)
		->whereBetween('DATE_ASSIGNED', $dateFrom, $dateTo);
	if ($shiftIdExcept !== null)
	{
		$collectionQuery->where('SHIFT_ID', '!=', $shiftIdExcept);
	}
	/*-*/// active shifts and schedules?
	return $collectionQuery->exec()->fetchCollection();
}