FillLightCounterPart2::findMinLightTime

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. FillLightCounterPart2
  4. findMinLightTime
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/agent/activity/lightcounter/filllightcounterpart2.php
  • Класс: Bitrix\Crm\Agent\Activity\LightCounter\FillLightCounterPart2
  • Вызов: FillLightCounterPart2::findMinLightTime
private function findMinLightTime(int $entityTypeId, int $entityId): DateTime
{
	$row = ActCounterLightTimeTable::query()
		->registerRuntimeField('', new ExpressionField('MIN_LIGHT_COUNTER_AT', 'MIN(%s)', 'LIGHT_COUNTER_AT'))
		->addSelect('MIN_LIGHT_COUNTER_AT')
		->registerRuntimeField(
			'',
			new ReferenceField('B',
				ActivityBindingTable::getEntity(),
				['=ref.ACTIVITY_ID' => 'this.ACTIVITY_ID'],
			)
		)
		->where('B.OWNER_ID', '=', $entityId)
		->where('B.OWNER_TYPE_ID', '=', $entityTypeId)
		->fetch();

	return $row['MIN_LIGHT_COUNTER_AT'] ?? CCrmDateTimeHelper::getMaxDatabaseDateObject();
}

Добавить комментарий