• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/services/company/manager.php
  • Класс: BitrixSaleServicesCompanyManager
  • Вызов: Manager::getUserCompanyList
static function getUserCompanyList($id)
{
	static $list = array();

	if (empty($list[$id]))
	{
		$list[$id] = array();

		$groups = CUser::GetUserGroup($id);

		$filterCompany = array(
			'select' => array(
				'ID',
			),
			'filter' => array(
				'=GROUP.GROUP_ID' => $groups
			),
			'runtime' => array(
				new MainEntityReferenceField(
					'GROUP',
					'BitrixSaleInternalsCompanyGroupTable',
					array(
						'=this.ID' => 'ref.COMPANY_ID',
					)
				)
			),
			'order'  => array('ID'),
		);

		$resCompany = InternalsCompanyTable::getList($filterCompany);
		while($companyData = $resCompany->fetch())
		{
			$list[$id][] = $companyData['ID'];
		}
	}

	return $list[$id];
}