...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/counter/activitycounter.php
- Класс: Bitrix\Crm\Counter\ActivityCounter
- Вызов: ActivityCounter::prepareActivityTableJoin
protected function prepareActivityTableJoin(int $entityTypeID): array { $sqlHelper = Main\Application::getConnection()->getSqlHelper(); $join = [ '=ref.ID' => 'this.ACTIVITY_ID', '=ref.COMPLETED' => new SqlExpression('?', 'N'), '=this.OWNER_TYPE_ID' => new SqlExpression($entityTypeID) ]; if ($this->userID > 0) { $join['=ref.RESPONSIBLE_ID'] = new SqlExpression('?i', $this->userID); } if ($this->typeID === EntityCounterType::PENDING) { $lowBound = new DateTime(); $lowBound->setTime(0, 0, 0); $join['>=ref.DEADLINE'] = new SqlExpression( $sqlHelper->convertToDb($lowBound, new DatetimeField('D')) ); $highBound = new DateTime(); $this->convertToUserTime($highBound); $highBound->setTime(23, 59, 59); $this->convertFromUserTime($highBound); $join['<=ref.DEADLINE'] = new SqlExpression( $sqlHelper->convertToDb($highBound, new DatetimeField('D')) ); } elseif ($this->typeID === EntityCounterType::OVERDUE) { $highBound = new DateTime(); $this->convertToUserTime($highBound); $highBound->setTime(0, 0, 0); $this->convertFromUserTime($highBound); $join['convertToDb($highBound, new DatetimeField('D')) ); } else//if($this->typeID === EntityCounterType::CURRENT) { $highBound = new DateTime(); $this->convertToUserTime($highBound); $highBound->setTime(23, 59, 59); $this->convertFromUserTime($highBound); $join['<=ref.DEADLINE'] = new SqlExpression( $sqlHelper->convertToDb($highBound, new DatetimeField('D')) ); } return $join; }