Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Добавляем два пропущенных стандартных поля пользователя #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/Queries/UserQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class UserQuery extends OldCoreQuery
'PASSWORD',
'CHECKWORD',
'LID',
'WORK_LOGO',
'PERSONAL_STREET',
];

/**
Expand All @@ -96,24 +98,24 @@ protected function loadModels()
$sort = $this->sort;
$filter = $this->normalizeFilter();
$params = [
'SELECT' => $this->propsMustBeSelected() ? ['UF_*'] : ($this->normalizeUfSelect() ?: false),
'SELECT' => $this->propsMustBeSelected() ? ['UF_*'] : ($this->normalizeUfSelect() ?: false),
'NAV_PARAMS' => $this->navigation,
'FIELDS' => $this->normalizeSelect(),
'FIELDS' => $this->normalizeSelect(),
];
$selectGroups = $this->groupsMustBeSelected();
$keyBy = $this->keyBy;

$callback = function() use ($sort, $filter, $params, $selectGroups){
$callback = function () use ($sort, $filter, $params, $selectGroups) {
$users = [];
$rsUsers = $this->bxObject->getList($sort, $sortOrder = false, $filter, $params);
while ($arUser = $this->performFetchUsingSelectedMethod($rsUsers)) {
if ($selectGroups) {
$arUser['GROUP_ID'] = $this->bxObject->getUserGroup($arUser['ID']);
}

$this->addItemToResultsUsingKeyBy($users, new $this->modelName($arUser['ID'], $arUser));
}

return new Collection($users);
};

Expand Down Expand Up @@ -161,8 +163,8 @@ public function count()

$queryType = 'UserQuery::count';
$filter = $this->normalizeFilter();
$callback = function() use ($filter) {
return (int) $this->bxObject->getList($order = 'ID', $by = 'ASC', $filter, [
$callback = function () use ($filter) {
return (int)$this->bxObject->getList($order = 'ID', $by = 'ASC', $filter, [
'NAV_PARAMS' => [
'nTopCount' => 0,
],
Expand Down Expand Up @@ -222,7 +224,7 @@ protected function normalizeUfSelect()
{
return preg_grep('/^(UF_+)/', $this->select);
}

protected function prepareMultiFilter(&$key, &$value)
{
$value = join(' | ', $value);
Expand Down