Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
bitrix24event.php
1<?php
9
13
15{
16 public static function OnManualModuleAddDelete(Event $event)
17 {
18 $result = new EventResult(
19 EventResult::UNDEFINED,
20 array(),
21 'socialnetwork'
22 );
23
24 $modulesList = $event->getParameter('modulesList');
25
26 if (
27 !is_array($modulesList)
28 || empty($modulesList)
29 )
30 {
31 return $result;
32 }
33
34 $connection = \Bitrix\Main\HttpApplication::getConnection();
35
36 foreach($modulesList as $moduleId => $status)
37 {
38 if (!in_array($status, ['Y', 'N']))
39 {
40 continue;
41 }
42
43 $inactive = (
44 $status == 'N'
45 ? 'Y'
46 : 'N'
47 );
48
49 switch($moduleId)
50 {
51 case "crm":
52 $sql = "UPDATE b_sonet_log SET INACTIVE='".$inactive."' WHERE MODULE_ID in ('crm', 'crm_shared')";
53 break;
54 case "timeman":
55 $sql = "UPDATE b_sonet_log SET INACTIVE='".$inactive."' WHERE EVENT_ID in ('timeman_entry', 'report')";
56 break;
57 case "lists":
58 $sql = "UPDATE b_sonet_log SET INACTIVE='".$inactive."' WHERE EVENT_ID = 'lists_new_element'";
59 break;
60 default:
61 $sql = '';
62 }
63 if (!empty($sql))
64 {
65 $connection->query($sql);
66 }
67 }
68
69 $result = new EventResult(
70 EventResult::SUCCESS,
71 array(),
72 'socialnetwork'
73 );
74
75 return $result;
76 }
77}
78?>
getParameter($key)
Definition event.php:80