1
0
mirror of synced 2024-11-23 22:06:11 +03:00

ref #93680 Рефакторинг настроек и установки модуля, добавление переводов в настройках модуля (#351)

This commit is contained in:
Kocmonavtik 2024-06-21 11:37:07 +03:00 committed by GitHub
parent 0550d8ffba
commit 1ab3dacaf7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 252 additions and 336 deletions

View File

@ -1,3 +1,6 @@
## 2024-06-20 v.6.5.20
- Рефакторинг настроек модуля
## 2024-06-14 v.6.5.19
- Исправление работы программы лояльности при использовании подтверждения списание бонусов по SMS

View File

@ -1 +1 @@
- Исправление работы программы лояльности при использовании Подтверждения списание бонусов по SMS
- Рефакторинг настроек модуля

View File

@ -47,48 +47,7 @@ class intaro_retailcrm extends CModule
public $PARTNER_URI;
public $RETAIL_CRM_API;
public $RETAIL_CRM_EXPORT = 'retailcrm';
public $CRM_API_HOST_OPTION = 'api_host';
public $CRM_API_KEY_OPTION = 'api_key';
public $CRM_SITES_LIST = 'sites_list';
public $CRM_ORDER_TYPES_ARR = 'order_types_arr';
public $CRM_DELIVERY_TYPES_ARR = 'deliv_types_arr';
public $CRM_DELIVERY_SERVICES_ARR = 'deliv_services_arr';
public $CRM_INTEGRATION_DELIVERY = 'integration_delivery';
public $CRM_PAYMENT_TYPES = 'pay_types_arr';
public $CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
public $CRM_PAYMENT = 'payment_arr';
public $CRM_INTEGRATION_PAYMENT = 'integration_payment';
public $CRM_ORDER_LAST_ID = 'order_last_id';
public $CRM_ORDER_PROPS = 'order_props';
public $CRM_LEGAL_DETAILS = 'legal_details';
public $CRM_CONTRAGENT_TYPE = 'contragent_type';
public $CRM_ORDER_DISCHARGE = 'order_discharge';
public $CRM_ORDER_FAILED_IDS = 'order_failed_ids';
public $CRM_ORDER_HISTORY = 'order_history';
public $CRM_CUSTOMER_HISTORY = 'customer_history';
public $CRM_CATALOG_BASE_PRICE = 'catalog_base_price';
public $CRM_ORDER_NUMBERS = 'order_numbers';
public $CRM_CANSEL_ORDER = 'cansel_order';
public $CRM_CURRENCY = 'currency';
public $CRM_ADDRESS_OPTIONS = 'address_options';
public $CRM_INVENTORIES_UPLOAD = 'inventories_upload';
public $CRM_STORES = 'stores';
public $CRM_SHOPS = 'shops';
public $CRM_IBLOCKS_INVENTORIES = 'iblocks_inventories';
public $CRM_PRICES_UPLOAD = 'prices_upload';
public $CRM_PRICES = 'prices';
public $CRM_PRICE_SHOPS = 'price_shops';
public $CRM_IBLOCKS_PRICES = 'iblock_prices';
public $CRM_COLLECTOR = 'collector';
public $CRM_COLL_KEY = 'coll_key';
public $CRM_UA = 'ua';
public $CRM_UA_KEYS = 'ua_keys';
public $CRM_API_VERSION = 'api_version';
public $HISTORY_TIME = 'history_time';
public $CLIENT_ID = 'client_id';
public $PROTOCOL = 'protocol';
public $INSTALL_PATH;
public $SITES_AVAILABLE = 'sites_available';
public function __construct()
{
@ -195,7 +154,8 @@ class intaro_retailcrm extends CModule
include($this->INSTALL_PATH . '/../classes/general/RestNormalizer.php');
include($this->INSTALL_PATH . '/../classes/general/Logger.php');
include($this->INSTALL_PATH . '/../classes/general/services/RetailCrmService.php');
$version = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_VERSION, 0);
include($this->INSTALL_PATH . '/../lib/component/constants.php');
$version = COption::GetOptionString($this->MODULE_ID, Constants::CRM_API_VERSION, 0);
include($this->INSTALL_PATH . '/../classes/general/ApiClient_v5.php');
include($this->INSTALL_PATH . '/../classes/general/order/RetailCrmOrder_v5.php');
include($this->INSTALL_PATH . '/../classes/general/history/RetailCrmHistory_v5.php');
@ -238,7 +198,6 @@ class intaro_retailcrm extends CModule
include($this->INSTALL_PATH . '/../lib/repository/tomodulerepository.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/orm/tomodule.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/agreement.php');
include($this->INSTALL_PATH . '/../lib/component/constants.php');
include($this->INSTALL_PATH . '/../lib/repository/agreementrepository.php');
include($this->INSTALL_PATH . '/../lib/service/orderloyaltydataservice.php');
include($this->INSTALL_PATH . '/../lib/service/currencyservice.php');
@ -275,10 +234,10 @@ class intaro_retailcrm extends CModule
$arResult['errCode'] = 'ERR_CATALOG';
}
if ($api_host = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_API_HOST_OPTION, 0)) {
if ($api_host = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_API_HOST_OPTION , 0)) {
$arResult['API_HOST'] = $api_host;
}
if ($api_key = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_API_KEY_OPTION, 0)) {
if ($api_key = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_API_KEY_OPTION, 0)) {
$arResult['API_KEY'] = $api_key;
}
@ -307,8 +266,8 @@ class intaro_retailcrm extends CModule
return false;
}
$api_host = htmlspecialchars(trim($_POST[$this->CRM_API_HOST_OPTION]));
$api_key = htmlspecialchars(trim($_POST[$this->CRM_API_KEY_OPTION]));
$api_host = htmlspecialchars(trim($_POST[Constants::CRM_API_HOST_OPTION]));
$api_key = htmlspecialchars(trim($_POST[Constants::CRM_API_KEY_OPTION]));
// form correct url
$api_host = parse_url($api_host);
@ -341,10 +300,10 @@ class intaro_retailcrm extends CModule
return false;
}
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, $api_host);
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, $api_key);
COption::SetOptionString($this->MODULE_ID, Constants::CRM_API_HOST_OPTION, $api_host);
COption::SetOptionString($this->MODULE_ID, Constants::CRM_API_KEY_OPTION, $api_key);
if ($sites_list = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_SITES_LIST, 0)) {
if ($sites_list = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_SITES_LIST, 0)) {
$arResult['SITES_LIST'] = unserialize($sites_list);
}
@ -373,8 +332,8 @@ class intaro_retailcrm extends CModule
$arResult['arSites'] = RCrmActions::getSitesList();
if (count($arResult['arSites']) > 1) {
$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_host = COption::GetOptionString($this->MODULE_ID, Constants::CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($this->MODULE_ID, Constants::CRM_API_KEY_OPTION, 0);
$isEmptySites = true;
foreach ($arResult['arSites'] as $site) {
@ -422,10 +381,10 @@ class intaro_retailcrm extends CModule
}
$this->RETAIL_CRM_API = new ApiClient($api_host, $api_key);
COption::SetOptionString($this->MODULE_ID, $this->CRM_SITES_LIST, serialize($siteCode));
COption::SetOptionString($this->MODULE_ID, Constants::CRM_SITES_LIST, serialize($siteCode));
} else {
$api_host = htmlspecialchars(trim($_POST[$this->CRM_API_HOST_OPTION]));
$api_key = htmlspecialchars(trim($_POST[$this->CRM_API_KEY_OPTION]));
$api_host = htmlspecialchars(trim($_POST[Constants::CRM_API_HOST_OPTION]));
$api_key = htmlspecialchars(trim($_POST[Constants::CRM_API_KEY_OPTION]));
// form correct url
$api_host = parse_url($api_host);
@ -457,16 +416,16 @@ class intaro_retailcrm extends CModule
}
$this->RETAIL_CRM_API = new ApiClient($api_host, $api_key);
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, $api_host);
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, $api_key);
COption::SetOptionString($this->MODULE_ID, $this->CRM_SITES_LIST, serialize([]));
COption::SetOptionString($this->MODULE_ID, Constants::CRM_API_HOST_OPTION, $api_host);
COption::SetOptionString($this->MODULE_ID, Constants::CRM_API_KEY_OPTION, $api_key);
COption::SetOptionString($this->MODULE_ID, Constants::CRM_SITES_LIST, serialize([]));
try {
$credentials = $this->RETAIL_CRM_API->getCredentials();
COption::SetOptionString(
$this->MODULE_ID,
$this->SITES_AVAILABLE,
Constants::SITES_AVAILABLE,
$credentials->sitesAvailable[0] ?? ''
);
} catch (ArgumentOutOfRangeException | CurlException $exception) {
@ -552,19 +511,19 @@ class intaro_retailcrm extends CModule
//bitrix statusesList --statuses
$arResult['bitrixStatusesList'] = RCrmActions::StatusesList();
if ($order_types = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_ORDER_TYPES_ARR, 0)) {
if ($order_types = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_ORDER_TYPES_ARR, 0)) {
$arResult['ORDER_TYPES'] = array_flip(unserialize($order_types));
}
if ($delivery_types = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, 0)) {
if ($delivery_types = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_DELIVERY_TYPES_ARR, 0)) {
$arResult['DELIVERY_TYPES'] = array_flip(unserialize($delivery_types));
}
if ($payment_types = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_PAYMENT_TYPES, 0)) {
if ($payment_types = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_PAYMENT_TYPES, 0)) {
$arResult['PAYMENT_TYPES'] = array_flip(unserialize($payment_types));
}
if ($payment_statuses = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_PAYMENT_STATUSES, 0)) {
if ($payment_statuses = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_PAYMENT_STATUSES, 0)) {
$arResult['PAYMENT_STATUSES'] = array_flip(unserialize($payment_statuses));
}
if ($payment = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_PAYMENT, 0)) {
if ($payment = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_PAYMENT, 0)) {
$arResult['PAYMENT'] = array_flip(unserialize($payment));
}
@ -583,8 +542,8 @@ class intaro_retailcrm extends CModule
}
// api load
$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_host = COption::GetOptionString($this->MODULE_ID, Constants::CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($this->MODULE_ID, Constants::CRM_API_KEY_OPTION, 0);
$this->RETAIL_CRM_API = new ApiClient($api_host, $api_key);
$useCrmOrderMethods = htmlspecialchars(trim($_POST['use_crm_order_methods'])) === 'Y' ? 'Y' : 'N';
@ -698,16 +657,16 @@ class intaro_retailcrm extends CModule
$request = Application::getInstance()->getContext()->getRequest();
if ($request->isHttps() === true) {
COption::SetOptionString($this->MODULE_ID, $this->PROTOCOL, 'https://');
COption::SetOptionString($this->MODULE_ID, Constants::PROTOCOL, 'https://');
} else {
COption::SetOptionString($this->MODULE_ID, $this->PROTOCOL, 'http://');
COption::SetOptionString($this->MODULE_ID, Constants::PROTOCOL, 'http://');
}
// Set order types
if (!empty($orderTypesArr)) {
COption::SetOptionString(
$this->MODULE_ID,
$this->CRM_ORDER_TYPES_ARR,
Constants::CRM_ORDER_TYPES_ARR,
serialize(RCrmActions::clearArr($orderTypesArr)
)
);
@ -717,7 +676,7 @@ class intaro_retailcrm extends CModule
if (!empty($deliveryTypesArr)) {
COption::SetOptionString(
$this->MODULE_ID,
$this->CRM_DELIVERY_TYPES_ARR,
Constants::CRM_DELIVERY_TYPES_ARR,
serialize(RCrmActions::clearArr($deliveryTypesArr)
)
);
@ -727,7 +686,7 @@ class intaro_retailcrm extends CModule
if (!empty($paymentTypesArr)) {
COption::SetOptionString(
$this->MODULE_ID,
$this->CRM_PAYMENT_TYPES,
Constants::CRM_PAYMENT_TYPES,
serialize(RCrmActions::clearArr($paymentTypesArr)
)
);
@ -737,7 +696,7 @@ class intaro_retailcrm extends CModule
if (!empty($paymentStatusesArr)) {
COption::SetOptionString(
$this->MODULE_ID,
$this->CRM_PAYMENT_STATUSES,
Constants::CRM_PAYMENT_STATUSES,
serialize(RCrmActions::clearArr($paymentStatusesArr)
)
);
@ -747,33 +706,33 @@ class intaro_retailcrm extends CModule
if (!empty($paymentArr)) {
COption::SetOptionString(
$this->MODULE_ID,
$this->CRM_PAYMENT,
Constants::CRM_PAYMENT,
serialize(RCrmActions::clearArr($paymentArr)
)
);
}
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_DISCHARGE, 1);
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_FAILED_IDS, serialize([]));
COption::SetOptionString($this->MODULE_ID, Constants::CRM_ORDER_LAST_ID, 0);
COption::SetOptionString($this->MODULE_ID, Constants::CRM_ORDER_DISCHARGE, 1);
COption::SetOptionString($this->MODULE_ID, Constants::CRM_ORDER_FAILED_IDS, serialize([]));
// Set cansel order
if (!empty($canselOrderArr)) {
COption::SetOptionString(
$this->MODULE_ID,
$this->CRM_CANSEL_ORDER,
Constants::CRM_CANCEL_ORDER,
serialize(RCrmActions::clearArr($canselOrderArr)
)
);
}
if ($orderProps = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_ORDER_PROPS, 0)) {
if ($orderProps = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_ORDER_PROPS, 0)) {
$arResult['ORDER_PROPS'] = unserialize($orderProps);
}
if ($legalDetails = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_LEGAL_DETAILS, 0)) {
if ($legalDetails = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_LEGAL_DETAILS, 0)) {
$arResult['LEGAL_DETAILS'] = unserialize($legalDetails);
}
if ($contragentType = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_CONTRAGENT_TYPE, 0)) {
if ($contragentType = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_CONTRAGENT_TYPE, 0)) {
$arResult['CONTRAGENT_TYPES'] = unserialize($contragentType);
}
@ -801,7 +760,7 @@ class intaro_retailcrm extends CModule
$this->loadDeps();
RetailCrmOrder::uploadOrders(); // each 50
$lastUpOrderId = COption::GetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
$lastUpOrderId = COption::GetOptionString($this->MODULE_ID, Constants::CRM_ORDER_LAST_ID, 0);
$countLeft = (int) OrderTable::getCount(['>ID' => $lastUpOrderId]);
$countAll = (int) OrderTable::getCount();
@ -873,10 +832,10 @@ class intaro_retailcrm extends CModule
$contragentTypeArr[$orderType['ID']] = htmlspecialchars(trim($_POST['contragent-type-' . $orderType['ID']]));
}
COption::SetOptionString($this->MODULE_ID, $this->CRM_ADDRESS_OPTIONS, serialize($addressDetailOptions));
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_PROPS, serialize(RCrmActions::clearArr($orderPropsArr)));
COption::SetOptionString($this->MODULE_ID, $this->CRM_LEGAL_DETAILS, serialize(RCrmActions::clearArr($legalDetailsArr)));
COption::SetOptionString($this->MODULE_ID, $this->CRM_CONTRAGENT_TYPE, serialize(RCrmActions::clearArr($contragentTypeArr)));
COption::SetOptionString($this->MODULE_ID, Constants::CRM_ADDRESS_OPTIONS, serialize($addressDetailOptions));
COption::SetOptionString($this->MODULE_ID, Constants::CRM_ORDER_PROPS, serialize(RCrmActions::clearArr($orderPropsArr)));
COption::SetOptionString($this->MODULE_ID, Constants::CRM_LEGAL_DETAILS, serialize(RCrmActions::clearArr($legalDetailsArr)));
COption::SetOptionString($this->MODULE_ID, Constants::CRM_CONTRAGENT_TYPE, serialize(RCrmActions::clearArr($contragentTypeArr)));
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step4.php'
@ -914,12 +873,12 @@ class intaro_retailcrm extends CModule
$arResult['errCode'] = 'ERR_SALE';
}
$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_host = COption::GetOptionString($this->MODULE_ID, Constants::CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($this->MODULE_ID, Constants::CRM_API_KEY_OPTION, 0);
$api = new ApiClient($api_host, $api_key);
$customerH = $this->historyLoad($api, 'customersHistory');
COption::SetOptionString($this->MODULE_ID, $this->CRM_CUSTOMER_HISTORY, $customerH);
COption::SetOptionString($this->MODULE_ID, Constants::CRM_CUSTOMERS_HISTORY_SINCE_ID, $customerH);
//new data
if ($historyDate = COption::GetOptionString($this->OLD_MODULE_ID, 'order_history_date', 0)) {
@ -948,10 +907,10 @@ class intaro_retailcrm extends CModule
$orderH = $this->historyLoad($api, 'ordersHistory');
}
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_HISTORY, $orderH);
COption::SetOptionString($this->MODULE_ID, Constants::CRM_ORDER_HISTORY, $orderH);
if ($orderLastId = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_ORDER_LAST_ID, 0)) {
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, $orderLastId);
if ($orderLastId = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_ORDER_LAST_ID, 0)) {
COption::SetOptionString($this->MODULE_ID, Constants::CRM_ORDER_LAST_ID, $orderLastId);
} else {
$dbOrder = OrderTable::GetList([
'order' => ['ID' => 'DESC'],
@ -960,14 +919,14 @@ class intaro_retailcrm extends CModule
]);
$arOrder = $dbOrder->fetch();
if (!empty($arOrder['ID'])) {
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, $arOrder['ID']);
COption::SetOptionString($this->MODULE_ID, Constants::CRM_ORDER_LAST_ID, $arOrder['ID']);
} else {
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
COption::SetOptionString($this->MODULE_ID, Constants::CRM_ORDER_LAST_ID, 0);
}
}
if ($orderFailedIds = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_ORDER_FAILED_IDS, 0)) {
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_FAILED_IDS, $orderFailedIds);
if ($orderFailedIds = COption::GetOptionString($this->OLD_MODULE_ID, Constants::CRM_ORDER_FAILED_IDS, 0)) {
COption::SetOptionString($this->MODULE_ID, Constants::CRM_ORDER_FAILED_IDS, $orderFailedIds);
}
$arResult['PRICE_TYPES'] = [];
@ -1140,11 +1099,11 @@ class intaro_retailcrm extends CModule
RegisterModuleDependences('main', 'OnAfterUserAdd', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserAdd');
COption::SetOptionString($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE, htmlspecialchars(trim($_POST['price-types'])));
COption::SetOptionString($this->MODULE_ID, $this->CRM_INVENTORIES_UPLOAD, 'N');
COption::SetOptionString($this->MODULE_ID, $this->CRM_PRICES_UPLOAD, 'N');
COption::SetOptionString($this->MODULE_ID, $this->CRM_COLLECTOR, 'N');
COption::SetOptionString($this->MODULE_ID, $this->CRM_UA, 'N');
COption::SetOptionString($this->MODULE_ID, Constants::CRM_CATALOG_BASE_PRICE, htmlspecialchars(trim($_POST['price-types'])));
COption::SetOptionString($this->MODULE_ID, Constants::CRM_INVENTORIES_UPLOAD, 'N');
COption::SetOptionString($this->MODULE_ID, Constants::CRM_PRICES_UPLOAD, 'N');
COption::SetOptionString($this->MODULE_ID, Constants::CRM_COLLECTOR, 'N');
COption::SetOptionString($this->MODULE_ID, Constants::CRM_UA, 'N');
//agent
$dateAgent = new DateTime();
@ -1164,7 +1123,7 @@ class intaro_retailcrm extends CModule
$this->CopyFiles();
COption::RemoveOption($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_CATALOG_BASE_PRICE);
if (
file_exists($_SERVER['DOCUMENT_ROOT']
@ -1217,7 +1176,7 @@ class intaro_retailcrm extends CModule
COption::SetOptionString(
$this->MODULE_ID,
$this->CRM_CATALOG_BASE_PRICE . '_' . $profileId,
Constants::CRM_CATALOG_BASE_PRICE . '_' . $profileId,
htmlspecialchars(trim($_POST['price-types']))
);
@ -1239,8 +1198,8 @@ class intaro_retailcrm extends CModule
CCatalogExport::PreGenerateExport($profileId);
}
$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_host = COption::GetOptionString($this->MODULE_ID, Constants::CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($this->MODULE_ID, Constants::CRM_API_KEY_OPTION, 0);
$this->RETAIL_CRM_API = new ApiClient($api_host, $api_key);
RCrmActions::sendConfiguration($this->RETAIL_CRM_API);
@ -1255,9 +1214,6 @@ class intaro_retailcrm extends CModule
{
global $APPLICATION;
$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);
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/Exception/InvalidJsonException.php');
@ -1269,6 +1225,9 @@ 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');
$api_host = COption::GetOptionString($this->MODULE_ID, Constants::CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($this->MODULE_ID, Constants::CRM_API_KEY_OPTION, 0);
RCrmActions::sendConfiguration(new ApiClient($api_host, $api_key), false);
@ -1276,45 +1235,45 @@ class intaro_retailcrm extends CModule
CAgent::RemoveAgent('RetailCrmInventories::inventoriesUpload();', $this->MODULE_ID);
CAgent::RemoveAgent('RetailCrmPrices::pricesUpload();', $this->MODULE_ID);
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_HOST_OPTION);
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_KEY_OPTION);
COption::RemoveOption($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR);
COption::RemoveOption($this->MODULE_ID, $this->CRM_INTEGRATION_DELIVERY);
COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT_TYPES);
COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES);
COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT);
COption::RemoveOption($this->MODULE_ID, $this->CRM_INTEGRATION_PAYMENT);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_LAST_ID);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_PROPS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_TYPES_ARR);
COption::RemoveOption($this->MODULE_ID, $this->CRM_LEGAL_DETAILS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_CONTRAGENT_TYPE);
COption::RemoveOption($this->MODULE_ID, $this->CRM_SITES_LIST);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_DISCHARGE);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_FAILED_IDS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_CUSTOMER_HISTORY);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_HISTORY);
COption::RemoveOption($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE);
COption::RemoveOption($this->MODULE_ID, $this->CRM_CURRENCY);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ADDRESS_OPTIONS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_NUMBERS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_CANSEL_ORDER);
COption::RemoveOption($this->MODULE_ID, $this->CRM_INVENTORIES_UPLOAD);
COption::RemoveOption($this->MODULE_ID, $this->CRM_STORES);
COption::RemoveOption($this->MODULE_ID, $this->CRM_SHOPS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_IBLOCKS_INVENTORIES);
COption::RemoveOption($this->MODULE_ID, $this->CRM_PRICES_UPLOAD);
COption::RemoveOption($this->MODULE_ID, $this->CRM_PRICES);
COption::RemoveOption($this->MODULE_ID, $this->CRM_PRICE_SHOPS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_IBLOCKS_PRICES);
COption::RemoveOption($this->MODULE_ID, $this->CRM_COLLECTOR);
COption::RemoveOption($this->MODULE_ID, $this->CRM_COLL_KEY);
COption::RemoveOption($this->MODULE_ID, $this->CRM_UA);
COption::RemoveOption($this->MODULE_ID, $this->CRM_UA_KEYS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_VERSION);
COption::RemoveOption($this->MODULE_ID, $this->HISTORY_TIME);
COption::RemoveOption($this->MODULE_ID, $this->CLIENT_ID);
COption::RemoveOption($this->MODULE_ID, $this->PROTOCOL);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_API_HOST_OPTION);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_API_KEY_OPTION);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_DELIVERY_TYPES_ARR);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_INTEGRATION_DELIVERY);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_PAYMENT_TYPES);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_PAYMENT_STATUSES);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_PAYMENT);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_INTEGRATION_PAYMENT);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_ORDER_LAST_ID);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_ORDER_PROPS);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_ORDER_TYPES_ARR);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_LEGAL_DETAILS);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_CONTRAGENT_TYPE);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_SITES_LIST);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_ORDER_DISCHARGE);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_ORDER_FAILED_IDS);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_CUSTOMERS_HISTORY_SINCE_ID);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_ORDER_HISTORY);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_CATALOG_BASE_PRICE);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_CURRENCY);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_ADDRESS_OPTIONS);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_ORDER_NUMBERS);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_CANCEL_ORDER);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_INVENTORIES_UPLOAD);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_STORES);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_SHOPS);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_IBLOCKS_INVENTORIES);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_PRICES_UPLOAD);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_PRICES);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_PRICE_SHOPS);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_IBLOCKS_PRICES);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_COLLECTOR);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_COLL_KEY);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_UA);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_UA_KEYS);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_API_VERSION);
COption::RemoveOption($this->MODULE_ID, Constants::HISTORY_TIME);
COption::RemoveOption($this->MODULE_ID, Constants::CLIENT_ID);
COption::RemoveOption($this->MODULE_ID, Constants::PROTOCOL);
COption::RemoveOption($this->MODULE_ID, Constants::MATCHED_CUSTOM_PROPS);
COption::RemoveOption($this->MODULE_ID, Constants::MATCHED_CUSTOM_USER_FIELDS);
COption::RemoveOption($this->MODULE_ID, Constants::CRM_ORDER_METHODS);

