1
0
mirror of synced 2024-11-21 12:56:11 +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
- Добавлена передача адреса пункта самовывоза в заказе из Bitrix в CRM

View File

@ -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);
}

View File

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

View File

@ -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();

View File

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

View File

@ -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(