Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
bot.php
1<?php
3
4class Bot
5{
6 public static function removeDepartmentLinkAgent()
7 {
8 if (!\Bitrix\Main\ModuleManager::isModuleInstalled('intranet'))
9 {
10 return "";
11 }
12
13 $result = \Bitrix\Main\UserTable::getList([
14 'select' => ['ID'],
15 'filter' => [
16 '=EXTERNAL_AUTH_ID' => \Bitrix\Im\Bot::EXTERNAL_AUTH_ID,
17 '!UF_DEPARTMENT' => false
18 ]
19 ]);
20
21 $user = new \CUser;
22 while($row = $result->fetch())
23 {
24 $user->Update($row['ID'], ['UF_DEPARTMENT' => []]);
25 }
26
27 $departmentId = \Bitrix\Im\Bot\Department::getId(true);
28 if ($departmentId && \CModule::IncludeModule('iblock'))
29 {
30 \CIBlockSection::Delete($departmentId);
31 }
32
33 return "";
34 }
35}
static removeDepartmentLinkAgent()
Definition bot.php:6
static isModuleInstalled($moduleName)