View File

@ -1,5 +1,8 @@
<?php
IncludeModuleLangFile(__FILE__);
<?php
use Intaro\RetailCrm\Component\Constants;
IncludeModuleLangFile(__FILE__);
if (isset($arResult['errCode']) && $arResult['errCode']) {
$message = GetMessage($arResult['errCode']);
@ -11,12 +14,8 @@
}
}
$MODULE_ID = 'intaro.retailcrm';
$CRM_API_HOST_OPTION = 'api_host';
$CRM_API_KEY_OPTION = 'api_key';
$arResult['API_HOST'] = COption::GetOptionString($MODULE_ID, $CRM_API_HOST_OPTION);
$arResult['API_KEY'] = COption::GetOptionString($MODULE_ID, $CRM_API_KEY_OPTION);
$arResult['API_HOST'] = COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_API_HOST_OPTION);
$arResult['API_KEY'] = COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_API_KEY_OPTION);
?>
<div class="adm-detail-content-item-block">

View File

@ -1,29 +1,20 @@
<?php
use Intaro\RetailCrm\Component\ConfigProvider;
use Intaro\RetailCrm\Component\Constants;
use RetailCrm\ApiClient;
/** @var $APPLICATION */
IncludeModuleLangFile(__FILE__);
$MODULE_ID = 'intaro.retailcrm';
$CRM_API_HOST_OPTION = 'api_host';
$CRM_API_KEY_OPTION = 'api_key';
$CRM_SITES_LIST= 'sites_list';
$CRM_PAYMENT_TYPES = 'pay_types_arr';
$CRM_DELIVERY_TYPES_ARR = 'deliv_types_arr';
$CRM_PAYMENT_TYPES = 'pay_types_arr';
$CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
$CRM_PAYMENT = 'payment_arr';
$CRM_ORDER_TYPES_ARR = 'order_types_arr';
$api_host = COption::GetOptionString($MODULE_ID, $CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($MODULE_ID, $CRM_API_KEY_OPTION, 0);
$api_host = COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_API_KEY_OPTION, 0);
$arResult['arSites'] = RCrmActions::getSitesList();
$RETAIL_CRM_API = new ApiClient($api_host, $api_key);
COption::SetOptionString($MODULE_ID, $CRM_API_HOST_OPTION, $api_host);
COption::SetOptionString($MODULE_ID, $CRM_API_KEY_OPTION, $api_key);
COption::SetOptionString(Constants::MODULE_ID, Constants::CRM_API_HOST_OPTION, $api_host);
COption::SetOptionString(Constants::MODULE_ID, Constants::CRM_API_KEY_OPTION, $api_key);
$availableSites = RetailcrmConfigProvider::getSitesList();
@ -35,15 +26,15 @@ if (!empty($availableSites)) {
}
if (count($arResult['arSites']) === 1) {
COption::SetOptionString($MODULE_ID, $CRM_SITES_LIST, serialize([]));
COption::SetOptionString(Constants::MODULE_ID, Constants::CRM_SITES_LIST, serialize([]));
}
if (!isset($arResult['PAYMENT'])) {
$arResult['PAYMENT'] = unserialize(COption::GetOptionString($MODULE_ID, $CRM_PAYMENT, 0));
$arResult['PAYMENT'] = unserialize(COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_PAYMENT, 0));
}
if (!isset($arResult['ORDER_TYPES'])) {
$arResult['ORDER_TYPES'] = unserialize(COption::GetOptionString($MODULE_ID, $CRM_ORDER_TYPES_ARR, 0));
$arResult['ORDER_TYPES'] = unserialize(COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_ORDER_TYPES_ARR, 0));
}
if (!isset($arResult['paymentTypesList'])) {
@ -52,7 +43,7 @@ if (!isset($arResult['paymentTypesList'])) {
$availableSites,
$RETAIL_CRM_API->paymentTypesList()->paymentTypes
);
$arResult['PAYMENT_TYPES'] = unserialize(COption::GetOptionString($MODULE_ID, $CRM_PAYMENT_TYPES, 0));
$arResult['PAYMENT_TYPES'] = unserialize(COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_PAYMENT_TYPES, 0));
}
if (!isset($arResult['bitrixStatusesList'])) {
@ -68,7 +59,7 @@ if (!isset($arResult['orderTypesList'])) {
if (!isset($arResult['paymentStatusesList'])) {
$arResult['paymentStatusesList'] = $RETAIL_CRM_API->paymentStatusesList()->paymentStatuses;
$arResult['PAYMENT_STATUSES'] = unserialize(COption::GetOptionString($MODULE_ID, $CRM_PAYMENT_STATUSES, 0));
$arResult['PAYMENT_STATUSES'] = unserialize(COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_PAYMENT_STATUSES, 0));
}
if (!isset($arResult['bitrixDeliveryTypesList'])) {
@ -77,7 +68,7 @@ if (!isset($arResult['bitrixDeliveryTypesList'])) {
$availableSites,
$RETAIL_CRM_API->deliveryTypesList()->deliveryTypes
);
$arResult['DELIVERY_TYPES'] = unserialize(COption::GetOptionString($MODULE_ID, $CRM_DELIVERY_TYPES_ARR, 0));
$arResult['DELIVERY_TYPES'] = unserialize(COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_DELIVERY_TYPES_ARR, 0));
}
//bitrix pyament Y/N

