diff --git a/CHANGELOG.md b/CHANGELOG.md index ff22aa3d..6953fb20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2023-10-24 v.6.4.9 +- Исправлена ошибка при деактивации модуля + ## 2023-10-17 v.6.4.8 - Добавлена передача адреса пункта самовывоза в заказе из Bitrix в CRM diff --git a/intaro.retailcrm/classes/general/RCrmActions.php b/intaro.retailcrm/classes/general/RCrmActions.php index 44ca24c7..f96fc76e 100644 --- a/intaro.retailcrm/classes/general/RCrmActions.php +++ b/intaro.retailcrm/classes/general/RCrmActions.php @@ -452,7 +452,7 @@ class RCrmActions return $result; } - public static function sendConfiguration($api, $api_version, $active = true) + public static function sendConfiguration($api, $active = true) { $scheme = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; $baseUrl = $scheme . $_SERVER['HTTP_HOST']; @@ -464,12 +464,13 @@ class RCrmActions if (!$clientId) { $clientId = uniqid(); + COption::SetOptionString(self::$MODULE_ID, 'client_id', $clientId); } $code = $integrationCode . '-' . $clientId; - $configuration = array( + $configuration = [ 'clientId' => $clientId, 'code' => $code, 'integrationCode' => $integrationCode, @@ -478,7 +479,7 @@ class RCrmActions 'logo' => $logo, 'baseUrl' => $baseUrl, 'accountUrl' => $accountUrl - ); + ]; self::apiMethod($api, 'integrationModulesEdit', __METHOD__, $configuration); } diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index b526db0b..f9710ef4 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1 +1 @@ -- Добавлена передача адреса пункта самовывоза в заказе из Bitrix в CRM +- Исправлена ошибка при деактивации модуля diff --git a/intaro.retailcrm/install/index.php b/intaro.retailcrm/install/index.php index c2d6bf47..a728841d 100644 --- a/intaro.retailcrm/install/index.php +++ b/intaro.retailcrm/install/index.php @@ -42,7 +42,6 @@ class intaro_retailcrm extends CModule public $MODULE_VERSION_DATE; public $MODULE_NAME; public $MODULE_DESCRIPTION; - public $MODULE_GROUP_RIGHTS = 'N'; public $PARTNER_NAME; public $PARTNER_URI; public $RETAIL_CRM_API; @@ -1116,7 +1115,7 @@ class intaro_retailcrm extends CModule 'RCrmActions::orderAgent();', $this->MODULE_ID, 'N', - 600, // interval - 10 mins + 600, // interval - 10 min $dateAgent->format('d.m.Y H:i:s'), // date of first check 'Y', // agent is active $dateAgent->format('d.m.Y H:i:s'), // date of first start @@ -1202,10 +1201,9 @@ class intaro_retailcrm extends CModule $api_host = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, 0); $api_key = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, 0); - $api_version = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_VERSION, 0); $this->RETAIL_CRM_API = new ApiClient($api_host, $api_key); - RCrmActions::sendConfiguration($this->RETAIL_CRM_API, $api_version); + RCrmActions::sendConfiguration($this->RETAIL_CRM_API); $APPLICATION->IncludeAdminFile( GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step6.php' @@ -1219,7 +1217,6 @@ class intaro_retailcrm extends CModule $api_host = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, 0); $api_key = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, 0); - $api_version = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_VERSION, 0); require_once($this->INSTALL_PATH . '/../classes/general/Http/Client.php'); require_once($this->INSTALL_PATH . '/../classes/general/Response/ApiResponse.php'); @@ -1232,8 +1229,8 @@ class intaro_retailcrm extends CModule require_once($this->INSTALL_PATH . '/../classes/general/history/RetailCrmHistory_v5.php'); require_once($this->INSTALL_PATH . '/../lib/component/constants.php'); require_once($this->INSTALL_PATH . '/../classes/general/cart/RetailCrmCart_v5.php'); - - $retail_crm_api = new ApiClient($api_host, $api_key); + + RCrmActions::sendConfiguration(new ApiClient($api_host, $api_key), false); CAgent::RemoveAgent('RCrmActions::orderAgent();', $this->MODULE_ID); CAgent::RemoveAgent('RetailCrmInventories::inventoriesUpload();', $this->MODULE_ID); @@ -1315,8 +1312,6 @@ class intaro_retailcrm extends CModule } } - RCrmActions::sendConfiguration($retail_crm_api, $api_version, false); - $this->deleteFiles(); $this->deleteLPEvents(); diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index 4a7de548..b6508821 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ '6.4.8', - 'VERSION_DATE' => '2023-10-17 18:00:00' + 'VERSION' => '6.4.9', + 'VERSION_DATE' => '2023-10-24 13:00:00' ]; diff --git a/intaro.retailcrm/options.php b/intaro.retailcrm/options.php index 51413dd2..ffbd7f52 100644 --- a/intaro.retailcrm/options.php +++ b/intaro.retailcrm/options.php @@ -683,6 +683,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) { if ($deactivateEvents !== []) { COption::SetOptionString($mid, $EVENTS_DEACTIVATE, serialize($deactivateEvents)); } + + RCrmActions::sendConfiguration($api, false); } else { $deactivateAgents = unserialize(COption::GetOptionString($mid, $AGENTS_DEACTIVATE, '')); $deactivateEvents = unserialize(COption::GetOptionString($mid, $EVENTS_DEACTIVATE, '')); @@ -733,6 +735,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) { COption::SetOptionString($mid, $EVENTS_DEACTIVATE, serialize([])); } + + RCrmActions::sendConfiguration($api); } COption::SetOptionString(