27 Loader::includeModule(self::$moduleId)
28 && Loader::includeModule(
'tasks')
29 && Option::get(
'socialnetwork',
'needWorkgroupTaskPinMigration',
'Y') ===
'Y'
38 $params = Option::get(
'socialnetwork',
'workgrouptaskspinmigration');
39 $params = ($params !==
'' ? @unserialize($params, [
'allowed_classes' =>
false ]) : []);
40 $params = (is_array($params) ? $params : []);
47 'count' => $this->getCount(),
51 if ($params[
'count'] > 0)
53 $result[
'title'] =
Loc::getMessage(
'FUPD_WORKGROUP_TASKS_PIN_MIGRATION_TITLE');
54 $result[
'progress'] = 1;
55 $result[
'steps'] =
'';
56 $result[
'count'] = $params[
'count'];
58 $res = (new \Bitrix\Main\Entity\Query(ProjectUserOptionTable::getEntity()))
59 ->registerRuntimeField(
62 WorkgroupTable::getEntity(),
63 [
'=this.PROJECT_ID' =>
'ref.ID' ],
64 [
'join_type' =>
'INNER' ]
67 ->addFilter(
'>ID', $params[
'lastId'])
68 ->addFilter(
'=OPTION_CODE', UserOptionTypeDictionary::OPTION_PINNED)
70 ->addSelect(
'PROJECT_ID')
71 ->addSelect(
'USER_ID')
72 ->addSelect(
'PROJECT.SCRUM_MASTER_ID')
78 while ($userOptionItem = $res->fetchObject())
80 $groupId = $userOptionItem->get(
'PROJECT_ID');
81 $userId = $userOptionItem->get(
'USER_ID');
82 $projectItem = $userOptionItem->get(
'PROJECT');
84 (int)$projectItem->get(
'SCRUM_MASTER_ID') > 0
90 $params[
'lastId'] = $userOptionItem->getId();
92 if (WorkgroupPinTable::getList([
94 '=GROUP_ID' => $groupId,
95 '=USER_ID' => $userId,
96 '=CONTEXT' => $context,
103 WorkgroupPinTable::add([
104 'GROUP_ID' => $groupId,
105 'USER_ID' => $userId,
106 'CONTEXT' => $context,
114 Option::set(
'socialnetwork',
'workgrouptaskspinmigration', serialize($params));
118 $result[
'progress'] = (int)($params[
'number'] * 100 / $params[
'count']);
119 $result[
'steps'] = $params[
'number'];
121 if ($found ===
false)
123 Option::delete(
'socialnetwork', [
'name' =>
'workgrouptaskspinmigration' ]);
124 Option::set(
'socialnetwork',
'needWorkgroupTaskPinMigration',
'N');