11 static::convertBizprocProviders();
12 static::convertOptions();
20 $providerList = Bizproc\RestProviderTable::getList();
22 while ($row = $providerList->fetch())
24 static::addRestSender(array(
25 'APP_ID' => $row[
'APP_ID'],
26 'APP_NAME' => $row[
'APP_NAME'],
27 'CODE' => $row[
'CODE'],
28 'TYPE' => $row[
'TYPE'],
29 'HANDLER' => $row[
'HANDLER'],
30 'NAME' => $row[
'NAME'],
31 'DESCRIPTION' => $row[
'DESCRIPTION']
39 $checkList = array(
'smsru',
'twilio');
41 foreach ($checkList as $senderId)
43 $optionString = Main\Config\Option::get(
'crm',
'integration.sms.'.$senderId);
47 $options = unserialize($optionString, [
'allowed_classes' =>
false]);
48 if (!is_array($options))
51 if (isset($options[
'default_sender']))
53 $options[
'default_from'] = $options[
'default_sender'];
54 unset($options[
'default_sender']);
57 Main\Config\Option::set(
'messageservice',
'sender.sms.'.$senderId, serialize($options));
61 private static function addRestSender($params)
63 $iterator = Internal\Entity\RestAppTable::getList(array(
64 'select' => array(
'ID'),
66 '=APP_ID' => $params[
'APP_ID'],
67 '=CODE' => $params[
'CODE']
70 $result = $iterator->fetch();
77 'NAME' => $params[
'NAME'],
78 'DESCRIPTION' => $params[
'DESCRIPTION'],
79 'APP_NAME' => $params[
'APP_NAME']
81 unset($params[
'NAME'], $params[
'DESCRIPTION'], $params[
'APP_NAME']);
83 $params[
'AUTHOR_ID'] = 0;
84 $result = Internal\Entity\RestAppTable::add($params);
86 if ($result->getErrors())
91 $senderLang[
'APP_ID'] = $result->getId();
92 static::addRestSenderLang($senderLang);
97 private static function addRestSenderLang($langFields)
101 foreach ($langFields[
'NAME'] as $langId => $langName)
103 $langCode = mb_strtolower($langId);
104 if ($langCode ===
'*')
107 $langData[$langCode] = array(
108 'APP_ID' => $langFields[
'APP_ID'],
109 'LANGUAGE_ID' => $langCode,
110 'NAME' => $langFields[
'NAME'][$langId],
111 'DESCRIPTION' => isset($langFields[
'DESCRIPTION'][$langId])
112 ? (
string)$langFields[
'DESCRIPTION'][$langId] : null,
113 'APP_NAME' => isset($langFields[
'APP_NAME'][$langId])
114 ? (string)$langFields[
'APP_NAME'][$langId] : null,
117 if (!isset($langData[
'**']))
119 $langData[
'**'] = $langData[$langCode];
120 $langData[
'**'][
'LANGUAGE_ID'] =
'**';
124 foreach ($langData as $toAdd)
126 Internal\Entity\RestAppLangTable::add($toAdd);
static includeModule($moduleName)