28 static::$sourceFilterOptionName !==
''
29 && static::$targetFilterOptionName !==
''
30 && static::$stepperNeedOptionName !==
''
31 && static::$stepperDataOptionName !==
''
32 && Loader::includeModule(static::$moduleId)
33 && Loader::includeModule(
'tasks')
34 && Option::get(
'socialnetwork', static::$stepperNeedOptionName,
'Y') ===
'Y'
43 $params = Option::get(
'socialnetwork', static::$stepperDataOptionName);
45 $params = ($params !==
'' ? @unserialize($params, [
'allowed_classes' =>
false ]) : []);
47 $params = (is_array($params) ? $params : []);
58 if ($params[
'count'] > 0)
60 $result[
'title'] =
Loc::getMessage(
'FUPD_WORKGROUP_TASKS_FILTER_MIGRATION_TITLE');
61 $result[
'progress'] = 1;
62 $result[
'steps'] =
'';
63 $result[
'count'] = $params[
'count'];
66 SELECT ID, USER_ID, COMMON, VALUE
69 ID > " . (int)$params[
'lastId'] .
"
70 AND CATEGORY = '" . $DB->ForSql(static::$filterOptionCategory) .
"'
71 AND NAME = '" . $DB->ForSql(static::$sourceFilterOptionName) .
"'
74 $res = $DB->Query($strSql);
77 while ($userOptionFields = $res->fetch())
79 $userId = (int)$userOptionFields[
'USER_ID'];
80 $common = ($userOptionFields[
'COMMON'] ===
'Y');
81 $value = $userOptionFields[
'VALUE'];
84 $params[
'lastId'] = $userOptionFields[
'ID'];
86 $data = @unserialize($value, [
'allowed_classes' =>
false ]);
92 $data = $this->
migrate($data, $userId);
94 \CUserOptions::SetOption(
95 static::$filterOptionCategory,
96 static::$targetFilterOptionName,
107 Option::set(
'socialnetwork', static::$stepperDataOptionName, serialize($params));
111 $result[
'progress'] = (int)($params[
'number'] * 100 / $params[
'count']);
112 $result[
'steps'] = $params[
'number'];
114 if ($found ===
false)
116 Option::delete(
'socialnetwork', [
'name' => static::$stepperDataOptionName ]);
117 Option::set(
'socialnetwork', static::$stepperNeedOptionName,
'N');
171 protected function migratePresets(array $presetsData = [],
int $userId = 0): array
173 static $isExtranetInstalled =
null;
175 if ($isExtranetInstalled ===
null)
177 $isExtranetInstalled = Loader::includeModule(
'extranet');
180 $newPresetsData = [];
181 $modelPresetData = [];
185 $extranetSiteId =
'';
189 && !\CExtranet::isIntranetUser(SITE_ID, $userId)
192 $extranetSiteId = \CExtranet::getExtranetSiteID();
195 $modelPresetData = \Bitrix\Socialnetwork\Integration\Main\UIFilter\Workgroup::getFilterPresetList([
196 'currentUserId' => $userId,
197 'extranetSiteId' => $extranetSiteId,
201 foreach ($presetsData as $presetCode => $preset)
204 $newPresetsData[$newPresetCode] = $this->
migratePreset($preset);
207 return $this->
mergeData($modelPresetData, $newPresetsData);
379 static $typesList =
null;
381 if ($typesList ===
null)
383 $typesList = Helper\Workgroup::getTypes();
386 if (isset($typesList[$projectType]))
388 if (isset($typesList[$projectType][
'VISIBLE']))
390 $newData[
'VISIBLE'] = $typesList[$projectType][
'VISIBLE'];
392 if (isset($typesList[$projectType][
'OPENED']))
394 $newData[
'OPENED'] = $typesList[$projectType][
'OPENED'];
396 if (isset($typesList[$projectType][
'PROJECT']))
398 $newData[
'PROJECT'] = $typesList[$projectType][
'PROJECT'];
400 if (isset($typesList[$projectType][
'EXTERNAL']))
402 $newData[
'EXTRANET'] = $typesList[$projectType][
'EXTERNAL'];
404 if (isset($typesList[$projectType][
'LANDING']))
406 $newData[
'LANDING'] = $typesList[$projectType][
'LANDING'];