1
0
mirror of synced 2024-11-22 05:16:09 +03:00

ref #91901 Исправлена ошибка при деактивации модуля (#319)

This commit is contained in:
Uryvskiy Dima 2023-10-24 12:53:02 +03:00 committed by GitHub
parent a0005e1ff8
commit 693031012d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 15 deletions

View File

@ -1,3 +1,6 @@
## 2023-10-24 v.6.4.9
- Исправлена ошибка при деактивации модуля
## 2023-10-17 v.6.4.8 ## 2023-10-17 v.6.4.8
- Добавлена передача адреса пункта самовывоза в заказе из Bitrix в CRM - Добавлена передача адреса пункта самовывоза в заказе из Bitrix в CRM

View File

@ -452,7 +452,7 @@ class RCrmActions
return $result; return $result;
} }
public static function sendConfiguration($api, $api_version, $active = true) public static function sendConfiguration($api, $active = true)
{ {
$scheme = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; $scheme = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
$baseUrl = $scheme . $_SERVER['HTTP_HOST']; $baseUrl = $scheme . $_SERVER['HTTP_HOST'];
@ -464,12 +464,13 @@ class RCrmActions
if (!$clientId) { if (!$clientId) {
$clientId = uniqid(); $clientId = uniqid();
COption::SetOptionString(self::$MODULE_ID, 'client_id', $clientId); COption::SetOptionString(self::$MODULE_ID, 'client_id', $clientId);
} }
$code = $integrationCode . '-' . $clientId; $code = $integrationCode . '-' . $clientId;
$configuration = array( $configuration = [
'clientId' => $clientId, 'clientId' => $clientId,
'code' => $code, 'code' => $code,
'integrationCode' => $integrationCode, 'integrationCode' => $integrationCode,
@ -478,7 +479,7 @@ class RCrmActions
'logo' => $logo, 'logo' => $logo,
'baseUrl' => $baseUrl, 'baseUrl' => $baseUrl,
'accountUrl' => $accountUrl 'accountUrl' => $accountUrl
); ];
self::apiMethod($api, 'integrationModulesEdit', __METHOD__, $configuration); self::apiMethod($api, 'integrationModulesEdit', __METHOD__, $configuration);
} }

View File

@ -1 +1 @@
- Добавлена передача адреса пункта самовывоза в заказе из Bitrix в CRM - Исправлена ошибка при деактивации модуля

View File

@ -42,7 +42,6 @@ class intaro_retailcrm extends CModule
public $MODULE_VERSION_DATE; public $MODULE_VERSION_DATE;
public $MODULE_NAME; public $MODULE_NAME;
public $MODULE_DESCRIPTION; public $MODULE_DESCRIPTION;
public $MODULE_GROUP_RIGHTS = 'N';
public $PARTNER_NAME; public $PARTNER_NAME;
public $PARTNER_URI; public $PARTNER_URI;
public $RETAIL_CRM_API; public $RETAIL_CRM_API;
@ -1116,7 +1115,7 @@ class intaro_retailcrm extends CModule
'RCrmActions::orderAgent();', 'RCrmActions::orderAgent();',
$this->MODULE_ID, $this->MODULE_ID,
'N', 'N',
600, // interval - 10 mins 600, // interval - 10 min
$dateAgent->format('d.m.Y H:i:s'), // date of first check $dateAgent->format('d.m.Y H:i:s'), // date of first check
'Y', // agent is active 'Y', // agent is active
$dateAgent->format('d.m.Y H:i:s'), // date of first start $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_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_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); $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( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step6.php' 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_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_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/Http/Client.php');
require_once($this->INSTALL_PATH . '/../classes/general/Response/ApiResponse.php'); require_once($this->INSTALL_PATH . '/../classes/general/Response/ApiResponse.php');
@ -1233,7 +1230,7 @@ class intaro_retailcrm extends CModule
require_once($this->INSTALL_PATH . '/../lib/component/constants.php'); require_once($this->INSTALL_PATH . '/../lib/component/constants.php');
require_once($this->INSTALL_PATH . '/../classes/general/cart/RetailCrmCart_v5.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('RCrmActions::orderAgent();', $this->MODULE_ID);
CAgent::RemoveAgent('RetailCrmInventories::inventoriesUpload();', $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->deleteFiles();
$this->deleteLPEvents(); $this->deleteLPEvents();

View File

@ -1,6 +1,6 @@
<?php <?php
$arModuleVersion = [ $arModuleVersion = [
'VERSION' => '6.4.8', 'VERSION' => '6.4.9',
'VERSION_DATE' => '2023-10-17 18:00:00' 'VERSION_DATE' => '2023-10-24 13:00:00'
]; ];

View File

@ -683,6 +683,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
if ($deactivateEvents !== []) { if ($deactivateEvents !== []) {
COption::SetOptionString($mid, $EVENTS_DEACTIVATE, serialize($deactivateEvents)); COption::SetOptionString($mid, $EVENTS_DEACTIVATE, serialize($deactivateEvents));
} }
RCrmActions::sendConfiguration($api, false);
} else { } else {
$deactivateAgents = unserialize(COption::GetOptionString($mid, $AGENTS_DEACTIVATE, '')); $deactivateAgents = unserialize(COption::GetOptionString($mid, $AGENTS_DEACTIVATE, ''));
$deactivateEvents = unserialize(COption::GetOptionString($mid, $EVENTS_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([])); COption::SetOptionString($mid, $EVENTS_DEACTIVATE, serialize([]));
} }
RCrmActions::sendConfiguration($api);
} }
COption::SetOptionString( COption::SetOptionString(