Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
messagedeal.php
1<?php
10
11use Bitrix\Crm\Category\DealCategory;
17
23{
25
30 public function getName()
31 {
32 return Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_NAME_DEAL');
33 }
34
35 protected function setConfigurationOptions()
36 {
37 global $USER;
38 if ($this->configuration->hasOptions())
39 {
40 return;
41 }
42
43 $this->configuration->setArrayOptions([
44 [
45 'type' => 'string',
46 'code' => 'TITLE',
47 'name' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_TITLE_DEAL'),
48 'required' => true,
49 'value' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_TITLE_DEAL_DEF', ['%date%' => PrettyDate::formatDate()]),
50 'hint' => [
51 'menu' => array_map(
52 function ($item)
53 {
54 return array(
55 'id' => '#' . ($item['CODE'] ?? '') . '#',
56 'text' => $item['NAME'] ?? '',
57 'title' => $item['DESC'] ?? '',
58 'items' => isset($item['ITEMS']) ? array_map(
59 function ($item)
60 {
61 return array(
62 'id' => '#' . ($item['CODE'] ?? '') . '#',
63 'text' => $item['NAME'] ?? '',
64 'title' => $item['DESC'] ?? ''
65 );
66 }, $item['ITEMS']
67 ) : []
68 );
69 },
70 array_merge(
71 Helper::getPersonalizeFieldsFromConnectors(),
73 )
74 ),
75 ],
76 ],
77 [
79 'code' => 'ASSIGNED_BY',
80 'name' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_ASSIGNED_BY'),
81 'required' => true,
82 'hint' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_ASSIGNED_BY_HINT'),
83 'value' => $USER ? $USER->getId() : '',
84 ],
85 [
86 'type' => Message\ConfigurationOption::TYPE_CHECKBOX,
87 'code' => 'CHECK_WORK_TIME',
88 'name' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_CHECK_WORK_TIME'),
89 'hint' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_CHECK_WORK_TIME_HINT'),
90 'required' => false,
91 ],
92 [
93 'type' => Message\ConfigurationOption::TYPE_CHECKBOX,
94 'code' => 'ALWAYS_ADD',
95 'name' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_ALWAYS_ADD_DEAL'),
96 'required' => false,
97 'hint' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_ALWAYS_ADD_HINT'),
98 ],
99 [
100 'type' => Message\ConfigurationOption::TYPE_CHECKBOX,
101 'code' => 'LINK_WITH_RESPONSIBLE',
102 'name' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_LINK_DEAL_WITH_RESPONSIBLE'),
103 'required' => false,
104 ],
105 [
106 'type' => Message\ConfigurationOption::TYPE_CHECKBOX,
107 'code' => 'FROM_PREVIOUS',
108 'name' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_CREATE_FROM_PREVIOUS'),
109 'required' => false,
110 'hint' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_CREATE_FROM_PREVIOUS_HINT'),
111 ],
112 [
113 'type' => Message\ConfigurationOption::TYPE_NUMBER,
114 'code' => 'DEAL_DAYS_AGO',
115 'name' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_DEAL_DAYS_AGO'),
116 'required' => false,
117 'value' => 1,
118 'min_value' => 0,
119 'max_value' => 366,
120 'hint' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_DEAL_DAYS_AGO_HINT'),
121 ],
122 [
123 'type' => 'text',
124 'code' => 'COMMENT',
125 'name' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_COMMENT'),
126 'required' => false,
127 'placeholder' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_COMMENT_HINT'),
128 ],
129 [
130 'type' => 'list',
131 'code' => 'CATEGORY_ID',
132 'name' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_DEAL_CATEGORY_ID'),
133 'required' => false,
134 'show_in_filter' => true,
135 'items' => array_merge(
136 array_map(
137 function ($category)
138 {
139 return [
140 'code' => $category['ID'],
141 'value' => $category['NAME'],
142 ];
143 },
144 DealCategory::getAll(true)
145 ),
146 [[
147 'code' => '',
148 'value' => Loc::getMessage('SENDER_INTEGRATION_CRM_RC_MESSAGE_CONFIG_DEAL_CATEGORY_ID_LAST')
149 ]]
150 )
151 ],
152 ]);
153 }
154}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29