View File

@ -1,5 +1,6 @@
<?php
use Intaro\RetailCrm\Component\Constants;
use RetailCrm\ApiClient;
/** @var $APPLICATION */
@ -10,38 +11,31 @@ if (!check_bitrix_sessid()) {
IncludeModuleLangFile(__FILE__);
$MODULE_ID = 'intaro.retailcrm';
$CRM_API_HOST_OPTION = 'api_host';
$CRM_API_KEY_OPTION = 'api_key';
$CRM_SITES_LIST= 'sites_list';
$CRM_ORDER_PROPS = 'order_props';
$CRM_CONTRAGENT_TYPE = 'contragent_type';
$CRM_LEGAL_DETAILS = 'legal_details';
$api_host = COption::GetOptionString($MODULE_ID, $CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($MODULE_ID, $CRM_API_KEY_OPTION, 0);
$api_host = COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_API_KEY_OPTION, 0);
$arResult['arSites'] = RCrmActions::getSitesList();
$RETAIL_CRM_API = new ApiClient($api_host, $api_key);
COption::SetOptionString($MODULE_ID, $CRM_API_HOST_OPTION, $api_host);
COption::SetOptionString($MODULE_ID, $CRM_API_KEY_OPTION, $api_key);
COption::SetOptionString(Constants::MODULE_ID, Constants::CRM_API_HOST_OPTION, $api_host);
COption::SetOptionString(Constants::MODULE_ID, Constants::CRM_API_KEY_OPTION, $api_key);
if (count($arResult['arSites']) === 1) {
COption::SetOptionString($MODULE_ID, $CRM_SITES_LIST, serialize([]));
COption::SetOptionString(Constants::MODULE_ID, Constants::CRM_SITES_LIST, serialize([]));
}
if (!isset($arResult['bitrixOrderTypesList'])) {
$arResult['bitrixOrderTypesList'] = RCrmActions::OrderTypesList($arResult['arSites']);
$arResult['arProp'] = RCrmActions::OrderPropsList();
$arResult['locationProp'] = RCrmActions::getLocationProps();
$arResult['ORDER_PROPS'] = unserialize(COption::GetOptionString($MODULE_ID, $CRM_ORDER_PROPS, 0));
$arResult['ORDER_PROPS'] = unserialize(COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_ORDER_PROPS, 0));
}
if (!isset($arResult['LEGAL_DETAILS'])) {
$arResult['LEGAL_DETAILS'] = unserialize(COption::GetOptionString($MODULE_ID, $CRM_LEGAL_DETAILS, 0));
$arResult['LEGAL_DETAILS'] = unserialize(COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_LEGAL_DETAILS, 0));
}
if (!isset($arResult['CONTRAGENT_TYPES'])) {
$arResult['CONTRAGENT_TYPES'] = unserialize(COption::GetOptionString($MODULE_ID, $CRM_CONTRAGENT_TYPE, 0));
$arResult['CONTRAGENT_TYPES'] = unserialize(COption::GetOptionString(Constants::MODULE_ID, Constants::CRM_CONTRAGENT_TYPE, 0));
if ($arResult['CONTRAGENT_TYPES'] === false) {
foreach ($arResult['contragentType'] as $crmContrAgentType) {

View File

@ -1,6 +1,6 @@
<?php
$arModuleVersion = [
'VERSION' => '6.5.19',
'VERSION_DATE' => '2024-06-14 13:12:00'
'VERSION' => '6.5.20',
'VERSION_DATE' => '2024-06-20 17:40:00'
];

View File

@ -154,3 +154,9 @@ $MESS ['FIX_UPLOAD_CUSTOMER_BUTTON_LABEL'] = 'Correct customer registration date
$MESS ['FIX_UPLOAD_CUSTOMER_INFO'] = 'When you press this button, an agent will be created to launch the script. Please note that the script execution time may vary depending on the number of clients in the database. To minimize possible disruptions to the script operation, it is recommended to launch it at night time. This script can only be launched once';
$MESS ['FIX_UPLOAD_CUSTOMER_AFTER_SUBMIT'] = 'The agent has been created and will be launched soon';
$MESS ['FIX_UPLOAD_CUSTOMER_AFTER_SUBMIT_ERROR'] = 'An error occurred while adding an agent';
$MESS ['ICRM_OPTIONS_GENERAL_CAPTION'] = 'Setting up connection to the RetailCRM system';
$MESS ['ICRM_OPTIONS_CATALOG_CAPTION'] = 'Comparison of RetailCRM and Bitrix system directories';
$MESS ['ICRM_OPTIONS_ORDER_PROPS_CAPTION'] = 'Comparison of order fields of RetailCRM and Bitrix systems';
$MESS ['ICRM_OPTIONS_LOYALTY_PROGRAM_CAPTION'] = 'Setting up work with the loyalty program';
$MESS ['ICRM_OPTIONS_OTHER_CAPTION'] = 'Setting up additional options for integration with the RetailCRM system';

View File

@ -8,6 +8,13 @@ $MESS ['ICRM_API_HOST'] = 'Адрес RetailCRM:';
$MESS ['ICRM_API_KEY'] = 'Ключ авторизации:';
$MESS ['ICRM_SITES'] = 'Активные сайты';
$MESS ['ICRM_OPTIONS_GENERAL_CAPTION'] = 'Настройка подключения к системе RetailCRM';
$MESS ['ICRM_OPTIONS_CATALOG_CAPTION'] = 'Сопоставление справочников системы RetailCRM и Bitrix';
$MESS ['ICRM_OPTIONS_ORDER_PROPS_CAPTION'] = 'Сопоставление полей заказа системы RetailCRM и Bitrix';
$MESS ['ICRM_OPTIONS_LOYALTY_PROGRAM_CAPTION'] = 'Настройка работы с программой лояльности';
$MESS ['ICRM_OPTIONS_OTHER_CAPTION'] = 'Настройка дополнительных опций интеграции c системой RetailCRM';
$MESS ['ICRM_OPTIONS_CATALOG_TAB'] = 'Настройка справочников';
$MESS ['DELIVERY_TYPES_LIST'] = 'Способы доставки';
$MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты';

View File

@ -69,6 +69,7 @@ class Constants
public const CRM_ORDER_FAILED_IDS = 'order_failed_ids';
public const CRM_CUSTOMERS_HISTORY_SINCE_ID = 'customer_history';
public const CRM_ORDER_HISTORY_DATE = 'order_history_date';
public const CRM_ORDER_HISTORY = 'order_history';
public const CRM_CATALOG_BASE_PRICE = 'catalog_base_price';
public const CRM_ORDER_DIMENSIONS = 'order_dimensions';
public const CRM_INTEGRATION_DELIVERY = 'integration_delivery';
@ -128,4 +129,8 @@ class Constants
public const OPTION_FIX_DATE_CUSTOMER = 'once_upload_customer';
public const OPTION_FIX_DATE_CUSTOMER_LAST_ID = 'last_id_customer_fix';
public const HISTORY_TIME = 'history_time';
public const MODULE_DEACTIVATE = 'module_deactivate';
public const AGENTS_DEACTIVATE = 'agents_deactivate';
public const EVENTS_DEACTIVATE = 'events_deactivate';
}

View File

@ -21,54 +21,6 @@ IncludeModuleLangFile(__FILE__);
$mid = 'intaro.retailcrm';
$uri = $APPLICATION->GetCurPage() . '?mid=' . htmlspecialchars($mid) . '&lang=' . LANGUAGE_ID;
$CRM_API_HOST_OPTION = 'api_host';
$CRM_API_KEY_OPTION = 'api_key';
$CRM_ORDER_TYPES_ARR = 'order_types_arr';
$CRM_DELIVERY_TYPES_ARR = 'deliv_types_arr';
$CRM_DELIVERY_SERVICES_ARR = 'deliv_services_arr';
$CRM_PAYMENT_TYPES = 'pay_types_arr';
$CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
$CRM_PAYMENT = 'payment_arr';
$CRM_ORDER_LAST_ID = 'order_last_id';
$CRM_ORDER_SITES = 'sites_ids';
$CRM_ORDER_DISCHARGE = 'order_discharge';
$CRM_ORDER_PROPS = 'order_props';
$CRM_LEGAL_DETAILS = 'legal_details';
$CRM_CUSTOM_FIELDS = 'custom_fields';
$CRM_COUPON_FIELD = 'crm_coupon_field';
$CRM_CONTRAGENT_TYPE = 'contragent_type';
$CRM_SITES_LIST = 'sites_list';
$CRM_ORDER_NUMBERS = 'order_numbers';
$CRM_ORDER_VAT = 'order_vat';
$CRM_CANSEL_ORDER = 'cansel_order';
$CRM_INVENTORIES_UPLOAD = 'inventories_upload';
$CRM_STORES = 'stores';
$CRM_SHOPS = 'shops';
$CRM_IBLOCKS_INVENTORIES = 'iblocks_inventories';
$CRM_PRICES_UPLOAD = 'prices_upload';
$CRM_PRICES = 'prices';
$CRM_PRICE_SHOPS = 'price_shops';
$CRM_IBLOCKS_PRICES = 'iblock_prices';
$CRM_COLLECTOR = 'collector';
$CRM_COLL_KEY = 'coll_key';
$CRM_UA = 'ua';
$CRM_UA_KEYS = 'ua_keys';
$CRM_DISCOUNT_ROUND = 'discount_round';
$CRM_CC = 'cc';
$CRM_CORP_SHOPS = 'shops-corporate';
$CRM_CORP_NAME = 'nickName-corporate';
$CRM_CORP_ADRES = 'adres-corporate';
$CRM_API_VERSION = 'api_version';
$CRM_CURRENCY = 'currency';
$CRM_ADDRESS_OPTIONS = 'address_options';
$CRM_DIMENSIONS = 'order_dimensions';
$PROTOCOL = 'protocol';
$CRM_PURCHASE_PRICE_NULL = 'purchasePrice_null';
$CRM_CART = 'cart';
$MODULE_DEACTIVATE = 'module_deactivate';
$AGENTS_DEACTIVATE = 'agents_deactivate';
$EVENTS_DEACTIVATE = 'events_deactivate';
if (!CModule::IncludeModule('intaro.retailcrm') || !CModule::IncludeModule('sale') || !CModule::IncludeModule('iblock') || !CModule::IncludeModule('catalog')) {
return;
}
@ -130,8 +82,8 @@ if (method_exists(RCrmActions::class, 'customOrderPropList')
//ajax update deliveryServices
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') && isset($_POST['ajax']) && ($_POST['ajax'] === 1)) {
$api_host = COption::GetOptionString($mid, $CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($mid, $CRM_API_KEY_OPTION, 0);
$api_host = COption::GetOptionString($mid, Constants::CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($mid, Constants::CRM_API_KEY_OPTION , 0);
$api = new RetailCrm\ApiClient($api_host, $api_key);
try {
@ -147,7 +99,7 @@ if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_RE
die(json_encode(['success' => false, 'errMsg' => $e->getCode()]));
}
$optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0));
$optionsDelivTypes = unserialize(COption::GetOptionString($mid, Constants::CRM_DELIVERY_TYPES_ARR, 0));
$arDeliveryServiceAll = Manager::getActiveList();
foreach ($optionsDelivTypes as $key => $deliveryType) {
@ -354,7 +306,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
$paymentArr['Y'] = htmlspecialchars(trim($_POST['payment-Y']));
$paymentArr['N'] = htmlspecialchars(trim($_POST['payment-N']));
$previousDischarge = COption::GetOptionString($mid, $CRM_ORDER_DISCHARGE, 0);
$previousDischarge = COption::GetOptionString($mid, Constants::CRM_ORDER_DISCHARGE, 0);
//order discharge mode
// 0 - agent
// 1 - event
@ -370,7 +322,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
RegisterModuleDependences('sale', 'OnSaleOrderDeleted', $mid, 'RetailCrmEvent', "orderDelete");
}
$optionCart = COption::GetOptionString($mid, $CRM_CART, 'N');
$optionCart = COption::GetOptionString($mid, Constants::CART, 'N');
$cart = htmlspecialchars(trim($_POST['cart']));
@ -595,7 +547,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
//version
$version = COption::GetOptionString($mid, $CRM_API_VERSION);
$version = COption::GetOptionString($mid, Constants::CRM_API_VERSION);
if (htmlspecialchars(trim($_POST['api_version'])) != $version) {
if (htmlspecialchars(trim($_POST['api_version'])) === 'v5') {
@ -621,15 +573,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
);
if ($result->getStatusCode() === 200) {
COption::SetOptionString($mid, $CRM_API_VERSION, $version);
COption::SetOptionString($mid, Constants::CRM_API_VERSION, $version);
} else {
LocalRedirect($uri);
echo CAdminMessage::ShowMessage(GetMessage('API_NOT_WORK'));
}
}
if ($_POST[$CRM_CURRENCY]) {
COption::SetOptionString($mid, $CRM_CURRENCY, $_POST['currency']);
if ($_POST[Constants::CRM_CURRENCY]) {
COption::SetOptionString($mid, Constants::CRM_CURRENCY, $_POST['currency']);
}
if (isset($_POST['loyalty_toggle']) && $_POST['loyalty_toggle'] === 'on') {
@ -706,17 +658,17 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
}
if ($deactivateAgents !== []) {
COption::SetOptionString($mid, $AGENTS_DEACTIVATE, serialize($deactivateAgents));
COption::SetOptionString($mid, Constants::AGENTS_DEACTIVATE, serialize($deactivateAgents));
}
if ($deactivateEvents !== []) {
COption::SetOptionString($mid, $EVENTS_DEACTIVATE, serialize($deactivateEvents));
COption::SetOptionString($mid, Constants::EVENTS_DEACTIVATE, serialize($deactivateEvents));
}
RCrmActions::sendConfiguration($api, false);
} else {
$deactivateAgents = unserialize(COption::GetOptionString($mid, $AGENTS_DEACTIVATE, ''));
$deactivateEvents = unserialize(COption::GetOptionString($mid, $EVENTS_DEACTIVATE, ''));
$deactivateAgents = unserialize(COption::GetOptionString($mid, Constants::AGENTS_DEACTIVATE, ''));
$deactivateEvents = unserialize(COption::GetOptionString($mid, Constants::EVENTS_DEACTIVATE, ''));
if (!empty($deactivateAgents)) {
$dateAgent = new DateTime();
@ -736,7 +688,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
);
}
COption::SetOptionString($mid, $AGENTS_DEACTIVATE, serialize([]));
COption::SetOptionString($mid, Constants::AGENTS_DEACTIVATE, serialize([]));
}
if (!empty($deactivateEvents)) {
@ -762,7 +714,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
}
}
COption::SetOptionString($mid, $EVENTS_DEACTIVATE, serialize([]));
COption::SetOptionString($mid, Constants::EVENTS_DEACTIVATE, serialize([]));
}
RCrmActions::sendConfiguration($api);
@ -770,72 +722,72 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
COption::SetOptionString(
$mid,
$MODULE_DEACTIVATE,
Constants::MODULE_DEACTIVATE,
serialize($moduleDeactivateParam)
);
COption::SetOptionString(
$mid,
$CRM_ADDRESS_OPTIONS,
Constants::CRM_ADDRESS_OPTIONS,
serialize($addressDatailOptions)
);
COption::SetOptionString(
$mid,
$CRM_SITES_LIST,
Constants::CRM_SITES_LIST,
serialize($siteListArr)
);
COption::SetOptionString(
$mid,
$CRM_ORDER_TYPES_ARR,
Constants::CRM_ORDER_TYPES_ARR,
serialize(RCrmActions::clearArr(is_array($orderTypesArr) ? $orderTypesArr : []))
);
COption::SetOptionString(
$mid,
$CRM_DELIVERY_TYPES_ARR,
Constants::CRM_DELIVERY_TYPES_ARR,
serialize(RCrmActions::clearArr(is_array($deliveryTypesArr) ? $deliveryTypesArr : []))
);
COption::SetOptionString(
$mid,
$CRM_PAYMENT_TYPES,
Constants::CRM_PAYMENT_TYPES,
serialize(RCrmActions::clearArr(is_array($paymentTypesArr) ? $paymentTypesArr : []))
);
COption::SetOptionString(
$mid,
$CRM_PAYMENT_STATUSES,
Constants::CRM_PAYMENT_STATUSES,
serialize(RCrmActions::clearArr(is_array($paymentStatusesArr) ? $paymentStatusesArr : []))
);
COption::SetOptionString(
$mid,
$CRM_PAYMENT,
Constants::CRM_PAYMENT,
serialize(RCrmActions::clearArr(is_array($paymentArr) ? $paymentArr : []))
);
COption::SetOptionString(
$mid,
$CRM_ORDER_DISCHARGE,
Constants::CRM_ORDER_DISCHARGE,
$orderDischarge
);
COption::SetOptionString(
$mid,
$CRM_ORDER_PROPS,
Constants::CRM_ORDER_PROPS,
serialize(RCrmActions::clearArr(is_array($orderPropsArr) ? $orderPropsArr : []))
);
COption::SetOptionString(
$mid,
$CRM_CONTRAGENT_TYPE,
Constants::CRM_CONTRAGENT_TYPE,
serialize(RCrmActions::clearArr(is_array($contragentTypeArr) ? $contragentTypeArr : []))
);
COption::SetOptionString(
$mid,
$CRM_LEGAL_DETAILS,
Constants::CRM_LEGAL_DETAILS,
serialize(RCrmActions::clearArr(is_array($legalDetailsArr) ? $legalDetailsArr : []))
);
COption::SetOptionString(
$mid,
$CRM_ORDER_NUMBERS,
Constants::CRM_ORDER_NUMBERS,
htmlspecialchars(trim($_POST['order-numbers'])) ?: 'N'
);
COption::SetOptionString(
$mid,
$CRM_ORDER_VAT,
Constants::CRM_ORDER_VAT,
htmlspecialchars(trim($_POST['order-vat'])) ?: 'N'
);
@ -910,7 +862,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
COption::SetOptionString(
$mid,
$CRM_COUPON_FIELD,
Constants::CRM_COUPON_FIELD,
htmlspecialchars(trim($_POST['crm-coupon-field'])) ?: 'N'
);
COption::SetOptionString(
@ -920,32 +872,32 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
);
COption::SetOptionString(
$mid,
$CRM_CANSEL_ORDER,
Constants::CRM_CANCEL_ORDER,
serialize(RCrmActions::clearArr(is_array($canselOrderArr) ? $canselOrderArr : []))
);
COption::SetOptionString(
$mid,
$CRM_INVENTORIES_UPLOAD,
Constants::CRM_INVENTORIES_UPLOAD,
$inventoriesUpload
);
COption::SetOptionString(
$mid,
$CRM_STORES,
Constants::CRM_STORES,
serialize(RCrmActions::clearArr(is_array($bitrixStoresArr) ? $bitrixStoresArr : []))
);
COption::SetOptionString(
$mid,
$CRM_SHOPS,
Constants::CRM_SHOPS,
serialize(RCrmActions::clearArr(is_array($bitrixShopsArr) ? $bitrixShopsArr : []))
);
COption::SetOptionString(
$mid,
$CRM_IBLOCKS_INVENTORIES,
Constants::CRM_IBLOCKS_INVENTORIES,
serialize(RCrmActions::clearArr(is_array($bitrixIblocksInventories) ? $bitrixIblocksInventories : []))
);
COption::SetOptionString(
$mid,
$CRM_PRICES_UPLOAD,
Constants::CRM_PRICES_UPLOAD,
$pricesUpload
);
COption::SetOptionString(
@ -960,27 +912,27 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
);
COption::SetOptionString(
$mid,
$CRM_PRICES,
Constants::CRM_PRICES,
serialize(RCrmActions::clearArr(is_array($bitrixPricesArr) ? $bitrixPricesArr : []))
);
COption::SetOptionString(
$mid,
$CRM_PRICE_SHOPS,
Constants::CRM_PRICE_SHOPS,
serialize(RCrmActions::clearArr(is_array($bitrixPriceShopsArr) ? $bitrixPriceShopsArr : []))
);
COption::SetOptionString(
$mid,
$CRM_IBLOCKS_PRICES,
Constants::CRM_IBLOCKS_PRICES,
serialize(RCrmActions::clearArr(is_array($bitrixIblocksPrices) ? $bitrixIblocksPrices : []))
);
COption::SetOptionString(
$mid,
$CRM_COLLECTOR,
Constants::CRM_COLLECTOR,
$collector
);
COption::SetOptionString(
$mid,
$CRM_COLL_KEY,
Constants::CRM_COLL_KEY,
serialize(RCrmActions::clearArr(is_array($collectorKeys) ? $collectorKeys : []))
);
@ -989,25 +941,25 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
COption::SetOptionString(
$mid,
$CRM_UA,
Constants::CRM_UA,
$ua
);
COption::SetOptionString(
$mid,
$CRM_UA_KEYS,
Constants::CRM_UA_KEYS,
serialize(RCrmActions::clearArr(is_array($uaKeys) ? $uaKeys : []))
);
COption::SetOptionString(
$mid,
$CRM_DIMENSIONS,
htmlspecialchars(trim($_POST[$CRM_DIMENSIONS])) ?: 'N'
Constants::CRM_DIMENSIONS,
htmlspecialchars(trim($_POST[Constants::CRM_DIMENSIONS])) ?: 'N'
);
RetailcrmConfigProvider::setSendPaymentAmount(htmlspecialchars(trim($_POST[Constants::SEND_PAYMENT_AMOUNT])) ?: 'N');
RetailCrmConfigProvider::setDiscountRound($discount_round);
RetailcrmConfigProvider::setCart($optionCart);
COption::SetOptionString(
$mid,
$CRM_PURCHASE_PRICE_NULL,
Constants::CRM_PURCHASE_PRICE_NULL,
$purchasePrice_null
);
COption::SetOptionString(
@ -1015,22 +967,22 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
RetailcrmConstants::CRM_SHIPMENT_DEDUCTED, $shipment_deducted);
COption::SetOptionString(
$mid,
$CRM_CC,
Constants::CRM_CC,
$cc
);
COption::SetOptionString(
$mid,
$CRM_CORP_SHOPS,
Constants::CRM_CORP_SHOPS,
serialize(RCrmActions::clearArr(is_array($bitrixCorpShopsArr) ? $bitrixCorpShopsArr : []))
);
COption::SetOptionString(
$mid,
$CRM_CORP_NAME,
Constants::CRM_CORP_NAME,
$bitrixCorpName
);
COption::SetOptionString(
$mid,
$CRM_CORP_ADRES,
Constants::CRM_CORP_ADDRESS,
$bitrixCorpAdres
);
@ -1065,9 +1017,9 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
$request = Application::getInstance()->getContext()->getRequest();
if ($request->isHttps() === true) {
COption::SetOptionString($mid, $PROTOCOL, 'https://');
COption::SetOptionString($mid, Constants::PROTOCOL, 'https://');
} else {
COption::SetOptionString($mid, $PROTOCOL, 'http://');
COption::SetOptionString($mid, Constants::PROTOCOL, 'http://');
}
if ($error !== null) {
@ -1078,8 +1030,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
LocalRedirect($uri);
} else {
$api_host = COption::GetOptionString($mid, $CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($mid, $CRM_API_KEY_OPTION, 0);
$api_host = COption::GetOptionString($mid, Constants::CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($mid, Constants::CRM_API_KEY_OPTION , 0);
$api = new RetailCrm\ApiClient($api_host, $api_key);
// Prepare crm lists
@ -1239,61 +1191,61 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
//saved params
$useCrmOrderMethods = ConfigProvider::useCrmOrderMethods();
$crmOrderMethods = unserialize(COption::GetOptionString($mid, Constants::CRM_ORDER_METHODS, 0));
$moduleDeactivate = unserialize(COption::GetOptionString($mid, $MODULE_DEACTIVATE, 'N'));
$optionsOrderTypes = unserialize(COption::GetOptionString($mid, $CRM_ORDER_TYPES_ARR, 0));
$optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0));
$optionsPayTypes = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_TYPES, 0));
$optionsPayStatuses = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_STATUSES, 0));
$optionsPayment = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT, 0));
$optionsSitesList = unserialize(COption::GetOptionString($mid, $CRM_SITES_LIST, 0));
$optionsDischarge = (int) COption::GetOptionString($mid, $CRM_ORDER_DISCHARGE, 0);
$optionsOrderProps = unserialize(COption::GetOptionString($mid, $CRM_ORDER_PROPS, 0));
$optionsContragentType = unserialize(COption::GetOptionString($mid, $CRM_CONTRAGENT_TYPE, 0));
$optionsLegalDetails = unserialize(COption::GetOptionString($mid, $CRM_LEGAL_DETAILS, 0));
$optionsCustomFields = unserialize(COption::GetOptionString($mid, $CRM_CUSTOM_FIELDS, 0));
$optionsOrderNumbers = COption::GetOptionString($mid, $CRM_ORDER_NUMBERS, 0);
$optionsOrderVat = COption::GetOptionString($mid, $CRM_ORDER_VAT, 0);
$moduleDeactivate = unserialize(COption::GetOptionString($mid, Constants::MODULE_DEACTIVATE, 'N'));
$optionsOrderTypes = unserialize(COption::GetOptionString($mid, Constants::CRM_ORDER_TYPES_ARR, 0));
$optionsDelivTypes = unserialize(COption::GetOptionString($mid, Constants::CRM_DELIVERY_TYPES_ARR, 0));
$optionsPayTypes = unserialize(COption::GetOptionString($mid, Constants::CRM_PAYMENT_TYPES, 0));
$optionsPayStatuses = unserialize(COption::GetOptionString($mid, Constants::CRM_PAYMENT_STATUSES, 0));
$optionsPayment = unserialize(COption::GetOptionString($mid, Constants::CRM_PAYMENT, 0));
$optionsSitesList = unserialize(COption::GetOptionString($mid, Constants::CRM_SITES_LIST, 0));
$optionsDischarge = (int) COption::GetOptionString($mid, Constants::CRM_ORDER_DISCHARGE, 0);
$optionsOrderProps = unserialize(COption::GetOptionString($mid, Constants::CRM_ORDER_PROPS, 0));
$optionsContragentType = unserialize(COption::GetOptionString($mid, Constants::CRM_CONTRAGENT_TYPE, 0));
$optionsLegalDetails = unserialize(COption::GetOptionString($mid, Constants::CRM_LEGAL_DETAILS, 0));
$optionsCustomFields = unserialize(COption::GetOptionString($mid, Constants::CRM_CUSTOM_FIELDS, 0));
$optionsOrderNumbers = COption::GetOptionString($mid, Constants::CRM_ORDER_NUMBERS, 0);
$optionsOrderVat = COption::GetOptionString($mid, Constants::CRM_ORDER_VAT, 0);
$optionsOrderTrackNumber = ConfigProvider::getTrackNumberStatus();
$optionsSyncIntegrationPayment = ConfigProvider::getSyncIntegrationPayment();
$canselOrderArr = unserialize(COption::GetOptionString($mid, $CRM_CANSEL_ORDER, 0));
$canselOrderArr = unserialize(COption::GetOptionString($mid, Constants::CRM_CANCEL_ORDER, 0));
$sendPickupPointAddress = COption::GetOptionString($mid, Constants::CRM_SEND_PICKUP_POINT_ADDRESS, 'N');
$optionInventotiesUpload = COption::GetOptionString($mid, $CRM_INVENTORIES_UPLOAD, 0);
$optionStores = unserialize(COption::GetOptionString($mid, $CRM_STORES, 0));
$optionShops = unserialize(COption::GetOptionString($mid, $CRM_SHOPS, 0));
$optionIblocksInventories = unserialize(COption::GetOptionString($mid, $CRM_IBLOCKS_INVENTORIES, 0));
$optionShopsCorporate = unserialize(COption::GetOptionString($mid, $CRM_SHOPS, 0));
$optionInventotiesUpload = COption::GetOptionString($mid, Constants::CRM_INVENTORIES_UPLOAD, 0);
$optionStores = unserialize(COption::GetOptionString($mid, Constants::CRM_STORES, 0));
$optionShops = unserialize(COption::GetOptionString($mid, Constants::CRM_SHOPS, 0));
$optionIblocksInventories = unserialize(COption::GetOptionString($mid, Constants::CRM_IBLOCKS_INVENTORIES, 0));
$optionShopsCorporate = unserialize(COption::GetOptionString($mid, Constants::CRM_SHOPS, 0));
$optionPricesUpload = COption::GetOptionString($mid, $CRM_PRICES_UPLOAD, 0);
$optionPrices = unserialize(COption::GetOptionString($mid, $CRM_PRICES, 0));
$optionPriceShops = unserialize(COption::GetOptionString($mid, $CRM_PRICE_SHOPS, 0));
$optionIblocksPrices = unserialize(COption::GetOptionString($mid, $CRM_IBLOCKS_PRICES, 0));
$optionPricesUpload = COption::GetOptionString($mid, Constants::CRM_PRICES_UPLOAD, 0);
$optionPrices = unserialize(COption::GetOptionString($mid, Constants::CRM_PRICES, 0));
$optionPriceShops = unserialize(COption::GetOptionString($mid, Constants::CRM_PRICE_SHOPS, 0));
$optionIblocksPrices = unserialize(COption::GetOptionString($mid, Constants::CRM_IBLOCKS_PRICES, 0));
$optionCollector = COption::GetOptionString($mid, $CRM_COLLECTOR, 0);
$optionCollectorKeys = unserialize(COption::GetOptionString($mid, $CRM_COLL_KEY));
$optionCollector = COption::GetOptionString($mid, Constants::CRM_COLLECTOR, 0);
$optionCollectorKeys = unserialize(COption::GetOptionString($mid, Constants::CRM_COLL_KEY));
$optionOnlineConsultant = RetailcrmConfigProvider::isOnlineConsultantEnabled();
$optionOnlineConsultantScript = RetailcrmConfigProvider::getOnlineConsultantScript();
$optionUa = COption::GetOptionString($mid, $CRM_UA, 0);
$optionUaKeys = unserialize(COption::GetOptionString($mid, $CRM_UA_KEYS));
$optionUa = COption::GetOptionString($mid, Constants::CRM_UA, 0);
$optionUaKeys = unserialize(COption::GetOptionString($mid, Constants::CRM_UA_KEYS));
$optionDiscRound = COption::GetOptionString($mid, $CRM_DISCOUNT_ROUND, 0);
$optionPricePrchaseNull = COption::GetOptionString($mid, $CRM_PURCHASE_PRICE_NULL, 0);
$optionDiscRound = COption::GetOptionString($mid, Constants::CRM_DISCOUNT_ROUND, 0);
$optionPricePrchaseNull = COption::GetOptionString($mid, Constants::CRM_PURCHASE_PRICE_NULL, 0);
$optionShipmentDeducted = RetailcrmConfigProvider::getShipmentDeducted();
//corporate-cliente
$optionCorpClient = COption::GetOptionString($mid, $CRM_CC, 0);
$optionCorpShops = unserialize(COption::GetOptionString($mid, $CRM_CORP_SHOPS, 0));
$optionsCorpComName = COption::GetOptionString($mid, $CRM_CORP_NAME, 0);
$optionsCorpAdres = COption::GetOptionString($mid, $CRM_CORP_ADRES, 0);
$optionCorpClient = COption::GetOptionString($mid, Constants::CRM_CC, 0);
$optionCorpShops = unserialize(COption::GetOptionString($mid, Constants::CRM_CORP_SHOPS, 0));
$optionsCorpComName = COption::GetOptionString($mid, Constants::CRM_CORP_NAME, 0);
$optionsCorpAdres = COption::GetOptionString($mid, Constants::CRM_CORP_ADDRESS, 0);
$version = COption::GetOptionString($mid, $CRM_API_VERSION, 0);
$version = COption::GetOptionString($mid, Constants::CRM_API_VERSION, 0);
$optionsFixDateCustomer = COption::GetOptionString($mid, RetailcrmConstants::OPTION_FIX_DATE_CUSTOMER, 0);
// Old functional
$currencyOption = COption::GetOptionString($mid, $CRM_CURRENCY, 0) ?: CCurrency::GetBaseCurrency();
$currencyOption = COption::GetOptionString($mid, Constants::CRM_CURRENCY, 0) ?: CCurrency::GetBaseCurrency();
//Validate currency
$currencyList = CurrencyManager::getCurrencyList();
@ -1339,7 +1291,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
}
$customFields = [['code' => '__default_empty_value__', 'name' => GetMessage('SELECT_VALUE')]];
$crmCouponFieldOption = COption::GetOptionString($mid, $CRM_COUPON_FIELD, 0) ?: null;
$crmCouponFieldOption = COption::GetOptionString($mid, Constants::CRM_COUPON_FIELD, 0) ?: null;
$page = 1;
do {
@ -1356,10 +1308,10 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
$page++;
} while($getCustomFields['pagination']['currentPage'] < $getCustomFields['pagination']['totalPageCount']);
$optionsOrderDimensions = COption::GetOptionString($mid, $CRM_DIMENSIONS, 'N');
$addressOptions = unserialize(COption::GetOptionString($mid, $CRM_ADDRESS_OPTIONS, 0));
$optionsOrderDimensions = COption::GetOptionString($mid, Constants::CRM_DIMENSIONS, 'N');
$addressOptions = unserialize(COption::GetOptionString($mid, Constants::CRM_ADDRESS_OPTIONS, 0));
$optionCart = COption::GetOptionString($mid, $CRM_CART, 'N');
$optionCart = COption::GetOptionString($mid, Constants::CART, 'N');
//loyalty program options
$loyaltyProgramToggle = ConfigProvider::getLoyaltyProgramStatus();
@ -1387,7 +1339,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
"DIV" => "edit4",
"TAB" => GetMessage('LOYALTY_PROGRAM_TITLE'),
"ICON" => '',
"TITLE" => GetMessage('ICRM_OPTIONS_ORDER_DISCHARGE_CAPTION'),
"TITLE" => GetMessage('ICRM_OPTIONS_LOYALTY_PROGRAM_CAPTION'),
],
[
"DIV" => "edit5",
@ -1405,7 +1357,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
"DIV" => "edit7",
"TAB" => GetMessage('OTHER_OPTIONS'),
"ICON" => '',
"TITLE" => GetMessage('ICRM_OPTIONS_ORDER_DISCHARGE_CAPTION'),
"TITLE" => GetMessage('ICRM_OPTIONS_OTHER_CAPTION'),
]
];
$tabControl = new CAdminTabControl("tabControl", $aTabs);