-
Notifications
You must be signed in to change notification settings - Fork 2
/
createSG.php
54 lines (45 loc) · 1.4 KB
/
createSG.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
class test extends \WS\ReduceMigrations\Scenario\ScriptScenario {
public static $arFields = [
'NAME' => 'group',
'DESCRIPTION' => 'group',
'VISIBLE' => 'N',
'OPENED' => 'N',
'CLOSED' => 'N',
'SUBJECT_ID' => '2',
'KEYWORDS' => ',',
'INITIATE_PERMS' => 'K',
'SPAM_PERMS' => 'K',
'PROJECT' => 'N',
'LANDING' => 'N',
'IMAGE_ID' => [
'del' => 'Y',
'old_file' => null,
],
'SITE_ID' => [ 0 => 's1']
];
public function commit() {
if( \Bitrix\Main\Loader::includeModule('bizproc') &&
\Bitrix\Main\Loader::includeModule('socialnetwork') &&
\Bitrix\Main\Loader::includeModule('main')
){
$dbUser = \Bitrix\Main\UserTable::getList([
'filter'=>[
'=EMAIL'=>'test@test.com'
],
'select'=>['ID']
]);
if($resUser = $dbUser->fetch()){
$ownerId = $resUser['ID'];
$arFields = self::$arFields;
$resGroup = \CSocNetGroup::GetList([], ['NAME'=>$arFields['NAME']])->Fetch();
if($resGroup === false){
\CSocNetGroup::CreateGroup($ownerId, $arFields, false);
}
}
}
}
public function rollback() {
// my code
}
}