- Модуль: imbot
- Путь к файлу: ~/bitrix/modules/imbot/lib/bot/support24.php
- Класс: BitrixImBotBotSupport24
- Вызов: Support24::onAfterSupportCodeChange
static function onAfterSupportCodeChange($previousFreeCode = '', $previousPaidCode = '')
{
if (!MainLoader::includeModule('im'))
{
return false;
}
if (!MainLoader::includeModule('bitrix24'))
{
return false;
}
if (!self::getBotId())
{
return false;
}
if (self::getSupportLevel() == self::SUPPORT_LEVEL_PAID)
{
if (!$previousPaidCode)
{
return false;
}
$previousSupportLevel = self::SUPPORT_LEVEL_FREE;
$previousCode = $previousPaidCode;
$currentCode = Option::get('imbot', self::OPTION_BOT_PAID_CODE, "");
}
else
{
if (!$previousFreeCode)
{
return false;
}
$previousSupportLevel = self::SUPPORT_LEVEL_PAID;
$previousCode = $previousFreeCode;
$currentCode = Option::get('imbot', self::OPTION_BOT_FREE_CODE, "");
}
(new DialogSession)->clearSessions(['BOT_ID' => self::getBotId()]);
self::updateBotProperties();
self::onSupportLevelChange([
'IS_SUPPORT_CODE_CHANGE' => true,
'PREVIOUS_BOT_CODE' => $previousCode,
'CURRENT_BOT_CODE' => $currentCode,
'PREVIOUS_SUPPORT_LEVEL' => $previousSupportLevel,
]);
/*
self::sendNotifyAboutChangeLevel([
'BUSINESS_USERS' => self::getBusinessUsers(),
'IS_SUPPORT_CODE_CHANGE' => true,
]);
$currentLicence = CBitrix24::getLicenseType(CBitrix24::LICENSE_TYPE_CURRENT);
$http = self::instanceHttpClient();
$http->query(
'clientChangeLicence',
[
'BOT_ID' => self::getBotId(),
'PREVIOUS_LICENCE_TYPE' => $currentLicence,
'PREVIOUS_LICENCE_NAME' => CBitrix24::getLicenseName($currentLicence),
'CURRENT_LICENCE_TYPE' => $currentLicence,
'CURRENT_LICENCE_NAME' => CBitrix24::getLicenseName($currentLicence),
'PREVIOUS_BOT_CODE' => $previousCode,
'CURRENT_BOT_CODE' => $currentCode,
'MESSAGE' => self::getMessage('SUPPORT_INFO_CHANGE_CODE', $previousSupportLevel),
],
false
);
*/
return true;
}