1
0
Fork 0
mirror of synced 2025-04-04 22:33:33 +03:00

Compare commits

...

34 commits

Author SHA1 Message Date
ellynoize
e61259ded9
Исправлена передача габаритов при выгрузке заказов по агенту (#388) 2025-03-26 15:53:37 +03:00
ellynoize
0359315c79
Исправлена передача некорректного статуса оплаты для отмененных заказов (#387) 2025-03-26 15:45:25 +03:00
Kocmonavtik
08ff21ce04
Исправление обновления модуля (#385) 2025-03-05 10:33:10 +03:00
ellynoize
de7ecd4100
Исправлена ошибка экспорта дополнительных свойств товаров (#386) 2025-03-03 12:58:48 +03:00
ellynoize
54692c50d4
Исправлена ошибка установки модуля на PHP 8.0 2025-02-04 09:07:06 +03:00
ellynoize
61044988d5
Передача нулевой закупочной стоимости в экспорте каталога (#382) 2025-01-30 09:20:26 +03:00
ellynoize
7a36fa5de7
Исправлена ошибка редактирования интеграционных доставок (#381) 2025-01-28 11:47:01 +03:00
ellynoize
8cf4420592
Исправлено некорректное удаление признака применения промокода (#380) 2025-01-28 10:45:49 +03:00
Kocmonavtik
84c7d10146
Исправлены ошибки при обновлении модуля (#379) 2025-01-15 10:24:03 +03:00
ellynoize
8c38d21477
Исправлена выгрузка архива заказов при установке модуля (#378) 2025-01-14 15:05:46 +03:00
Kocmonavtik
115cf33423
Исправление API методов по работе с пользовательскими полями (#377) 2024-12-17 15:11:37 +03:00
Kocmonavtik
3162031b65
Динамическое добавление свойств в ICML (#375) 2024-12-10 14:33:00 +03:00
Aleksei Novikov
1ec3bccd0c
Исправлена поломка заказов с промокодом Maxma при включенной передаче корзины в CRM (#376) 2024-12-09 12:48:35 +03:00
ellynoize
41257b9d7c
Исправлена выгрузка заказов через агент (#372) 2024-11-05 12:42:39 +03:00
Kocmonavtik
b68779a054
Исправлена подписка модуля на событие сохранения заказа (#371) 2024-11-05 09:24:39 +03:00
ellynoize
d25c7fc484
Передача профилей модуля Почты России (#370) 2024-10-28 11:21:46 +03:00
ellynoize
317a30b682
Бамп версии модуля (#369) 2024-10-24 10:33:08 +03:00
ellynoize
534757e6c6
Исправлена подписка на событие сохранения заказа (#368) 2024-10-23 17:05:39 +03:00
ellynoize
7e260a2d22
Исправлена ошибка агента выгрузки изменений при наличии у заказа клиента без магазина (#367) 2024-10-22 09:42:58 +03:00
ellynoize
6fb061e6cc
Добавлена передача дополнительных параметров в GET запросах (#366) 2024-10-14 16:59:41 +03:00
ellynoize
a77b29cd49
Исправлена подписка на событие при обновлении (#365) 2024-10-03 12:46:41 +03:00
ellynoize
c1deb9e91e
Добавлено логирование ответа от API при неудачном создании заказа (#364) 2024-09-24 14:12:33 +03:00
ellynoize
1d2a87f277
Добавление передачи контрагентов с типом ИП (#363) 2024-09-23 13:21:59 +03:00
ellynoize
74833ed2db
Перенос подписки на событие сохрания заказа в установку модуля (#362) 2024-09-23 09:46:10 +03:00
alexxmoree
8eab4864c5
Исправление возврата статуса заказа на предыдущий (#361) 2024-09-11 12:41:17 +03:00
Rinacoder
169509c263
Исправлена передача изменений по клиентам, отсутствующим в Bitrix (#360) 2024-09-06 15:10:19 +03:00
Kocmonavtik
1b64044013
Исправлено удаление модуля (#359) 2024-09-02 09:12:05 +03:00
Uryvskiy Dima
a83ff3cc6b
Улучшена генерация каталога с маркированными товарами (#357) 2024-08-12 11:58:24 +03:00
Kocmonavtik
6a6a4545b8
Добавление переводов для программы лояльности (#356) 2024-08-08 09:47:15 +03:00
Uryvskiy Dima
10745c4c8d
Исправлена ошибка с присвоением externalId при добавлении товара в заказ как разные товарные позиции из CRM (#355) 2024-08-06 11:17:14 +03:00
Kocmonavtik
ebb32869aa
Добавлена передача скидок на торговые позиции в брошенных корзинах (#353) 2024-07-18 14:14:36 +03:00
Uryvskiy Dima
3e3e37b297
Добавлена передача поля link при выгрузке брошенных корзин (#352) 2024-07-15 17:24:27 +03:00
Kocmonavtik
1ab3dacaf7
ref #93680 Рефакторинг настроек и установки модуля, добавление переводов в настройках модуля (#351) 2024-06-21 11:37:07 +03:00
roadmoore
0550d8ffba
Исправление работы программы лояльности при использования опции "Подтверждение списания по смс" (#350) 2024-06-18 09:21:06 +03:00
68 changed files with 2260 additions and 2074 deletions

View file

@ -20,11 +20,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.4', '8.0']
php-version: ['8.1']
bitrix-edition: ['small_business_encode', 'business_encode']
services:
mysql:
image: mysql:5.7
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: ${{ env.DB_BITRIX_PASS }}
MYSQL_DATABASE: bitrix
@ -49,7 +49,7 @@ jobs:
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
@ -68,10 +68,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP 7.2
- name: Setup PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
php-version: 8.1
ini-values: short_open_tag=On, mbstring.func_overload=2, mbstring.internal_encoding="UTF-8"
- name: Build release
run: |

View file

@ -1,3 +1,104 @@
## 2025-03-26 v6.6.11
- Исправлена передача габаритов при выгрузке заказов по агенту
## 2025-03-25 v6.6.10
- Исправлено некорректное изменение статуса оплаты отмененных заказов
## 2025-03-04 v6.6.9
- Исправлено обновление модуля
## 2025-03-03 v6.6.8
- Исправлена ошибка экспорта дополнительных свойств товаров
## 2025-02-04 v6.6.7
- Исправлена ошибка установки модуля на PHP 8.0
## 2025-01-29 v6.6.6
- Поддержка нулевой закупочной стоимости при генерации каталога
## 2025-01-28 v6.6.5
- Исправлена ошибка редактирования интеграционных доставок при активации опции передачи статусов интеграционных оплат
## 2025-01-27 v6.6.4
- Исправлено некорректное удаление признака применения промокода при изменении состава заказа в CRM
## 2025-01-14 v6.6.3
- Исправлены ошибки при обновлении модуля
## 2025-01-14 v6.6.2
- Исправлена выгрузка архива заказов при установке модуля
## 2024-12-17 v6.6.1
- Исправлены API методы по взаимодействию с пользовательскими полями и справочниками
## 2024-12-09 v6.6.0
- Добавлено динамическое изменение свойств товаров при настройке экспорта
## 2024-12-08 v6.5.39
- Исправлена поломка заказов с промокодом Maxma при включенной передаче корзины в CRM
## 2024-10-31 v6.5.38
- Исправлена выгрузка заказов через агент
## 2024-10-30 v6.5.37
- Исправлена подписка модуля на событие сохранения заказа
## 2024-10-24 v6.5.36
- Добавлена передача профилей доставки Официального модуля Почты России
## 2024-10-22 v6.5.35
- Исправлена подписка модуля на событие сохранения заказа
## 2024-10-21 v6.5.34
- Исправлена ошибка агента выгрузки изменений при наличии у заказа клиента без магазина
## 2024-10-14 v6.5.33
- Добавлена передача дополнительных параметров в GET запросах
## 2024-10-03 v6.5.32
- Исправлена подписка на событие создания заказа при обновлении
## 2024-09-23 v6.5.31
- Добавлено логирование ответа от API при неудачном создании заказа
## 2024-09-23 v6.5.30
- Добавлена передача контрагентов с типом ИП
## 2024-09-19 v6.5.29
- Исправлена подписка модуля на событие сохранения заказа
## 2024-09-11 v6.5.28
- Исправлен возврат на предыдущий статус в заказе Bitrix
## 2024-09-02 v.6.5.27
- Исправлена передача изменений по клиентам, отсутствующим в Bitrix
## 2024-08-26 v.6.5.26
- Исправлено удаление модуля
## 2024-08-12 v.6.5.25
- Улучшена генерация каталога с маркированными товарами
## 2024-08-06 v.6.5.24
- Добавлены переводы текста в программе лояльности
- Установка функционала программы лоялности перенесена в настройки модуля
## 2024-08-06 v.6.5.23
- Исправлена ошибка с присвоением externalId при добавлении товара в заказ как разные товарные позиции из CRM
## 2024-07-18 v.6.5.22
- Добавлена передача скидок на торговые позиции в брошенных корзинах
## 2024-07-15 v.6.5.21
- Добавлена передача поля link при выгрузке брошенных корзин
## 2024-06-20 v.6.5.20
- Рефакторинг настроек модуля
## 2024-06-14 v.6.5.19
- Исправление работы программы лояльности при использовании подтверждения списание бонусов по SMS
## 2024-06-05 v.6.5.18
- Добавлена возможность исправления даты регистрации клиентов в CRM

View file

@ -1508,7 +1508,7 @@ class ApiClient
}
return $this->client->makeRequest(
"/custom-fields/$entity/edit/{$customField['code']}",
"/custom-fields/$entity/{$customField['code']}/edit",
Client::METHOD_POST,
array('customField' => json_encode($customField))
);
@ -1591,7 +1591,7 @@ class ApiClient
}
return $this->client->makeRequest(
"/custom-fields/dictionaries/{$customDictionary['code']}/create",
"/custom-fields/dictionaries/create",
Client::METHOD_POST,
array('customDictionary' => json_encode($customDictionary))
);

View file

@ -221,6 +221,36 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
$this->customer->setSubscribe('N');
}
}
if (empty($this->dataCrm['externalId'])
&& (empty($this->dataCrm['firstName'])
|| empty($this->dataCrm['email']))
) {
$api = new RetailCrm\ApiClient(RetailcrmConfigProvider::getApiUrl(), RetailcrmConfigProvider::getApiKey());
$customerResponse = RCrmActions::apiMethod($api, 'customersGetById', __METHOD__, $this->dataCrm['id']);
if ($customerResponse instanceof RetailCrm\Response\ApiResponse
&& $customerResponse->isSuccessful()
&& !empty($customerResponse['customer'])
) {
$crmCustomer = $customerResponse['customer'];
if (empty($this->dataCrm['email'])
&& !empty($crmCustomer['email'])
) {
$email = $crmCustomer['email'];
$this->customer->setEmail($this->fromJSON($email));
$this->customer->setLogin($email);
}
if (empty($this->dataCrm['firstName'])
&& !empty($crmCustomer['firstName'])
) {
$this->customer->setName($this->fromJSON($crmCustomer['firstName']));
}
}
}
}
public function buildPassword()

View file

@ -11,6 +11,7 @@
namespace RetailCrm\Http;
use Intaro\RetailCrm\Component\Constants;
use RetailCrm\Exception\CurlException;
use RetailCrm\Exception\InvalidJsonException;
use RetailCrm\Response\ApiResponse;
@ -38,7 +39,7 @@ class Client
*
* @throws \InvalidArgumentException
*/
public function __construct($url, array $defaultParameters = array())
public function __construct($url, array $defaultParameters = [])
{
if (false === stripos($url, 'https://')) {
throw new \InvalidArgumentException(
@ -49,7 +50,7 @@ class Client
$this->url = $url;
$this->defaultParameters = $defaultParameters;
$this->retry = 0;
$this->curlErrors = array(
$this->curlErrors = [
CURLE_COULDNT_RESOLVE_PROXY,
CURLE_COULDNT_RESOLVE_HOST,
CURLE_COULDNT_CONNECT,
@ -57,8 +58,8 @@ class Client
CURLE_HTTP_POST_ERROR,
CURLE_SSL_CONNECT_ERROR,
CURLE_SEND_ERROR,
CURLE_RECV_ERROR
);
CURLE_RECV_ERROR,
];
}
/**
@ -79,9 +80,9 @@ class Client
public function makeRequest(
$path,
$method,
array $parameters = array()
array $parameters = []
) {
$allowedMethods = array(self::METHOD_GET, self::METHOD_POST);
$allowedMethods = [self::METHOD_GET, self::METHOD_POST];
if (!in_array($method, $allowedMethods, false)) {
throw new \InvalidArgumentException(
@ -93,7 +94,14 @@ class Client
);
}
$parameters = array_merge($this->defaultParameters, $parameters);
$parameters = self::METHOD_GET === $method
? array_merge($this->defaultParameters, $parameters, [
'cms_source' => 'Bitrix',
'cms_version' => SM_VERSION,
'php_version' => function_exists('phpversion') ? phpversion() : '',
'module_version' => Constants::MODULE_VERSION,
])
: $parameters = array_merge($this->defaultParameters, $parameters);
$url = $this->url . $path;
@ -122,7 +130,8 @@ class Client
curl_close($curlHandler);
if ($errno
if (
$errno
&& in_array($errno, $this->curlErrors, false)
&& $this->retry < 3
) {

View file

@ -266,8 +266,8 @@ class RCrmActions
if (is_array($failedIds) && !empty($failedIds)) {
RetailCrmOrder::uploadOrders(50, true);
}
return;
return 'RCrmActions::uploadOrdersAgent();';
}
/**
@ -290,7 +290,6 @@ class RCrmActions
RetailCrmHistory::customerHistory();
RetailCrmHistory::orderHistory();
self::uploadOrdersAgent();
} catch (\Throwable $exception) {
Logger::getInstance()->write(
'Fail orderAgent:' . PHP_EOL .

View file

@ -11,6 +11,8 @@
use Bitrix\Main\Context\Culture;
use Bitrix\Sale\Basket;
use Bitrix\Sale\Discount\Context\Fuser;
use Bitrix\Sale\Discount;
IncludeModuleLangFile(__FILE__);
@ -105,6 +107,7 @@ class RetailCrmCart
$date => date(self::$dateFormat),
'droppedAt' => date(self::$dateFormat),
'items' => $items,
'link' => static::generateCartLink(),
],
$site
);
@ -127,16 +130,39 @@ class RetailCrmCart
return null;
}
$arBasket = [
'LID' => $obBasket->getSiteId(),
];
$items = $obBasket->getBasket();
$arBasket = ['LID' => $obBasket->getSiteId()];
foreach ($items as $item) {
$arBasket['BASKET'][] = $item->getFields();
if (count($items) !== 0) {
$fUser = new Fuser($obBasket->getFUserId());
$discounts = Discount::buildFromBasket($obBasket, $fUser);
$discounts->calculate();
$resultBasket = $discounts->getApplyResult(true);
$basketItems = $resultBasket['PRICES']['BASKET'] ?? [];
foreach ($items as $item) {
$itemFields = $item->getFields()->getValues();
if (isset($basketItems[(int) $itemFields['ID']])) {
$itemFields['PRICE'] = $basketItems[(int) $itemFields['ID']]['PRICE'];
}
$arBasket['BASKET'][] = $itemFields;
}
}
return $arBasket;
}
public static function generateCartLink()
{
return sprintf(
'%s://%s/personal/cart',
!empty($_SERVER['HTTPS']) ? 'https' : 'http',
$_SERVER['HTTP_HOST']
);
}
}

View file

@ -449,7 +449,7 @@
"type": "double",
"default": 0,
"min": 0,
"decimals": 1
"decimals": 2
},
"code": {
"type": "string"

View file

@ -10,6 +10,7 @@
*/
use Bitrix\Main\Context\Culture;
use Bitrix\Main\Engine\CurrentUser;
use Intaro\RetailCrm\Component\Constants;
use Intaro\RetailCrm\Component\ServiceLocator;
use Intaro\RetailCrm\Repository\UserRepository;
@ -113,8 +114,6 @@ class RetailCrmEvent
public static function orderDelete($event)
{
$GLOBALS['RETAILCRM_ORDER_DELETE'] = true;
return;
}
/**
@ -130,7 +129,7 @@ class RetailCrmEvent
return;
}
$id = \Bitrix\Main\Engine\CurrentUser::get()->getId();
$id = CurrentUser::get()->getId();
if ($id) {
$arBasket = RetailCrmCart::getBasketArray($event);
@ -225,7 +224,7 @@ class RetailCrmEvent
//TODO эта управляющая конструкция по функционалу дублирует RetailCrmOrder::createCustomerForOrder.
// Необходимо устранить дублирование, вынеся логику в обособленный класс-сервис
if ('Y' === $optionCorpClient && $optionsContragentType[$arOrder['PERSON_TYPE_ID']] === 'legal-entity') {
if ('Y' === $optionCorpClient && in_array($optionsContragentType[$arOrder['PERSON_TYPE_ID']], ['legal-entity', 'enterpreneur'])) {
//corparate cliente
$nickName = '';
$address = '';

View file

@ -672,7 +672,7 @@ class RetailCrmHistory
$personType = $newOrder->getField('PERSON_TYPE_ID');
if (RetailCrmOrder::isOrderCorporate($order)
|| (!empty($order['contragentType']) && $order['contragentType'] == 'legal-entity')
|| (!empty($order['contragentType']) && in_array($order['contragentType'], ['legal-entity', 'enterpreneur']))
) {
$personType = $contragentTypes['legal-entity'];
$newOrder->setField('PERSON_TYPE_ID', $personType);
@ -1015,6 +1015,14 @@ class RetailCrmHistory
$order['site']
);
if (!$response) {
Logger::getInstance()->write(
sprintf('Заказ %s не выгружен. Не удалось получить клиента', $order['id']),
'orderAgent'
);
continue;
}
$newUser = new CUser();
$customerBuilder = new CustomerBuilder();
$customerBuilder->setDataCrm($response['customer'])->build();
@ -1091,7 +1099,7 @@ class RetailCrmHistory
$duplicateItems = [];
foreach ($orderTemp['items'] as $item) {
$duplicateItems[$item['id']]['externalId'] += $item['offer']['externalId'];
$duplicateItems[$item['id']]['externalId'] = $item['offer']['externalId'];
$duplicateItems[$item['id']]['quantity'] += $item['quantity'];
$duplicateItems[$item['id']]['discountTotal'] +=
$item['quantity'] * $item['discountTotal'];
@ -1218,7 +1226,6 @@ class RetailCrmHistory
}
if (array_key_exists('discountTotal_sum', $collectItems[$product['offer']['externalId']])) {
$item->setField('CUSTOM_PRICE', 'Y');
$item->setField('DISCOUNT_NAME', '');
$item->setField('DISCOUNT_VALUE', '');
@ -1232,6 +1239,7 @@ class RetailCrmHistory
$price = self::truncate($price, 2);
}
$item->markFieldCustom('PRICE');
$item->setField('PRICE', $price);
}
@ -1599,6 +1607,7 @@ class RetailCrmHistory
foreach ($orderHistory as $change) {
$change['order'] = self::removeEmpty($change['order']);
unset($change['order']['status']);
if ($change['order']['items']) {
$items = [];
@ -2053,7 +2062,7 @@ class RetailCrmHistory
$payment->delete();
}
if ($paymentsCrm['totalSumm'] == $paySumm) {
if ($paymentsCrm['totalSumm'] == $paySumm && $order->getField('CANCELED') !== 'Y') {
$order->setFieldNoDemand('PAYED', 'Y');
} else {
$order->setFieldNoDemand('PAYED', 'N');

View file

@ -10,6 +10,7 @@
*/
use Bitrix\Main\Context;
use Bitrix\Main\Type\DateTime;
use Bitrix\Main\Context\Culture;
use Bitrix\Main\UserTable;
use Bitrix\Sale\Delivery\Services\Manager;
@ -357,7 +358,7 @@ class RetailCrmOrder
$order['items'][] = $item;
if ($send && $dimensionsSetting === 'Y') {
if ($dimensionsSetting === 'Y') {
$dimensions = RCrmActions::unserializeArrayRecursive($product['DIMENSIONS']);
if ($dimensions !== false) {
@ -369,7 +370,7 @@ class RetailCrmOrder
}
}
if ($send && $dimensionsSetting === 'Y') {
if ($dimensionsSetting === 'Y') {
$order['width'] = $width;
$order['height'] = $height;
$order['length'] = $length;
@ -429,7 +430,7 @@ class RetailCrmOrder
return false;
}
}
if ('ordersEdit' === $methodApi) {
$order = RetailCrmService::unsetIntegrationDeliveryFields($order);
}
@ -472,6 +473,17 @@ class RetailCrmOrder
$crmBasket = RCrmActions::apiMethod($api, 'cartGet', __METHOD__, $externalId, $site);
$orderResponse = $client->createOrder($order, $site);
if ($orderResponse instanceof OrdersCreateResponse && !$orderResponse->success) {
Logger::getInstance()->write([
'methodApi' => 'orderCreate',
'errorMsg' => $orderResponse->errorMsg ?? '',
'errors' => $orderResponse->errors ?? '',
'params' => ['number' => $order['number'], 'externalId' => $order['externalId']]
], 'apiErrors');
}
if (!empty($crmBasket['cart']) && $orderResponse instanceof OrdersCreateResponse && !empty($orderResponse->id) ) {
RCrmActions::apiMethod(
$api,
@ -525,9 +537,11 @@ class RetailCrmOrder
$resCustomersAdded = [];
$resCustomersCorporate = [];
$orderIds = [];
$orderUpdateIds = [];
$lastUpOrderId = RetailcrmConfigProvider::getLastOrderId();
$failedIds = RetailcrmConfigProvider::getFailedOrdersIds();
$uploadMethod = RetailcrmConfigProvider::getOrderDischarge();
if ($failed == true && $failedIds !== false && count($failedIds) > 0) {
$orderIds = $failedIds;
@ -546,6 +560,22 @@ class RetailCrmOrder
}
}
if((int)$uploadMethod === 0) {
$dateOfLastUpdate = RetailcrmConfigProvider::getLastOrderUpdate();
$dbOrderUpdate = OrderTable::GetList([
'order' => ['ID' => 'ASC'],
'filter' => ['>DATE_UPDATE' => DateTime::createFromTimestamp(strtotime($dateOfLastUpdate))],
'limit' => $pSize,
'select' => ['ID'],
]);
while ($arOrderUpdate = $dbOrderUpdate->fetch()) {
$orderUpdateIds[] = $arOrderUpdate['ID'];
}
}
$orderIds = array_unique(array_merge($orderIds, $orderUpdateIds));
if (count($orderIds) <= 0) {
return false;
}
@ -577,6 +607,7 @@ class RetailCrmOrder
];
$recOrders = [];
$maxUpdateDate = $dateOfLastUpdate;
foreach ($orderIds as $orderId) {
$bitrixOrder = Order::load($orderId);
@ -587,6 +618,8 @@ class RetailCrmOrder
$arCustomer = [];
$arCustomerCorporate = [];
$methodApi = 'ordersCreate';
$order = self::orderObjToArr($bitrixOrder);
$site = self::getCrmShopCodeByLid($order['LID'], $arParams['optionsSitesList']);
@ -604,14 +637,30 @@ class RetailCrmOrder
continue;
}
self::createCustomerForOrder($api, $arCustomer, $arCustomerCorporate,$arParams, $order, $site);
if((int)$uploadMethod === 0) {
$orderCrm = RCrmActions::apiMethod($api, 'ordersGet', __METHOD__, $orderId, $site);
if (isset($orderCrm['order'])) {
$methodApi = 'ordersEdit';
$arParams['crmOrder'] = $orderCrm['order'];
}
}
if (isset($order['RESPONSIBLE_ID']) && !empty($order['RESPONSIBLE_ID'])) {
$managerService = ManagerService::getInstance();
$arParams['managerId'] = $managerService->getManagerCrmId((int) $order['RESPONSIBLE_ID']);
}
$arOrders = self::orderSend($order, $api, $arParams, false, $site,'ordersCreate');
if ($methodApi === 'ordersEdit') {
$updateDate = $bitrixOrder->getField('DATE_UPDATE')->format("Y-m-d H:i:s");
$maxUpdateDate = $updateDate > $maxUpdateDate ? $updateDate : $maxUpdateDate;
self::orderSend($order, $api, $arParams, true, $site);
continue;
}
self::createCustomerForOrder($api, $arCustomer, $arCustomerCorporate,$arParams, $order, $site);
$arOrders = self::orderSend($order, $api, $arParams, false, $site, $methodApi);
if (!$arCustomer || !$arOrders) {
continue;
@ -633,6 +682,8 @@ class RetailCrmOrder
$recOrders[] = $orderId;
}
RetailcrmConfigProvider::setLastOrderUpdate($maxUpdateDate);
if (count($ordersPack) > 0) {
if (false === RetailCrmOrder::uploadCustomersList($resCustomers, $api, $arParams['optionsSitesList'])) {
return false;
@ -714,7 +765,7 @@ class RetailCrmOrder
if (
'Y' === RetailcrmConfigProvider::getCorporateClientStatus()
&& $optionsContragentType[$order['PERSON_TYPE_ID']] === 'legal-entity'
&& in_array($optionsContragentType[$order['PERSON_TYPE_ID']], ['legal-entity', 'enterpreneur'])
) {
// TODO check if order is corporate, and if it IS - make corporate order
$arCustomer = RetailCrmUser::customerSend(
@ -728,7 +779,7 @@ class RetailCrmOrder
$arCustomerCorporate = RetailCrmCorporateClient::clientSend(
$order,
$api,
'legal-entity',
$optionsContragentType[$order['PERSON_TYPE_ID']],
false,
true,
$site
@ -774,7 +825,7 @@ class RetailCrmOrder
if (
isset($orderData['contragent']['contragentType'])
&& $orderData['contragent']['contragentType'] === 'legal-entity'
&& in_array($orderData['contragent']['contragentType'], ['legal-entity', 'enterpreneur'])
&& !empty($customerLegalName)
) {
if (isset($cachedCorporateIds[$customerLegalName])) {
@ -984,7 +1035,9 @@ class RetailCrmOrder
}
if ($delivery['PARENT_ID']) {
$service = explode(':', $delivery['CODE']);
$shipment = ['id' => $delivery['PARENT_ID'], 'service' => $service[1]];
$shipment = $delivery['CLASS_NAME'] === '\Sale\Handlers\Delivery\RussianpostProfile'
? ['id' => $delivery['PARENT_ID'], 'service' => 'bitrix-' . $delivery['ID']]
: ['id' => $delivery['PARENT_ID'], 'service' => $service[1]];
} else {
$shipment = ['id' => $delivery['ID']];
}

View file

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

View file

@ -38,7 +38,8 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/retailcrm/exp
}
}
$settingService = SettingsService::getInstance([], '');
global $PROFILE_ID;
$settingService = SettingsService::getInstance([], '', $PROFILE_ID ?? $profile_id);
$iblockPropertySku = [];
$iblockPropertySkuHl = [];
$iblockPropertyUnitSku = [];
@ -46,7 +47,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/retailcrm/exp
$iblockPropertyProductHl = [];
$iblockPropertyUnitProduct = [];
foreach (array_keys($settingService->actrualPropList) as $prop) {
foreach (array_keys($settingService->actualPropList) as $prop) {
$skuUnitProps = ('iblockPropertyUnitSku_' . $prop);
$skuUnitProps = $$skuUnitProps;

View file

@ -26,7 +26,8 @@ CModule::IncludeModule('intaro.retailcrm');
//TODO заменить вызов на сервис-локатор, когда он приедет
$settingsService = SettingsService::getInstance(
$arOldSetupVars ?? [],
$ACTION
$ACTION,
$PROFILE_ID
);
$isSetupModulePage = $settingsService->isSetupModulePage();
@ -110,7 +111,7 @@ if ($STEP === 1) {
}
</style>
<form method="post" action="<?=$APPLICATION->GetCurPage()?>">
<form method="post" id="submit-form" action="<?=$APPLICATION->GetCurPage()?>">
<?php
if ($ACTION === 'EXPORT_EDIT' || $ACTION === 'EXPORT_COPY') {
?>
@ -190,8 +191,7 @@ if ($STEP === 1) {
<tbody>
<?php
foreach ($settingsService->actrualPropList as $propertyKey => $property) {
$productSelected = false; ?>
foreach ($settingsService->defaultPropList as $propertyKey => $property) { ?>
<tr class="adm-list-table-row">
<td class="adm-list-table-cell">
@ -215,14 +215,14 @@ if ($STEP === 1) {
if ($keyField === $propertyKey) { ?>
<option value="<?=$field['CODE']?>"
<?php
$productSelected = $settingsService->isOptionSelected(
$isSelected = $settingsService->isOptionSelected(
$field,
$arIBlock['OLD_PROPERTY_PRODUCT_SELECT'],
$propertyKey
);
?>
<?= $productSelected ? ' selected' : ''?>
<?= $isSelected ? ' selected' : ''?>
>
<?=$field['name']?>
</option>
@ -241,7 +241,7 @@ if ($STEP === 1) {
<?php
echo $settingsService->getOptionClass($prop, true);
$productSelected = $settingsService->isOptionSelected(
$isSelected = $settingsService->isOptionSelected(
$prop,
$arIBlock['OLD_PROPERTY_PRODUCT_SELECT'],
$propertyKey
@ -251,7 +251,7 @@ if ($STEP === 1) {
= $settingsService->getHlTableName($prop)
?? $productHlTableName;
echo $productSelected ? ' selected' : '';
echo $isSelected ? ' selected' : '';
?>
>
<?=$prop['NAME']?>
@ -376,19 +376,18 @@ if ($STEP === 1) {
<option value="<?=$prop['CODE']?>"
<?php
echo $settingsService->getOptionClass($prop, false);
if (!$productSelected) {
$isSelected = $settingsService->isOptionSelected(
$prop,
$arIBlock['OLD_PROPERTY_SKU_SELECT'],
$propertyKey
);
$skuHlTableName
= $settingsService->getHlTableName($prop)
?? $skuHlTableName;
$isSelected = $settingsService->isOptionSelected(
$prop,
$arIBlock['OLD_PROPERTY_SKU_SELECT'],
$propertyKey
);
echo $isSelected ? ' selected' : '';
}
$skuHlTableName
= $settingsService->getHlTableName($prop)
?? $skuHlTableName;
echo $isSelected ? ' selected' : '';
?>
>
<?=$prop['NAME']?>
@ -473,9 +472,97 @@ if ($STEP === 1) {
</tr>
<?php
} ?>
<?php
$catalogId = $arIBlock['ID'];
$catalogCustomProps = $settingsService->customPropList[$catalogId];
if (!empty($catalogCustomProps)) {
foreach ($catalogCustomProps as $catalogCustomPropCode => $catalogCustomPropValue) { ?>
<tr class="adm-list-table-row custom-property-row">
<td class="adm-list-table-cell custom-property-title">
<?=htmlspecialcharsex($catalogCustomPropValue)?>
</td>
<td class="adm-list-table-cell">
<select
name="iblockPropertyProduct_<?=$catalogCustomPropCode?>[<?= $catalogId ?>]"
id="iblockPropertyProduct_<?=$catalogCustomPropCode . $catalogId ?>"
class="property-export"
data-type="<?= $catalogCustomPropCode ?>"
onchange="propertyChange(this)"
style="width: 200px">
<option value=""></option>
<?php foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop) {
$productHlTableName = ''; ?>
<option value="<?=$prop['CODE']?>"
<?php
echo $settingsService->getOptionClass($prop, true);
$isSelected = $settingsService->isOptionSelected(
$prop,
$arIBlock['OLD_PROPERTY_PRODUCT_SELECT'],
$catalogCustomPropCode
);
$productHlTableName
= $settingsService->getHlTableName($prop)
?? $productHlTableName;
echo $isSelected ? ' selected' : '';
?>
>
<?=$prop['NAME']?>
</option>
<?php } ?>
</select>
</td>
<?php if ($arIBlock['PROPERTIES_SKU'] !== null) { ?>
<td class="adm-list-table-cell">
<select
name="iblockPropertySku_<?=$catalogCustomPropCode?>[<?= $catalogId ?>]"
id="iblockPropertySku_<?=$catalogCustomPropCode . $catalogId ?>"
class="property-export"
data-type="<?= $catalogCustomPropCode ?>"
onchange="propertyChange(this)"
style="width: 200px">
<option value=""></option>
<?php foreach ($arIBlock['PROPERTIES_SKU'] as $prop) {
$skuHlTableName = ''; ?>
<option value="<?=$prop['CODE']?>"
<?php
echo $settingsService->getOptionClass($prop, false);
$isSelected = $settingsService->isOptionSelected(
$prop,
$arIBlock['OLD_PROPERTY_SKU_SELECT'],
$catalogCustomPropCode
);
$skuHlTableName
= $settingsService->getHlTableName($prop)
?? $skuHlTableName;
echo $isSelected ? ' selected' : '';
?>
>
<?=$prop['NAME']?>
</option>
<?php } ?>
</select>
<button id="delete-custom-row" class="adm-btn-save" type="button" style="margin-left: 10px"><?= GetMessage('DELETE_PROPERTY');?></button>
</td>
<?php } ?>
</tr>
<?php }
}
?>
</tbody>
</table>
<br>
<button class="adm-btn-save add-custom-row" type="button" style="margin-top: 20px;"><?= GetMessage('ADD_PROPERTY');?></button>
<br>
</div>
</div>
@ -484,6 +571,20 @@ if ($STEP === 1) {
</div>
<input type="hidden" name="count_checked" id="count_checked" value="<?=$intCountChecked?>">
<br>
<template id="custom-property-template-row">
<tr class="adm-list-table-row custom-property-row">
<td class="adm-list-table-cell">
<input type="text" title="Название нового свойства" name="custom-property-title" style="width: 200px">
</td>
<td class="adm-list-table-cell">
<select name="iblockPropertyProduct_" id="iblockPropertyProduct_" class="property-export" onchange="propertyChange(this)" style="width: 200px"></select>
</td>
<td class="adm-list-table-cell">
<select name="iblockPropertySku_" id="iiblockPropertySku_" class="property-export" onchange="propertyChange(this)" style="width: 200px"></select>
<button id="delete-new-custom-row" class="adm-btn-save" type="button" style="margin-left: 10px"><?= GetMessage('DELETE_PROPERTY');?></button>
</td>
</tr>
</template>
<h3><?=GetMessage('SETTINGS_EXPORT')?></h3>
<span class="text"><?=GetMessage('FILENAME')?><br><br></span>
<input type="text" name="SETUP_FILE_NAME" value="<?=htmlspecialcharsbx(strlen($SETUP_FILE_NAME) > 0 ?
@ -566,7 +667,7 @@ if ($STEP === 1) {
<input type="hidden" name="STEP" value="<?=$STEP + 1?>">
<input type="hidden" name="SETUP_FIELDS_LIST" value="<?=
$settingsService->getSetupFieldsString(
array_keys($settingsService->actrualPropList) ?? [],
array_keys($settingsService->actualPropList) ?? [],
$hlblockModule === true,
$hlBlockList ?? []
)
@ -577,8 +678,109 @@ if ($STEP === 1) {
</form>
<?php CJSCore::Init(['jquery']);?>
<?php CUtil::InitJSCore(['intaro_custom_props']); ?>
<script type="text/javascript">
BX.ready(function() {
if (typeof createCustomPropsRaw !== 'function') {
$('.add-custom-row').hide();
}
});
$('.add-custom-row').click(function () {
if (typeof createCustomPropsRaw === 'function') {
createCustomPropsRaw($(this));
}
});
$(document).on('click', '#delete-new-custom-row', function () {
if (typeof deleteCustomPropRow === 'function') {
deleteCustomPropRow($(this));
}
});
$(document).on('click', '#delete-custom-row', function () {
let buttonElem = $(this);
if (typeof addCustomPropToDelete === 'function' && typeof deleteCustomPropRow === 'function') {
addCustomPropToDelete(buttonElem);
deleteCustomPropRow(buttonElem);
}
});
$(document).on('blur', 'input[name="custom-property-title"]', function () {
if (typeof getUniquePropertyCode === 'function' && typeof addCustomPropCodeToSelectAttributes === 'function') {
let inputElem = $(this);
let newPropertyTitle = inputElem.val();
if (!newPropertyTitle) {
return;
}
let newPropertyCode = getUniquePropertyCode(newPropertyTitle);
addCustomPropCodeToSelectAttributes(newPropertyCode, inputElem);
}
});
$('#submit-form').submit(function (formEvent) {
if (typeof setCustomProperties !== "function") {
return;
}
formEvent.preventDefault();
let savePromise = null;
let deletePromise = null;
let formElem = formEvent.currentTarget;
let profileId = $($('input[name="PROFILE_ID"]')).val();
setCustomProperties();
if (Object.keys(customProps).length > 0) {
savePromise = BX.ajax.runAction('intaro:retailcrm.api.customexportprops.save', {
json: {
properties: customProps,
profileId: profileId
},
}).then(addParamsToSetupFieldsList());
}
if (Object.keys(customPropsToDelete).length > 0) {
deletePromise = BX.ajax.runAction('intaro:retailcrm.api.customexportprops.delete', {
json: {
properties: customPropsToDelete,
profileId: profileId
},
}).then(deleteParamsFromSetupFieldsList());
}
const promises = [savePromise, deletePromise].filter(Boolean);
if (promises.length > 0) {
Promise.all(promises)
.finally(() => {
formElem.submit();
});
} else {
formElem.submit();
}
});
const setupFieldsListElement = $('input[name="SETUP_FIELDS_LIST"]');
let customProps = {};
let customPropsToDelete = {};
const setupFieldsParamsToFill = [
'iblockPropertySku_',
'iblockPropertyUnitSku_',
'iblockPropertyProduct_',
'iblockPropertyUnitProduct_',
'highloadblockb_hlsys_marking_code_group_',
'highloadblock_productb_hlsys_marking_code_group_',
'highloadblockeshop_color_reference_',
'highloadblock_producteshop_color_reference_',
'highloadblockeshop_brand_reference_',
'highloadblock_producteshop_brand_reference_'
];
function checkLoadStatus(object)
{
if (object.checked) {

View file

@ -50,6 +50,10 @@ $arJsConfig = [
'js' => '/bitrix/js/intaro/sms.js',
'rel' => [],
],
'intaro_custom_props' => [
'js' => '/bitrix/js/intaro/export/custom-props-export.js',
'rel' => [],
],
];
foreach ($arJsConfig as $ext => $arExt) {

View file

@ -0,0 +1,228 @@
function deleteCustomPropRow(deleteButton)
{
deleteButton.closest('tr').remove();
}
function addCustomPropToDelete(deleteButton)
{
let deletedPropTitle = deleteButton.closest('td').siblings().filter('.custom-property-title').text().trim();
let deletedPropCode = deleteButton.siblings().filter('select').first().data('type');
let customPropCatalogId = deleteButton.closest('.iblockExportTable').data('type');
let values = {
'code': deletedPropCode,
'title': deletedPropTitle,
};
if (customPropsToDelete.hasOwnProperty(customPropCatalogId)) {
customPropsToDelete[customPropCatalogId].push(values);
} else {
customPropsToDelete[customPropCatalogId] = [values];
}
}
function addCustomPropCodeToSelectAttributes(customPropCode, customPropTitleElem)
{
let selectElements = customPropTitleElem.closest('.custom-property-row').find('td select');
let catalogId = customPropTitleElem.closest('.iblockExportTable').data('type');
selectElements.each(function (index, element) {
let selectElem = $(element);
let newSelectIdValue = selectElem.attr('id').match(/^[^_]*_/)[0] + customPropCode + catalogId;
let newSelectNameValue = selectElem.attr('name').match(/^[^_]*_/)[0] + customPropCode + `[${catalogId}]`;
selectElem.attr('id', newSelectIdValue);
selectElem.attr('name', newSelectNameValue);
selectElem.data('type', customPropCode);
triggerSelectChange(selectElem);
});
}
function triggerSelectChange(selectElem)
{
if (selectElem.val().length > 0) {
selectElem.trigger('change', [self]);
}
}
function setCustomProperties()
{
let customPropertiesRows = $('.custom-property-row');
if (customPropertiesRows.length === 0) {
return;
}
let customPropertyCatalogId;
let customPropertyTitle = '';
let customPropertyCode = '';
let productPropertyMatch = '';
let offerPropertyMatch = '';
let catalogIds = [];
customPropertiesRows.each(function (index, propertyRow) {
let propertyRowObj = $(propertyRow);
customPropertyCatalogId = propertyRowObj.closest('.iblockExportTable').data('type');
customPropertyTitle = propertyRowObj.find('input[name="custom-property-title"]').val();
if (!customPropertyTitle) {
return true;
}
customPropertyCode = getUniquePropertyCode(customPropertyTitle);
productPropertyMatch = propertyRowObj.find('select[name=custom-product-property-select]').val();
offerPropertyMatch = propertyRowObj.find('select[name=custom-offer-property-select]').val();
let values = {
'title': customPropertyTitle,
'code': customPropertyCode,
'productProperty': productPropertyMatch,
'offerProperty': offerPropertyMatch
};
if (catalogIds.indexOf(customPropertyCatalogId) === -1) {
customProps[customPropertyCatalogId] = [values];
} else {
customProps[customPropertyCatalogId].push(values);
}
catalogIds.push(customPropertyCatalogId);
});
}
function getUniquePropertyCode(customPropertyTitle)
{
let uniqueValue = transliterate(customPropertyTitle).replace(/ /g, '_');
let counter = 0;
const setupFieldsListValues = setupFieldsListElement.val().split(',');
while (setupFieldsListValues.includes(uniqueValue)) {
uniqueValue = `${customPropertyTitle}${++counter}`;
}
return uniqueValue;
}
function addParamsToSetupFieldsList()
{
let newParams = '';
if (Object.keys(customProps).length === 0) {
return;
}
for (let propertiesByCatalogId of Object.values(customProps)) {
propertiesByCatalogId.forEach(function (values) {
setupFieldsParamsToFill.forEach(function (param) {
newParams += ',' + param + values.code;
});
});
}
let newValue = setupFieldsListElement.val() + newParams;
setupFieldsListElement.val(newValue);
return true;
}
function deleteParamsFromSetupFieldsList()
{
let setupFields = setupFieldsListElement.val();
if (Object.keys(customPropsToDelete).length === 0) {
return;
}
for (let propsByCatalogId of Object.values(customPropsToDelete)) {
propsByCatalogId.forEach(function (propValues) {
setupFieldsParamsToFill.forEach(function (param) {
let paramToDelete = ',' + param + propValues.code;
setupFields = setupFields.replace(paramToDelete, '');
});
});
}
setupFieldsListElement.val(setupFields);
return true;
}
function createCustomPropsRaw(addRowButton)
{
let templateRow = $($('#custom-property-template-row').html());
let templateSelectElements = templateRow.find('select');
let prevTableRow = $(addRowButton).prev('table').find('tbody tr:last-child');
let lastRawSelectElements = prevTableRow.find('td select');
lastRawSelectElements.each(function (index, element) {
let selectElement = $(element);
let templateSelectElement = templateSelectElements[index];
fillTemplateSelect(selectElement, templateSelectElement);
prevTableRow.after(templateRow);
});
}
function fillTemplateSelect(sourceSelectElement, templateSelectElement)
{
let selectOptions = sourceSelectElement.find('option');
selectOptions.each(function (index, element) {
let optionElem = $(element);
let value = $(optionElem).val();
let text = $(optionElem).text();
$('<option>', { value: value, text: text }).appendTo(templateSelectElement);
});
}
function transliterate(titleToTransliterate)
{
const hasCyrillicChars = /[\u0400-\u04FF]/.test(titleToTransliterate);
if (!hasCyrillicChars) {
return titleToTransliterate;
}
translitedText = '';
for (var i = 0; i < titleToTransliterate.length; i++) {
switch (titleToTransliterate[i]) {
case 'а': case 'А': translitedText += 'a'; break;
case 'б': case 'Б': translitedText += 'b'; break;
case 'в': case 'В': translitedText += 'v'; break;
case 'г': case 'Г': translitedText += 'g'; break;
case 'д': case 'Д': translitedText += 'd'; break;
case 'е': case 'Е': translitedText += 'e'; break;
case 'ё': case 'Ё': translitedText += 'yo'; break;
case 'ж': case 'Ж': translitedText += 'zh'; break;
case 'з': case 'З': translitedText += 'z'; break;
case 'и': case 'И': translitedText += 'i'; break;
case 'й': case 'Й': translitedText += 'y'; break;
case 'к': case 'К': translitedText += 'k'; break;
case 'л': case 'Л': translitedText += 'l'; break;
case 'м': case 'М': translitedText += 'm'; break;
case 'н': case 'Н': translitedText += 'n'; break;
case 'о': case 'О': translitedText += 'o'; break;
case 'п': case 'П': translitedText += 'p'; break;
case 'р': case 'Р': translitedText += 'r'; break;
case 'с': case 'С': translitedText += 's'; break;
case 'т': case 'Т': translitedText += 't'; break;
case 'у': case 'У': translitedText += 'u'; break;
case 'ф': case 'Ф': translitedText += 'f'; break;
case 'х': case 'Х': translitedText += 'h'; break;
case 'ц': case 'Ц': translitedText += 'c'; break;
case 'ч': case 'Ч': translitedText += 'ch'; break;
case 'ш': case 'Ш': translitedText += 'sh'; break;
case 'щ': case 'Щ': translitedText += 'sch'; break;
case 'ъ': case 'Ъ': translitedText += ''; break;
case 'ы': case 'Ы': translitedText += 'y'; break;
case 'ь': case 'Ь': translitedText += ''; break;
case 'э': case 'Э': translitedText += 'e'; break;
case 'ю': case 'Ю': translitedText += 'yu'; break;
case 'я': case 'Я': translitedText += 'ya'; break;
default: translitedText += titleToTransliterate[i]; break;
}
}
return translitedText;
}

View file

@ -0,0 +1,2 @@
<?php
$MESS ['USER_PROPERTY_NAME'] = "Name of the custom property block";

View file

@ -0,0 +1,29 @@
<?php
$MESS["main_register_sms"] = "Confirmation code from SMS:";
$MESS["PERSONAL_PHONE"] = "Phone";
$MESS["main_register_sms_send"] = "Send";
$MESS["UF_REG_IN_PL_INTARO"] = "Register in loyalty program";
$MESS["UF_AGREE_PL_INTARO"] = "loyalty programs:";
$MESS["I_AM_AGREE"] = "I agree to the terms and conditions";
$MESS["UF_PD_PROC_PL_INTARO"] = "personal data processing:";
$MESS["LP_CARD_NUMBER"] = "Loyalty program card number";
$MESS["SEND"] = "Send";
$MESS["TRY_AGAIN"] = "Try Again";
$MESS["VERIFICATION_CODE"] = "Confirmation Code";
$MESS["SEND_VERIFICATION_CODE"] = "Send confirmation code";
$MESS["REG_LP_MESSAGE"] = "Enter your phone number and loyalty program card number to complete your loyalty program registration.";
$MESS["YES"] = "Yes";
$MESS["BONUS_CARD_NUMBER"] = "Loyalty card number (if any):";
$MESS["SUCCESS_PL_REG"] = "You have successfully registered in the loyalty program.";
$MESS["LP_FIELDS_NOT_EXIST"] = "PL module installation error. UF fields for USER are missing.";
$MESS["REG_LP_ERROR"] = "Error of registration in the Loyalty Program";
$MESS["REGISTER_CONTINUE"] = "Fill out the form to complete your registration in the loyalty program.";
$MESS["UF_CARD_NUM_INTARO"] = "Loyalty card number (if any)";
$MESS["REGISTER_LP_TITLE"] = "Registration in the loyalty program";
$MESS["NOT_AUTHORIZED"] = "You are not logged in. To register, please follow the <a href=\"./lp-register\">link</a>";
$MESS["LP_NOT_ACTIVE"] = "Loyalty program is not active at the moment";
$MESS["SEC"] = "seconds";
$MESS["RESEND_SMS"] = "Send sms again";
$MESS["RESEND_POSSIBLE"] = "It is possible to resend sms via";
$MESS["LOYALTY_CONNECTION_ERROR"] = "There are problems connecting to the remote server. Try reloading the page.";
$MESS ["NO_VALID_EMAIL"] = "Check that your email is filled in correctly";

View file

@ -26,3 +26,4 @@ $MESS["SEC"] = "сек.";
$MESS["RESEND_SMS"] = "Отправить смс повторно";
$MESS["RESEND_POSSIBLE"] = "Повторная отправка смс возможна через";
$MESS["LOYALTY_CONNECTION_ERROR"] = "Возникли проблемы с подключением к удаленному серверу. Попробуйте перезагрузить страницу.";
$MESS ["NO_VALID_EMAIL"] = "Проверьте правильность заполнения email";

View file

@ -67,7 +67,7 @@ function activateAccount() {
)
if (emailViolation) {
$('#errMsg').text('Проверьте правильность заполнения email')
$('#errMsg').text(BX.message("NO_VALID_EMAIL"));
return;
}

View file

@ -0,0 +1,4 @@
<?php
$MESS ['COMP_MAIN_USER_SCORE_TITLE'] = "Personal cabinet of the RetailCRM loyalty program";
$MESS ['COMP_MAIN_USER_SCORE_DESCR'] = "Personal cabinet of the RetailCRM loyalty program participant";
$MESS ['MAIN_USER_GROUP_NAME'] = "User";

View file

@ -0,0 +1,11 @@
<?php
$MESS ['NOT_AUTHORIZED'] = 'You are not authorized on the site';
$MESS['YES'] = 'Yes';
$MESS['NO'] = 'No';
$MESS['CARD_NOT_LINKED'] = 'Card is not linked';
$MESS['TOP_LEVEL'] = 'you have reached the highest privilege level!';
$MESS['ERRORS'] = 'An error has been detected: ';
$MESS['LP_NOT_ACTUAL'] = 'Your membership ID was not detected in the loyalty program.';
$MESS['LOYALTY_CONNECTION_ERROR'] = 'There was a problem connecting to the remote server. Please reload the page.';
$MESS['MODULE_NOT_INSTALL'] = 'Loyalty program is unavailable. Probably, the module of integration with RetailCRM is not installed';

View file

@ -0,0 +1,2 @@
<?php
$MESS ['USER_PROPERTY_NAME'] = "Name of the custom property block";

View file

@ -0,0 +1,43 @@
<?php
$MESS['main_register_sms'] = 'Confirmation code from SMS:';
$MESS['PERSONAL_PHONE'] = 'Phone';
$MESS['main_register_sms_send'] = 'Send';
$MESS['UF_REG_IN_PL_INTARO'] = 'Register in loyalty program';
$MESS['UF_AGREE_PL_INTARO'] = 'loyalty program:';
$MESS['I_AM_AGREE'] = 'I agree to the terms and conditions';
$MESS['UF_PD_PROC_PL_INTARO'] = 'processing of personal data:';
$MESS['LP_CARD_NUMBER'] = 'Loyalty program card number';
$MESS['SEND'] = 'Send';
$MESS['VERIFICATION_CODE'] = 'Confirmation Code';
$MESS['SEND_VERIFICATION_CODE'] = 'Send Confirmation Code';
$MESS['REG_LP_MESSAGE'] = 'Enter your phone number and loyalty program card number to complete your loyalty program registration';
$MESS['YES'] = 'Yes';
$MESS['BONUS_CARD_NUMBER'] = 'Loyalty card number (if any):';
$MESS['SUCCESS_PL_REG'] = 'You have successfully registered in the loyalty program.';
$MESS['LP_FIELDS_NOT_EXIST'] = 'PL module installation error. UF fields for USER are missing';
$MESS['REG_LP_ERROR'] = 'Error of registration in the Loyalty Program';
$MESS['REGISTER_CONTINUE'] = 'Fill in the form to complete registration in the Loyalty Program.';
$MESS['UF_CARD_NUM_INTARO'] = 'Loyalty card number (if any)';
$MESS['REGISTER_LP_TITLE'] = 'Registration in the loyalty program';
$MESS['LOYALTY_LEVEL_ID'] = 'Participation ID';
$MESS['ACTIVE'] = 'Account Activity';
$MESS['LOYALTY_LEVEL_NAME'] = 'Current level name:';
$MESS['ORDERS_SUM'] = 'All-time purchase amount:';
$MESS['NEXT_LEVEL_SUM'] = 'Amount of purchases required to advance to the next level:';
$MESS['BONUS_COUNT'] = 'Bonuses on account:';
$MESS['CARD'] = 'Bonus card number:';
$MESS['PHONE'] = 'Phone number assigned:';
$MESS['REGISTER_DATE'] = 'Registration date:';
$MESS['LOYALTY_LEVEL_TYPE'] = 'Current level rules:';
$MESS['BONUS_PERCENT'] = 'Cashback from value';
$MESS['BONUS_CONVERTING'] = '1 bonus is awarded for every';
$MESS['PERSONAL_DISCOUNT'] = 'personalized discount';
$MESS['EACH_RUB'] = 'purchase rubles';
$MESS['SIMPLE_PRODUCTS'] = 'Common items:';
$MESS['SALE_PRODUCTS'] = 'Promotional items:';
$MESS['REMAINING_SUM'] = 'Amount remaining before moving to the next level:';
$MESS['ACTIVATE'] = 'Activate';
$MESS['STATUS'] = 'Participation Status';
$MESS['STATUS_NOT_CONFIRMED'] = 'not confirmed';
$MESS['STATUS_DEACTIVATED'] = 'deactivated';
$MESS['STATUS_ACTIVE'] = 'active';

View file

@ -0,0 +1,3 @@
<?
$MESS ['USER_PROPERTY_NAME'] = "Name of the custom property block";
?>

View file

@ -0,0 +1,3 @@
<?php
$MESS ['INTARO_NOT_INSTALLED'] = "Integration module with RetailCRM is not installed";

View file

@ -0,0 +1,85 @@
<?php
$MESS["AUTH_REGISTER"] = "Registration";
$MESS["REGISTER_CAPTCHA_TITLE"] = "Protection against automatic registration";
$MESS["REGISTER_CAPTCHA_PROMT"] = "Enter the word in the picture";
$MESS["AUTH_REQ"] = "Required fields.";
$MESS["USER_DONT_KNOW"] = "(unknown)";
$MESS["USER_MALE"] = "Male";
$MESS["USER_FEMALE"] = "Female";
$MESS["REGISTER_FIELD_LOGIN"] = "Login (min. 3 characters)";
$MESS["REGISTER_FIELD_EMAIL"] = "Email";
$MESS["REGISTER_FIELD_PASSWORD"] = "Password";
$MESS["REGISTER_FIELD_CONFIRM_PASSWORD"] = "Confirm Password";
$MESS["REGISTER_FIELD_TITLE"] = "Address";
$MESS["REGISTER_FIELD_NAME"] = "Name";
$MESS["REGISTER_FIELD_SECOND_NAME"] = "Patronymic";
$MESS["REGISTER_FIELD_LAST_NAME"] = "Last Name";
$MESS["REGISTER_FIELD_AUTO_TIME_ZONE"] = "Time Zone";
$MESS["REGISTER_FIELD_PERSONAL_PROFESSION"] = "Profession";
$MESS["REGISTER_FIELD_PERSONAL_WWW"] = "WWW page";
$MESS["REGISTER_FIELD_PERSONAL_ICQ"] = "ICQ";
$MESS["REGISTER_FIELD_PERSONAL_GENDER"] = "gender";
$MESS["REGISTER_FIELD_PERSONAL_BIRTHDAY"] = "Date of birth";
$MESS["REGISTER_FIELD_PERSONAL_PHOTO"] = "Photo";
$MESS["REGISTER_FIELD_PERSONAL_PHONE"] = "Phone";
$MESS["PERSONAL_PHONE"] = "Phone";
$MESS["REGISTER_FIELD_PERSONAL_FAX"] = "Fax";
$MESS["REGISTER_FIELD_PERSONAL_MOBILE"] = "Mobile";
$MESS["REGISTER_FIELD_PERSONAL_PAGER"] = "Pager";
$MESS["REGISTER_FIELD_PERSONAL_STREET"] = "Street, house";
$MESS["REGISTER_FIELD_PERSONAL_MAILBOX"] = "Mailbox";
$MESS["REGISTER_FIELD_PERSONAL_CITY"] = "City";
$MESS["REGISTER_FIELD_PERSONAL_STATE"] = "Region / Province";
$MESS["REGISTER_FIELD_PERSONAL_ZIP"] = "Zip Code";
$MESS["REGISTER_FIELD_PERSONAL_COUNTRY"] = "Country";
$MESS["REGISTER_FIELD_PERSONAL_NOTES"] = "Additional Notes";
$MESS["REGISTER_FIELD_WORK_COMPANY"] = "Company Name";
$MESS["REGISTER_FIELD_WORK_DEPARTMENT"] = "Department / Division";
$MESS["REGISTER_FIELD_WORK_POSITION"] = "Position";
$MESS["REGISTER_FIELD_WORK_WWW"] = "WWW page (job)";
$MESS["REGISTER_FIELD_WORK_PHONE"] = "Phone (job)";
$MESS["REGISTER_FIELD_WORK_FAX"] = "Fax (job)";
$MESS["REGISTER_FIELD_WORK_PAGER"] = "Pager (job)";
$MESS["REGISTER_FIELD_WORK_STREET"] = "Street, house (job)";
$MESS["REGISTER_FIELD_WORK_MAILBOX"] = "Mailbox (job)";
$MESS["REGISTER_FIELD_WORK_CITY"] = "City (job)";
$MESS["REGISTER_FIELD_WORK_STATE"] = "Region / Region (job)";
$MESS["REGISTER_FIELD_WORK_ZIP"] = "Postal code (job)";
$MESS["REGISTER_FIELD_WORK_COUNTRY"] = "Country (job)";
$MESS["REGISTER_FIELD_WORK_PROFILE"] = "Line of Business";
$MESS["REGISTER_FIELD_WORK_LOGO"] = "Company Logo";
$MESS["REGISTER_FIELD_WORK_NOTES"] = "Additional notes (job)";
$MESS["REGISTER_FIELD_PHONE_NUMBER"] = "Phone Number";
$MESS["REGISTER_EMAIL_WILL_BE_SENT"] = "A registration confirmation request will be sent to the email specified in the form.";
$MESS["MAIN_REGISTER_AUTH"] = "You are registered on the site and successfully authorized.";
$MESS["main_profile_time_zones_auto"] = "Automatically detect the time zone:";
$MESS["main_profile_time_zones_auto_def"] = "(default)";
$MESS["main_profile_time_zones_auto_yes"] = "Yes, detect by browser.";
$MESS["main_profile_time_zones_auto_no"] = "No, select from list";
$MESS["main_profile_time_zones_zones"] = "Time zone:";
$MESS["AUTH_SECURE_NOTE"] = "Before submitting the form, the password will be encrypted in the browser. This will prevent the password from being transmitted in the clear.";
$MESS["AUTH_NONSECURE_NOTE"] = "The password will be sent in plaintext. Enable JavaScript in your browser to encrypt the password before sending it.";
$MESS["main_register_sms"] = "Confirmation code from SMS:";
$MESS["main_register_sms_send"] = "Send";
$MESS["UF_REG_IN_PL_INTARO"] = "Register in loyalty program.";
$MESS["UF_AGREE_PL_INTARO"] = "loyalty programs:";
$MESS["I_AM_AGREE"] = "I agree to the terms and conditions";
$MESS["UF_PD_PROC_PL_INTARO"] = "personal data processing:";
$MESS["LP_CARD_NUMBER"] = "Loyalty program card number";
$MESS["SEND"] = "Send";
$MESS["VERIFICATION_CODE"] = "Confirmation Code";
$MESS["SEND_VERIFICATION_CODE"] = "Send confirmation code";
$MESS["REG_LP_MESSAGE"] = "Enter your phone number and loyalty program card number to complete your loyalty program registration.";
$MESS["YES"] = "Yes";
$MESS["BONUS_CARD_NUMBER"] = "Loyalty card number (if any):";
$MESS["SUCCESS_PL_REG"] = "You have successfully registered in the loyalty program.";
$MESS["LP_FIELDS_NOT_EXIST"] = "Ошибка установки модуля ПЛ. Отсутствуют UF поля для USER";
$MESS["REG_LP_ERROR"] = "Ошибка регистрации в Программе лояльности";
$MESS["REGISTER_CONTINUE"] = "Для завершения регистрации в программе лояльности заполните форму.";
$MESS["UF_CARD_NUM_INTARO"] = "Loyalty card number (if any).";
$MESS["SEC"] = "sec.";
$MESS["RESEND_SMS"] = "Resend SMS";
$MESS["RESEND_POSSIBLE"] = "It is possible to resend sms in";
$MESS["LOYALTY_CONNECTION_ERROR"] = "There are problems with connection to the remote server. Try reloading the page.";
$MESS['SUBSCRIBE_EMAIL'] = "I agree to receive promotional and informational emails.";
$MESS['NO_VALID_EMAIL'] = "Check if your email is filled in correctly";

View file

@ -82,3 +82,4 @@ $MESS["RESEND_SMS"] = "Отправить смс повторно";
$MESS["RESEND_POSSIBLE"] = "Повторная отправка смс возможна через";
$MESS["LOYALTY_CONNECTION_ERROR"] = "Возникли проблемы с подключением к удаленному серверу. Попробуйте перезагрузить страницу.";
$MESS["SUBSCRIBE_EMAIL"] = "Согласен на рекламно-информационные рассылки";
$MESS['NO_VALID_EMAIL'] = "Проверьте правильность заполнения email";

View file

@ -55,7 +55,7 @@ function activateAccount() {
)
if (emailViolation) {
$('#errMsg').text('Проверьте правильность заполнения email')
$('#errMsg').text(BX.message("NO_VALID_EMAIL"));
return;
}

View file

@ -0,0 +1,8 @@
<?php
$MESS['COUNT_FOR_WRITE_OFF'] = 'How many bonuses to spend?';
$MESS['VALIDATE_BONUS_ERROR'] = 'Invalid value entered';
$MESS['DATA_PROCESSING'] = 'Information processing';
$MESS['YOU_CANT_SPEND_MORE'] = 'You cant spend more ';
$MESS['BONUSES'] = 'bonuses';
$MESS ['INTARO_NOT_INSTALLED'] = "Integration module with RetailCRM is not installed";

View file

@ -1,138 +1,158 @@
<?
$MESS["ADDITIONAL_PROPS_DEFAULT"] = "Additional properties";
$MESS["ADD_DEFAULT"] = "Add";
$MESS["AUTH_BLOCK_NAME_DEFAULT"] = "Log in";
$MESS["AUTH_REFERENCE_1_DEFAULT"] = "Fields marked with \"*\" are required.";
$MESS["AUTH_REFERENCE_2_DEFAULT"] = "You will receive the notification message upon completing the registration.";
$MESS["AUTH_REFERENCE_3_DEFAULT"] = "Your personal information acquired upon registration, placing of an order, or by any other means will never be rented, sold or transferred to third parties unless required by legal authorities or court decision..";
$MESS["BACK_DEFAULT"] = "Back";
$MESS["BASKET_BLOCK_NAME_DEFAULT"] = "Shopping cart";
$MESS["BUYER_BLOCK_NAME_DEFAULT"] = "Customer";
$MESS["CAPTCHA_REGF_PROMT"] = "Type the characters you see on the picture";
$MESS["CAPTCHA_REGF_TITLE"] = "CAPTCHA";
$MESS["COUPON_DEFAULT"] = "Coupon";
$MESS["DELIVERY_BLOCK_NAME_DEFAULT"] = "Delivery";
$MESS["DELIVERY_CALC_ERROR_TEXT_DEFAULT"] = "Continue checkout. Our sales representative will contact you with delivery details.";
$MESS["DELIVERY_CALC_ERROR_TITLE_DEFAULT"] = "Cannot calculate delivery price.";
$MESS["ECONOMY_DEFAULT"] = "Save";
$MESS["EDIT_DEFAULT"] = "change";
$MESS["EMPTY_BASKET_HINT"] = "#A1#Click here#A2# to continue shopping";
$MESS["EMPTY_BASKET_TITLE"] = "Your cart is empty";
$MESS["FAIL_PRELOAD_TEXT_DEFAULT"] = "You previously shopped with us and we remember you, so we have taken the liberty to fill in the fields for you.<br />
Check the order information thoroughly and edit your order if required. Once you see everything is good, click \"#ORDER_BUTTON#\".
";
$MESS["FURTHER_DEFAULT"] = "Next";
$MESS["INNER_PS_BALANCE_DEFAULT"] = "Your balance:";
$MESS["NAV_BACK_DEFAULT"] = "Back";
$MESS["NAV_FORWARD_DEFAULT"] = "Next";
$MESS["NEAREST_PICKUP_LIST_DEFAULT"] = "Nearest locations:";
$MESS["ORDER_DEFAULT"] = "Checkout";
$MESS["ORDER_DESC_DEFAULT"] = "Order comments:";
$MESS["PAYMENT_BLOCK_NAME_DEFAULT"] = "Payment";
$MESS["PAY_SYSTEM_PAYABLE_ERROR_DEFAULT"] = "You'll be able to pay for the order after we verify that the items you have ordered are in stock. Once your order is fulfilled, you'll receive an email with payment instructions. You'll be able to complete the purchase inside your customer account.";
$MESS["PERIOD_DEFAULT"] = "Delivery time";
$MESS["PERSON_TYPE_DEFAULT"] = "Payer type";
$MESS["PICKUP_LIST_DEFAULT"] = "Pick-up locations:";
$MESS["PRICE_DEFAULT"] = "Price";
$MESS["PRICE_FREE_DEFAULT"] = "free";
$MESS["REGION_BLOCK_NAME_DEFAULT"] = "Delivery area";
$MESS["REGION_REFERENCE_DEFAULT"] = "Select your city from the list. If you cannot find your city, select \"other location\" and enter your city in the \"City\" field.";
$MESS["REGISTRATION_REFERENCE_DEFAULT"] = "Please register for better shopping experience and to keep your order history.";
$MESS["REG_BLOCK_NAME_DEFAULT"] = "Register";
$MESS["SALE_SADC_TRANSIT"] = "Delivery time";
$MESS["SELECT_FILE_DEFAULT"] = "Select";
$MESS["SELECT_PICKUP_DEFAULT"] = "Select";
$MESS["SELECT_PROFILE_DEFAULT"] = "Select profile";
$MESS["SOA_BAD_EXTENSION"] = "Invalid file type";
$MESS["SOA_DELIVERY"] = "Delivery service";
$MESS["SOA_DELIVERY_SELECT_ERROR"] = "Delivery service not selected";
$MESS["SOA_DISTANCE_KM"] = "km";
$MESS["SOA_DO_SOC_SERV"] = "Social login";
$MESS["SOA_ERROR_ORDER"] = "Error creating the order.";
$MESS["SOA_ERROR_ORDER_LOST"] = "Order no. #ORDER_ID# cannot be found.";
$MESS["SOA_ERROR_ORDER_LOST1"] = "Please contact the store administration or try again.";
$MESS["SOA_FIELD"] = "Field";
$MESS["SOA_INVALID_EMAIL"] = "E-mail is incorrect";
$MESS["SOA_INVALID_PATTERN"] = "does not match the pattern";
$MESS["SOA_LESS"] = "at least";
$MESS["SOA_LOCATION_NOT_FOUND"] = "Location was not found";
$MESS["SOA_LOCATION_NOT_FOUND_PROMPT"] = "Click #ANCHOR#add location#ANCHOR_END# so we know where you want to have your order shipped to";
$MESS["SOA_MAP_COORDS"] = "Map coordinates";
$MESS["SOA_MAX_LENGTH"] = "Max. field length";
$MESS["SOA_MAX_SIZE"] = "Max. file size exceeded";
$MESS["SOA_MAX_VALUE"] = "Max. field value";
$MESS["SOA_MIN_LENGTH"] = "Min. field length";
$MESS["SOA_MIN_VALUE"] = "Min. field value";
$MESS["SOA_MORE"] = "less than";
$MESS["SOA_NO"] = "no";
$MESS["SOA_NOT_CALCULATED"] = "not calculated";
$MESS["SOA_NOT_FOUND"] = "Not found";
$MESS["SOA_NOT_NUMERIC"] = "numbers only";
$MESS["SOA_NOT_SELECTED"] = "not selected";
$MESS["SOA_NOT_SELECTED_ALT"] = "Make location more specific if required";
$MESS["SOA_NOT_SPECIFIED"] = "not specified";
$MESS["SOA_NO_JS"] = "The ordering process requires that JavaScript is enabled on your system. JavaScript is disabled or not supported by your browser. Please change the browser settings and <a href=\"\">try again</a>.";
$MESS["SOA_NUM_STEP"] = "doesn't match";
$MESS["SOA_ORDER_COMPLETE"] = "Order has been completed";
$MESS["SOA_ORDER_PROPS"] = "Order properties";
$MESS["SOA_ORDER_PS_ERROR"] = "The selected payment method failed. Please contact the site administrator or select another method.";
$MESS["SOA_ORDER_SUC"] = "Your order <b>##ORDER_ID#</b> of #ORDER_DATE# has been created successfully.";
$MESS["SOA_ORDER_SUC1"] = "You can track your order in your <a href=\"#LINK#\">personal account</a>. You will be asked to enter your login and password to access your account.";
$MESS["SOA_OTHER_LOCATION"] = "Other location";
$MESS["SOA_PAY"] = "Order payment";
$MESS["SOA_PAYMENT_SUC"] = "Payment <b>##PAYMENT_ID#</b>";
$MESS["SOA_PAYSYSTEM_PRICE"] = "Extra COD:";
$MESS["SOA_PAY_ACCOUNT3"] = "You have sufficient credit to pay the order in full.";
$MESS["SOA_PAY_LINK"] = "If you don't see any payment information, click here: <a href=\"#LINK#\" target=\"_blank\">Pay and place order</a>.";
$MESS["SOA_PAY_PDF"] = "Click <a href=\"#LINK#\" target=\"_blank\">Download invoice</a> to get the invoice in PDF format.";
$MESS["SOA_PAY_SYSTEM"] = "Payment system";
$MESS["SOA_PICKUP_ADDRESS"] = "Address";
$MESS["SOA_PICKUP_DESC"] = "Description";
$MESS["SOA_PICKUP_EMAIL"] = "E-Mail";
$MESS["SOA_PICKUP_PHONE"] = "Phone";
$MESS["SOA_PICKUP_STORE"] = "Warehouse";
$MESS["SOA_PICKUP_WORK"] = "Business hours";
$MESS["SOA_PROP_NEW_PROFILE"] = "New profile";
$MESS["SOA_PS_SELECT_ERROR"] = "Payment system not selected";
$MESS["SOA_REQUIRED"] = "this field is required";
$MESS["SOA_SUM_DELIVERY"] = "Delivery:";
$MESS["SOA_SUM_DISCOUNT"] = "Discount";
$MESS["SOA_SUM_IT"] = "Total:";
$MESS["SOA_SUM_LEFT_TO_PAY"] = "Amount payable:";
$MESS["SOA_SUM_NAME"] = "Name";
$MESS["SOA_SUM_PAYED"] = "Paid:";
$MESS["SOA_SUM_PRICE"] = "Price";
$MESS["SOA_SUM_QUANTITY"] = "Quantity";
$MESS["SOA_SUM_SUMMARY"] = "Total price:";
$MESS["SOA_SUM_VAT"] = "Tax:";
$MESS["SOA_SUM_WEIGHT"] = "Weight";
$MESS["SOA_SUM_WEIGHT_SUM"] = "Total weight:";
$MESS["SOA_SYMBOLS"] = "symbols";
$MESS["SOA_YES"] = "yes";
$MESS["STOF_AUTH_REQUEST"] = "Please log in.";
$MESS["STOF_DO_AUTHORIZE"] = "Log in";
$MESS["STOF_DO_REGISTER"] = "Register";
$MESS["STOF_EMAIL"] = "E-mail";
$MESS["STOF_ENTER"] = "Log in";
$MESS["STOF_FORGET_PASSWORD"] = "Forgot your password?";
$MESS["STOF_LASTNAME"] = "Last name";
$MESS["SOA_NO"] = "no";
$MESS["SOA_DO_SOC_SERV"] = "Sign in with social media";
$MESS["SOA_NOT_FOUND"] = "Not Found";
$MESS["SOA_NOT_SPECIFIED"] = "not specified";
$MESS["SOA_NOT_SELECTED"] = "not selected";
$MESS["SOA_NOT_CALCULATED"] = "not calculated";
$MESS["SOA_PS_SELECT_ERROR"] = "Payment system not selected";
$MESS["SOA_DELIVERY_SELECT_ERROR"] = "Delivery service not selected";
$MESS["SOA_PICKUP_PHONE"] = "Phone";
$MESS["SOA_PICKUP_ADDRESS"] = "Address";
$MESS["SOA_PICKUP_WORK"] = "Work Mode";
$MESS["SOA_PICKUP_STORE"] = "Warehouse";
$MESS["SOA_PICKUP_EMAIL"] = "Email";
$MESS["SOA_PICKUP_DESC"] = "Description";
$MESS["SOA_MAP_COORDS"] = "Map coordinates";
$MESS["SOA_DISTANCE_KM"] = "km";
$MESS["SOA_ORDER_PROPS"] = "Order Properties";
$MESS["SOA_FIELD"] = "Field";
$MESS["SOA_REQUIRED"] = "required";
$MESS["SOA_INVALID_EMAIL"] = "Invalid e-mail entered";
$MESS["SOA_MIN_LENGTH"] = "Minimum field length";
$MESS["SOA_MAX_LENGTH"] = "Maximum field length";
$MESS["SOA_NOT_NUMERIC"] = "must be numeric";
$MESS["SOA_MIN_VALUE"] = "Minimum field value";
$MESS["SOA_MAX_VALUE"] = "Maximum field value";
$MESS["SOA_NUM_STEP"] = "does not match the step";
$MESS["SOA_LESS"] = "not less than";
$MESS["SOA_MORE"] = "not more than";
$MESS["SOA_SYMBOLS"] = "characters";
$MESS["SOA_INVALID_PATTERN"] = "does not match the template";
$MESS["SOA_PROP_NEW_PROFILE"] = "New Profile";
$MESS["SOA_PAY_SYSTEM"] = "Payment System";
$MESS["SOA_PAY_ACCOUNT3"] = "Funds are sufficient for full payment of the order.";
$MESS["SOA_DELIVERY"] = "Delivery service";
$MESS["SOA_ORDER_SUC"] = "Your order <b>№#ORDER_ID#</b> from #ORDER_DATE# has been successfully created.";
$MESS["SOA_PAYMENT_SUC"] = "Your payment number: <b>№#PAYMENT_ID#</b>";
$MESS["SOA_ORDER_SUC1"] = "You can follow the fulfillment of your order in <a href=\"#LINK#\">personalized section of the site</a>. Please note that you will need to enter your site user login and password to access this section.";
$MESS["SOA_PAY"] = "Order payment";
$MESS["SOA_PAY_LINK"] = "If the payment information window does not open automatically, click on the link <a href=\"#LINK#\" target=\"_blank\">Pay order</a>.";
$MESS["SOA_PAY_PDF"] = "To download the invoice in pdf format, click on the link <a href=\"#LINK#\" target=\"_blank\">Download Invoice</a>.";
$MESS["SOA_ERROR_ORDER"] = "Order formation error";
$MESS["SOA_ERROR_ORDER_LOST"] = "Order №#ORDER_ID# not found.";
$MESS["SOA_ERROR_ORDER_LOST1"] = "Please contact the administration of the online store or try to place your order again.";
$MESS["SOA_SUM_NAME"] = "Name";
$MESS["SOA_SUM_DISCOUNT"] = "Discount";
$MESS["SOA_SUM_WEIGHT"] = "Weight";
$MESS["SOA_SUM_QUANTITY"] = "Quantity";
$MESS["SOA_SUM_PRICE"] = "Price";
$MESS["SOA_SUM_WEIGHT_SUM"] = "Total weight:";
$MESS["SOA_SUM_SUMMARY"] = "Items per:";
$MESS["SOA_SUM_VAT"] = "VAT:";
$MESS["SOA_SUM_DELIVERY"] = "Shipping:";
$MESS["SOA_SUM_IT"] = "Total:";
$MESS["SOA_SUM_PAYED"] = "Paid:";
$MESS["SOA_SUM_LEFT_TO_PAY"] = "Remaining to be paid:";
$MESS["SOA_ORDER_COMPLETE"] = "Order formed.";
$MESS["CAPTCHA_REGF_TITLE"] = "Automatic Registration Protection";
$MESS["CAPTCHA_REGF_PROMT"] = "Enter the word in the picture";
$MESS["STOF_LOGIN"] = "Login";
$MESS["STOF_MY_PASSWORD"] = "Your login and password";
$MESS["STOF_NAME"] = "First name";
$MESS["STOF_NEXT_STEP"] = "Continue checkout";
$MESS["STOF_PASSWORD"] = "Password";
$MESS["STOF_PHONE"] = "Phone number";
$MESS["STOF_REMEMBER"] = "Remember me";
$MESS["STOF_ENTER"] = "Login";
$MESS["STOF_REGISTER"] = "Register";
$MESS["STOF_REG_HINT"] = "Please register for better shopping experience and to keep your order history.";
$MESS["STOF_REG_REQUEST"] = "Please register.";
$MESS["STOF_REG_SMS_REQUEST"] = "A confirmation code has been sent to your phone";
$MESS["STOF_REMEMBER"] = "Remember Me";
$MESS["STOF_RE_PASSWORD"] = "Repeat password";
$MESS["STOF_DO_AUTHORIZE"] = "Authorize";
$MESS["STOF_DO_REGISTER"] = "Register";
$MESS["STOF_AUTH_REQUEST"] = "Please Authorize";
$MESS["STOF_REG_REQUEST"] = "Please register";
$MESS["STOF_PHONE"] = "Phone number";
$MESS["STOF_REG_SMS_REQUEST"] = "An SMS with a confirmation code was sent to your number";
$MESS["STOF_SMS_CODE"] = "Confirmation code from SMS";
$MESS["STOF_SEND"] = "Send";
$MESS["STOF_SMS_CODE"] = "SMS confirmation code";
$MESS["STOF_REG_HINT"] = "If this is your first time on the site and you want us to remember you and keep all your orders,
please fill out the registration form.";
$MESS["STOF_FORGET_PASSWORD"] = "Forgot your password?";
$MESS["STOF_NEXT_STEP"] = "Continue Checkout";
$MESS["STOF_NAME"] = "First Name";
$MESS["STOF_LASTNAME"] = "Last Name";
$MESS["STOF_EMAIL"] = "E-mail";
$MESS["STOF_MY_PASSWORD"] = "Set login and password";
$MESS["STOF_RE_PASSWORD"] = "Repeat password";
$MESS["STOF_SYS_PASSWORD"] = "Generate login and password";
$MESS["SUCCESS_PRELOAD_TEXT_DEFAULT"] = "You previously shopped with us and we remember you, so we have taken the liberty to fill in the fields for you.<br />
If the information is correct, click \"#ORDER_BUTTON#\".
$MESS["SALE_SADC_TRANSIT"] = "Delivery time";
$MESS["SOA_NO_JS"] = "JavaScript must be enabled to place an order. It appears that JavaScript is either not supported by your browser or is disabled. Change your browser settings and then <a href=\"\">try again</a>.";
$MESS["SOA_PAYSYSTEM_PRICE"] = "Optional cash on delivery:";
$MESS["SOA_OTHER_LOCATION"] = "Other Location";
$MESS["SOA_LOCATION_NOT_FOUND"] = "Location not found";
$MESS["SOA_LOCATION_NOT_FOUND_PROMPT"] = "#ANCHOR#Select a location from the list#ANCHOR_END#, to let us know where to deliver your order.";
$MESS["SOA_NOT_SELECTED_ALT"] = "If you need to specify the location";
$MESS["SOA_ORDER_PS_ERROR"] = "Error of selected payment method. Please contact Site Administration or select another payment method.";
$MESS["AUTH_BLOCK_NAME_DEFAULT"] = "Authorization";
$MESS["REG_BLOCK_NAME_DEFAULT"] = "Registration";
$MESS["BASKET_BLOCK_NAME_DEFAULT"] = "Items in the order";
$MESS["REGION_BLOCK_NAME_DEFAULT"] = "Delivery Region";
$MESS["PAYMENT_BLOCK_NAME_DEFAULT"] = "Payment";
$MESS["DELIVERY_BLOCK_NAME_DEFAULT"] = "Delivery";
$MESS["BUYER_BLOCK_NAME_DEFAULT"] = "Buyer";
$MESS["BACK_DEFAULT"] = "Back";
$MESS["FURTHER_DEFAULT"] = "Next";
$MESS["EDIT_DEFAULT"] = "change";
$MESS["ORDER_DEFAULT"] = "Checkout";
$MESS["ADD_DEFAULT"] = "Add";
$MESS["PRICE_DEFAULT"] = "Price";
$MESS["PERIOD_DEFAULT"] = "Delivery time";
$MESS["NAV_BACK_DEFAULT"] = "Back";
$MESS["NAV_FORWARD_DEFAULT"] = "Forward";
$MESS["PRICE_FREE_DEFAULT"] = "free";
$MESS["ECONOMY_DEFAULT"] = "Economy";
$MESS["REGISTRATION_REFERENCE_DEFAULT"] = "If this is your first time on the site and you want us to remember you and keep all your orders, please fill out the registration form.";
$MESS["AUTH_REFERENCE_1_DEFAULT"] = "Required fields are marked with an \"asterisk\" (*).";
$MESS["AUTH_REFERENCE_2_DEFAULT"] = "After registration, you will receive an informational letter.";
$MESS["AUTH_REFERENCE_3_DEFAULT"] = "Personal information, received by the online store during registration or otherwise, will not be transferred to third organizations and persons without the permission of users, except in situations where required by law or court order.";
$MESS["ADDITIONAL_PROPS_DEFAULT"] = "Additional properties.";
$MESS["USE_COUPON_DEFAULT"] = "Apply Coupon";
$MESS["COUPON_DEFAULT"] = "Coupon";
$MESS["PERSON_TYPE_DEFAULT"] = "Payer Type";
$MESS["SELECT_PROFILE_DEFAULT"] = "Select a profile";
$MESS["REGION_REFERENCE_DEFAULT"] = 'Select your city from the list. If you dont find your city, select \"other location\", and put the city in the field \"City\"';
$MESS["PICKUP_LIST_DEFAULT"] = "Pickup locations:";
$MESS["NEAREST_PICKUP_LIST_DEFAULT"] = "Nearest locations:";
$MESS["SELECT_PICKUP_DEFAULT"] = "Select";
$MESS["INNER_PS_BALANCE_DEFAULT"] = "In your user account:";
$MESS["ORDER_DESC_DEFAULT"] = "Order Comments:";
$MESS["SELECT_FILE_DEFAULT"] = "Select";
$MESS["SUCCESS_PRELOAD_TEXT_DEFAULT"] = "You ordered from our online store, so we filled in all the data automatically.<br />
If everything is filled in correctly, press the button \"#ORDER_BUTTON#\".
";
$MESS["USE_COUPON_DEFAULT"] = "Apply coupon";
?>
$MESS["FAIL_PRELOAD_TEXT_DEFAULT"] = "You ordered from our online store, so we filled in all the data automatically.<br />
Pay attention to the detailed block with information about the order. Here you can make the necessary changes or
leave it as it is and click the button \"#ORDER_BUTTON#\".
";
$MESS["DELIVERY_CALC_ERROR_TITLE_DEFAULT"] = "Failed to calculate the shipping cost.";
$MESS["DELIVERY_CALC_ERROR_TEXT_DEFAULT"] = "You can continue placing your order, and later the store manager will contact you and clarify the delivery information.";
$MESS["EMPTY_BASKET_TITLE"] = "Your cart is empty";
$MESS["EMPTY_BASKET_HINT"] = "#A1#Click here#A2#, to continue shopping";
$MESS["SOA_BAD_EXTENSION"] = "Invalid file type";
$MESS["SOA_MAX_SIZE"] = "Maximum file size exceeded";
$MESS["PAY_SYSTEM_PAYABLE_ERROR_DEFAULT"] = "You will be able to pay for your order after the manager checks the availability of a full set of goods in stock. Immediately after checking you will receive an email with payment instructions. You will be able to pay for the order in the personal section of the site.";
$MESS["BONUS_PAYMENT"] = 'Pay with bonuses';
$MESS["HOW_MANY_BONUSES_TO_SPEND"] = 'How many bonuses to spend?';
$MESS["BONUS_TOTAL"] = 'Total bonuses:';
$MESS["YOU_CAN_SPEND"] = 'You can spend:';
$MESS["CHARGE_RATE"] = "Bonus rate: 1 bonus = %s %s";
$MESS["RUB"] = "rub.";
$MESS["CALCULATION_ERROR"] = 'Failed to calculate the number of available bonuses.';
$MESS["CONFIRM_MESSAGE"] = 'To complete the bonus debiting procedure, enter your verification code';
$MESS["SEND"] = 'Send';
$MESS["RESEND_POSSIBLE"] = "It is possible to resend sms through";
$MESS["RESEND_SMS"] = "Send sms again";
$MESS["BONUS_SUCCESS"] = "Bonuses have been successfully debited";
$MESS["BONUS_ERROR"] = "Error of bonus debiting";
$MESS["LOYALTY_CONNECTION_ERROR"] = "There were problems with connection to the remote server.
Loyalty program discounts were not applied. Try reloading the page.";
$MESS["PAYMENT_IN_BONUSES"] = 'Payment with bonuses:';
$MESS["PERSONAL_DISCOUNT"] = 'Personal discount: ';
$MESS["COMMON_DISCOUNT"] = 'Regular discount: ';
$MESS["WILL_CREDITED_BONUSES"] = 'Bonuses to be credited: ';

View file

@ -152,4 +152,7 @@ $MESS["BONUS_SUCCESS"] = "Бонусы успешно списаны";
$MESS["BONUS_ERROR"] = "Ошибка списания бонусов";
$MESS["LOYALTY_CONNECTION_ERROR"] = "Возникли проблемы с подключением к удаленному серверу.
Скидки программы лояльности не были применены. Попробуйте перезагрузить страницу.";
$MESS["PAYMENT_IN_BONUSES"] = 'Оплата бонусами:';
$MESS["PERSONAL_DISCOUNT"] = 'Персональная скидка: ';
$MESS["COMMON_DISCOUNT"] = 'Обычная скидка: ';
$MESS["WILL_CREDITED_BONUSES"] = "Будет начислено бонусов: ";

View file

@ -8324,25 +8324,25 @@ BX.namespace('BX.Sale.OrderAjaxComponent');
if (this.loyaltyDiscount !== undefined && this.loyaltyDiscount > 0) {
let loyaltyDiscount = this.bonusCurrency
.replace('#', this.loyaltyDiscount.toString());
this.totalInfoBlockNode.appendChild(this.createTotalUnit("Персональная скидка: ", loyaltyDiscount));
this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("PERSONAL_DISCOUNT"), loyaltyDiscount));
}
if (this.bitrixDiscount !== undefined && this.bitrixDiscount > 0) {
let defaultDiscount = this.bonusCurrency
.replace('#', this.bitrixDiscount.toString());
this.totalInfoBlockNode.appendChild(this.createTotalUnit("Обычная скидка: ", defaultDiscount));
this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("COMMON_DISCOUNT"), defaultDiscount));
}
if (this.result.TOTAL.BONUS_PAYMENT !== undefined && this.result.TOTAL.BONUS_PAYMENT > 0) {
let bonusPayment = this.bonusCurrency
.replace('#', this.result.TOTAL.BONUS_PAYMENT.toString());
this.totalInfoBlockNode.appendChild(this.createTotalUnit('Оплата бонусами:', bonusPayment));
this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("PAYMENT_IN_BONUSES"), bonusPayment));
}
if (this.result.TOTAL.WILL_BE_CREDITED !== undefined && this.result.TOTAL.WILL_BE_CREDITED > 0) {
this.totalInfoBlockNode.appendChild(this.createTotalUnit('Будет начислено бонусов: ', String(this.result.TOTAL.WILL_BE_CREDITED), {highlighted: true}));
this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("WILL_CREDITED_BONUSES"), String(this.result.TOTAL.WILL_BE_CREDITED), {highlighted: true}));
} else if (this.willBeCredited > 0) {
this.totalInfoBlockNode.appendChild(this.createTotalUnit('Будет начислено бонусов:', this.willBeCredited, {highlighted: true}));
this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("WILL_CREDITED_BONUSES"), this.willBeCredited, {highlighted: true}));
}
}
@ -8386,4 +8386,4 @@ BX.namespace('BX.Sale.OrderAjaxComponent');
this.editMobileTotalBlock();
};
})();
})();

View file

@ -1,6 +1,6 @@
<?php
require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/header.php');
$APPLICATION->SetTitle('Регистрация');
$APPLICATION->SetTitle(GetMessage('REGISTER_LOYALTY'));
?>
<?php $APPLICATION->IncludeComponent(

View file

@ -0,0 +1,2 @@
<?php
$MESS['REGISTER_LOYALTY'] = "Registration";

View file

@ -0,0 +1,2 @@
<?php
$MESS['REGISTER_LOYALTY'] = "Регистрация";

View file

@ -1,6 +1,6 @@
<?php
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php");
$APPLICATION->SetTitle("Бонусный счет");
$APPLICATION->SetTitle(GetMessage('BONUS_ACCOUNT'));
?>
<?php $APPLICATION->IncludeComponent(
@ -10,4 +10,4 @@ $APPLICATION->SetTitle("Бонусный счет");
);
?>
<?php require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php"); ?>
<?php require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php"); ?>

View file

@ -0,0 +1,2 @@
<?php
$MESS['BONUS_ACCOUNT'] = "Bonus account";

View file

@ -0,0 +1,2 @@
<?php
$MESS['BONUS_ACCOUNT'] = "Бонусный счет";

View file

@ -1,6 +1,6 @@
<?php
require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/header.php');
$APPLICATION->SetTitle('Регистрация');
$APPLICATION->SetTitle(GetMessage('REGISTER'));
?>
<?php $APPLICATION->IncludeComponent(

View file

@ -0,0 +1,2 @@
<?php
$MESS['REGISTER'] = "Registration";

View file

@ -0,0 +1,2 @@
<?php
$MESS['REGISTER'] = "Регистрация";

View file

@ -15,22 +15,23 @@ use Bitrix\Sale\EventActions;
use Bitrix\Sale\Internals\OrderTable;
use Intaro\RetailCrm\Component\ConfigProvider;
use Intaro\RetailCrm\Component\Constants;
use Intaro\RetailCrm\Component\Installer\InstallerTrait;
use Intaro\RetailCrm\Service\CurrencyService;
use Intaro\RetailCrm\Service\OrderLoyaltyDataService;
use RetailCrm\ApiClient;
use RetailCrm\Exception\CurlException;
use RetailCrm\Http\Client;
use RetailCrm\Response\ApiResponse;
use Intaro\RetailCrm\Component\Advanced\InstallerTrait;
use Intaro\RetailCrm\Component\Advanced\LoyaltyInstaller;
Loader::IncludeModule('highloadblock');
IncludeModuleLangFile(__FILE__);
if (class_exists('intaro_retailcrm')) {
return false;
}
include (__DIR__ . '/../lib/component/installer/installertrait.php');
require_once(__DIR__ . '/../lib/component/advanced/installertrait.php');
class intaro_retailcrm extends CModule
{
@ -47,56 +48,17 @@ 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()
{
$arModuleVersion = [];
$path = str_replace("\\", '/', __FILE__);
$path = substr($path, 0, strlen($path) - strlen('/index.php'));
$arModuleVersion = [];
$path = str_replace("\\", '/', __FILE__);
$path = substr($path, 0, strlen($path) - strlen('/index.php'));
$this->INSTALL_PATH = $path;
include($path . '/version.php');
$this->MODULE_VERSION = $arModuleVersion['VERSION'];
$this->MODULE_VERSION_DATE = $arModuleVersion['VERSION_DATE'];
$this->MODULE_NAME = GetMessage('RETAIL_MODULE_NAME');
@ -126,6 +88,18 @@ class intaro_retailcrm extends CModule
*/
function DoInstall()
{
try {
require_once('install_deps.php');
} catch (Error $exception) {
RCrmActions::eventLog(
'RetailCRM module install error',
'intaro.retailcrm',
$exception->getCode() . ': ' . $exception->getMessage()
);
return false;
}
global $APPLICATION, $step, $arResult;
if (!in_array('curl', get_loaded_extensions(), true)) {
@ -151,56 +125,6 @@ class intaro_retailcrm extends CModule
return false;
}
include($this->INSTALL_PATH . '/../lib/component/apiclient/traits/baseclienttrait.php');
include($this->INSTALL_PATH . '/../lib/component/apiclient/traits/customerstrait.php');
include($this->INSTALL_PATH . '/../lib/component/apiclient/traits/customerscorporatetrait.php');
include($this->INSTALL_PATH . '/../lib/component/apiclient/traits/loyaltytrait.php');
include($this->INSTALL_PATH . '/../lib/component/apiclient/traits/ordertrait.php');
include($this->INSTALL_PATH . '/../lib/component/apiclient/traits/carttrait.php');
include($this->INSTALL_PATH . '/../classes/general/Http/Client.php');
include($this->INSTALL_PATH . '/../classes/general/Response/ApiResponse.php');
include($this->INSTALL_PATH . '/../classes/general/RCrmActions.php');
include($this->INSTALL_PATH . '/../classes/general/user/RetailCrmUser.php');
include($this->INSTALL_PATH . '/../classes/general/events/RetailCrmEvent.php');
require_once $this->INSTALL_PATH . '/../classes/general/RetailcrmConfigProvider.php';
include($this->INSTALL_PATH . '/../lib/model/bitrix/xml/offerparam.php');
include($this->INSTALL_PATH . '/../lib/icml/settingsservice.php');
include($this->INSTALL_PATH . '/../lib/component/agent.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/xml/selectparams.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/xml/unit.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmlcategory.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmldata.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmloffer.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmlsetup.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmlsetupprops.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmlsetuppropscategories.php');
include($this->INSTALL_PATH . '/../lib/icml/icmldirector.php');
include($this->INSTALL_PATH . '/../lib/icml/icmlwriter.php');
include($this->INSTALL_PATH . '/../lib/icml/queryparamsmolder.php');
include($this->INSTALL_PATH . '/../lib/icml/xmlcategorydirector.php');
include($this->INSTALL_PATH . '/../lib/icml/xmlcategoryfactory.php');
include($this->INSTALL_PATH . '/../lib/icml/xmlofferdirector.php');
include($this->INSTALL_PATH . '/../lib/icml/xmlofferbuilder.php');
include($this->INSTALL_PATH . '/../lib/icml/utils/icmlutils.php');
include($this->INSTALL_PATH . '/../lib/repository/catalogrepository.php');
include($this->INSTALL_PATH . '/../lib/repository/filerepository.php');
include($this->INSTALL_PATH . '/../lib/repository/hlrepository.php');
include($this->INSTALL_PATH . '/../lib/repository/measurerepository.php');
include($this->INSTALL_PATH . '/../lib/repository/siterepository.php');
include($this->INSTALL_PATH . '/../lib/service/hl.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/orm/catalogiblockinfo.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/orm/iblockcatalog.php');
include($this->INSTALL_PATH . '/../classes/general/Exception/InvalidJsonException.php');
include($this->INSTALL_PATH . '/../classes/general/Exception/CurlException.php');
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 . '/../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');
include($this->INSTALL_PATH . '/../classes/general/cart/RetailCrmCart_v5.php');
$step = (int) $_REQUEST['step'];
if (file_exists($this->INSTALL_PATH . '/../classes/general/config/options.xml')) {
@ -229,32 +153,8 @@ class intaro_retailcrm extends CModule
}
}
include($this->INSTALL_PATH . '/../lib/model/bitrix/abstractmodelproxy.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/orderprops.php');
include($this->INSTALL_PATH . '/../lib/model/bitrix/tomodule.php');
include($this->INSTALL_PATH . '/../lib/repository/abstractrepository.php');
include($this->INSTALL_PATH . '/../lib/repository/orderpropsrepository.php');
include($this->INSTALL_PATH . '/../lib/repository/persontyperepository.php');
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');
include($this->INSTALL_PATH . '/../lib/component/factory/clientfactory.php');
include($this->INSTALL_PATH . '/../lib/component/apiclient/clientadapter.php');
$this->CopyFiles();
$this->addEvents();
$this->addAgreement();
$this->addUserFields();
$this->createCustomPropertyFile();
OrderLoyaltyDataService::createLoyaltyHlBlock();
$service = new OrderLoyaltyDataService();
$service->addCustomersLoyaltyFields();
$this->installExport();
$this->subscriptionSetup();
if ($step == 11) {
$arResult['arSites'] = RCrmActions::getSitesList();
@ -275,10 +175,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 +207,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 +241,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 +273,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 +322,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 +357,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 +452,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 +483,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 +598,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 +617,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 +627,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 +637,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 +647,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 +701,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 +773,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 +814,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 +848,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 +860,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'] = [];
@ -1138,13 +1038,13 @@ class intaro_retailcrm extends CModule
RegisterModuleDependences('sale', 'OnSalePaymentEntityDeleted', $this->MODULE_ID, 'RetailCrmEvent', 'paymentDelete');
RegisterModuleDependences('main', 'OnAfterUserRegister', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserRegister');
RegisterModuleDependences('main', 'OnAfterUserAdd', $this->MODULE_ID, 'RetailCrmEvent', 'OnAfterUserAdd');
RegisterModuleDependences('sale', 'OnSaleOrderSaved', $this->MODULE_ID, 'RetailCrmEvent', 'orderSave', 99);
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();
@ -1162,9 +1062,7 @@ class intaro_retailcrm extends CModule
30
);
$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 +1115,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 +1137,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 +1153,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 +1164,10 @@ 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');
require_once($this->INSTALL_PATH . '/../lib/component/advanced/loyaltyinstaller.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,58 +1175,52 @@ 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);
COption::RemoveOption($this->MODULE_ID, Constants::USE_CRM_ORDER_METHODS);
if (CModule::IncludeModule('sale')) {
UnRegisterModuleDependences(
'sale',
EventActions::EVENT_ON_ORDER_SAVED,
$this->MODULE_ID,
'RetailCrmEvent',
'orderSave'
);
UnRegisterModuleDependences('sale', 'OnSaleOrderSaved', $this->MODULE_ID, 'RetailCrmEvent', 'orderSave');
}
UnRegisterModuleDependences('sale', 'OnOrderUpdate', $this->MODULE_ID, 'RetailCrmEvent', 'onUpdateOrder');
@ -1356,7 +1249,9 @@ class intaro_retailcrm extends CModule
}
$this->deleteFiles();
$this->deleteLPEvents();
$loyalty = new LoyaltyInstaller();
$loyalty->deleteLPEvents();
UnRegisterModule($this->MODULE_ID);

View file

@ -0,0 +1,70 @@
<?php
require_once($this->INSTALL_PATH . '/../lib/component/apiclient/traits/baseclienttrait.php');
require_once($this->INSTALL_PATH . '/../lib/component/apiclient/traits/customerstrait.php');
require_once($this->INSTALL_PATH . '/../lib/component/apiclient/traits/customerscorporatetrait.php');
require_once($this->INSTALL_PATH . '/../lib/component/apiclient/traits/loyaltytrait.php');
require_once($this->INSTALL_PATH . '/../lib/component/apiclient/traits/ordertrait.php');
require_once($this->INSTALL_PATH . '/../lib/component/apiclient/traits/carttrait.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/RCrmActions.php');
require_once($this->INSTALL_PATH . '/../classes/general/user/RetailCrmUser.php');
require_once($this->INSTALL_PATH . '/../classes/general/events/RetailCrmEvent.php');
require_once $this->INSTALL_PATH . '/../classes/general/RetailcrmConfigProvider.php';
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/xml/offerparam.php');
require_once($this->INSTALL_PATH . '/../lib/icml/settingsservice.php');
require_once($this->INSTALL_PATH . '/../lib/component/agent.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/xml/selectparams.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/xml/unit.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmlcategory.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmldata.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmloffer.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmlsetup.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmlsetupprops.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/xml/xmlsetuppropscategories.php');
require_once($this->INSTALL_PATH . '/../lib/icml/icmldirector.php');
require_once($this->INSTALL_PATH . '/../lib/icml/icmlwriter.php');
require_once($this->INSTALL_PATH . '/../lib/icml/queryparamsmolder.php');
require_once($this->INSTALL_PATH . '/../lib/icml/xmlcategorydirector.php');
require_once($this->INSTALL_PATH . '/../lib/icml/xmlcategoryfactory.php');
require_once($this->INSTALL_PATH . '/../lib/icml/xmlofferdirector.php');
require_once($this->INSTALL_PATH . '/../lib/icml/xmlofferbuilder.php');
require_once($this->INSTALL_PATH . '/../lib/repository/catalogrepository.php');
require_once($this->INSTALL_PATH . '/../lib/repository/filerepository.php');
require_once($this->INSTALL_PATH . '/../lib/repository/hlrepository.php');
require_once($this->INSTALL_PATH . '/../lib/repository/measurerepository.php');
require_once($this->INSTALL_PATH . '/../lib/repository/siterepository.php');
require_once($this->INSTALL_PATH . '/../lib/service/hl.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/orm/catalogiblockinfo.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/orm/iblockcatalog.php');
require_once($this->INSTALL_PATH . '/../classes/general/Exception/InvalidJsonException.php');
require_once($this->INSTALL_PATH . '/../classes/general/Exception/CurlException.php');
require_once($this->INSTALL_PATH . '/../classes/general/RestNormalizer.php');
require_once($this->INSTALL_PATH . '/../classes/general/Logger.php');
require_once($this->INSTALL_PATH . '/../classes/general/services/RetailCrmService.php');
require_once($this->INSTALL_PATH . '/../lib/component/constants.php');
require_once($this->INSTALL_PATH . '/../classes/general/ApiClient_v5.php');
require_once($this->INSTALL_PATH . '/../classes/general/order/RetailCrmOrder_v5.php');
require_once($this->INSTALL_PATH . '/../classes/general/history/RetailCrmHistory_v5.php');
require_once($this->INSTALL_PATH . '/../classes/general/cart/RetailCrmCart_v5.php');
require_once($this->INSTALL_PATH . '/../lib/service/managerservice.php');
require_once($this->INSTALL_PATH . '/../lib/service/loyaltyservice.php');
require_once($this->INSTALL_PATH . '/../lib/service/loyaltyaccountservice.php');
require_once($this->INSTALL_PATH . '/../lib/repository/managerrepository.php');
require_once($this->INSTALL_PATH . '/../classes/general/services/BitrixOrderService.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/abstractmodelproxy.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/orderprops.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/tomodule.php');
require_once($this->INSTALL_PATH . '/../lib/repository/abstractrepository.php');
require_once($this->INSTALL_PATH . '/../lib/repository/orderpropsrepository.php');
require_once($this->INSTALL_PATH . '/../lib/repository/persontyperepository.php');
require_once($this->INSTALL_PATH . '/../lib/repository/tomodulerepository.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/orm/tomodule.php');
require_once($this->INSTALL_PATH . '/../lib/model/bitrix/agreement.php');
require_once($this->INSTALL_PATH . '/../lib/repository/agreementrepository.php');
require_once($this->INSTALL_PATH . '/../lib/service/orderloyaltydataservice.php');
require_once($this->INSTALL_PATH . '/../lib/service/currencyservice.php');
require_once($this->INSTALL_PATH . '/../lib/component/factory/clientfactory.php');
require_once($this->INSTALL_PATH . '/../lib/component/apiclient/clientadapter.php');
require_once($this->INSTALL_PATH . '/../lib/component/advanced/loyaltyinstaller.php');

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.18',
'VERSION_DATE' => '2024-06-05 16:30:00'
'VERSION' => '6.6.11',
'VERSION_DATE' => '2025-03-26 16:00:00'
];

View file

@ -47,3 +47,5 @@ $MESS['BASE_PRICE'] = 'Base price';
$MESS['WAIT'] = 'Loading...';
$MESS["OFFERS_VALUE"] = "Maximum number of trade offers for a product";
$MESS["LOAD_NON_ACTIVITY"] = "Unload inactive products, services and trade offers";
$MESS["ADD_PROPERTY"] = "Add property";
$MESS["DELETE_PROPERTY"] = "Delete";

View file

@ -23,6 +23,7 @@ $MESS ['ORDER_CUSTOM'] = 'Custom fields';
$MESS ['COUPON_CUSTOM_FIELD'] = 'Select a custom field in the CRM to transfer the applied coupon in the Bitrix order';
$MESS ['SELECT_VALUE'] = '-- Select a value --';
$MESS ['ORDER_UPLOAD'] = 'Re-upload orders';
$MESS ['LP_WARNING'] = 'Loyalty program of RetailCRM is available only with the “Uploading orders by event” options active';
$MESS ['ORDER_NUMBER'] = 'Order numbers: ';
$MESS ['ORDER_UPLOAD_INFO'] = 'Click "Start uploading" to upload all the orders . Or list the required order IDs separated by commas, intervals or dashes. For example: 1, 3, 5-10, 12, 13... etc.';
$MESS ['ICRM_OPTIONS_SUBMIT_TITLE'] = 'Save settings';
@ -41,6 +42,7 @@ $MESS ['ICRM_OPTIONS_ORDER_DISCHARGE_TAB'] = 'Orders uploading mode';
$MESS ['ORDER_DISCH'] = 'Orders uploading mode';
$MESS ['DISCHARGE_AGENT'] = 'Upload orders using agent';
$MESS ['DISCHARGE_EVENTS'] = 'Upload orders by events';
$MESS ['DISCHARGE_WITHOUT_UPDATE'] = 'Upload orders by agent (without update)';
$MESS ['INFO_2'] = ' Set the correspondence between 1C-Bitrix and RetailCRM order fields.';
$MESS ['ORDER_PROPS'] = 'Correspondence settings between RetailCRM order fields and 1C-Bitrix order properties';
$MESS ['FIO'] = 'Full name';
@ -146,7 +148,7 @@ $MESS ['NO_INTEGRATION_PAYMENT'] = '(Non-integrated)';
$MESS ['ERR_CHECK_JOURNAL'] = 'Error while saving. Details in the event log';
$MESS ['ERROR_LINK_INTEGRATION_PAYMENT'] = 'Error in comparing integration payments';
$MESS ['ERROR_UPDATE_PAYMENT_TYPES_DELIVERY'] = 'Error when updating payment methods for deliveries';
$MESS ['INTEGRATION_PAYMENT_LABEL'] = 'When correlating CMS and CRM integration payments, a regular payment is created on the system side to which orders will be linked.';
$MESS ['INTEGRATION_PAYMENT_LABEL'] = 'When correlating CMS and CRM integration payments, a regular payment is created on the system side to which orders will be linked. <br> If you have integration deliveries in your CRM, then you need to enable the new payment method in the integration settings';
$MESS ['NEED_PERMISSIONS_REFERENCE_LABEL'] = 'For this option to work correctly, the api key needs access to receive and edit reference book';
$MESS ['FIX_UPLOAD_CUSTOMER_HEADER'] = 'Fix customer registration date in CRM';
@ -154,3 +156,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

@ -47,3 +47,5 @@ $MESS["UNIT_MEASUREMENT_KG"] = "кг.";
$MESS['BASE_PRICE'] = 'Базовая цена';
$MESS['WAIT'] = 'Загрузка...';
$MESS["OFFERS_VALUE"] = "Максимальное количество торговых предложений у товара";
$MESS["ADD_PROPERTY"] = "Добавить свойство";
$MESS["DELETE_PROPERTY"] = "Удалить";

View file

@ -8,12 +8,20 @@ $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'] = 'Способы оплаты';
$MESS ['PAYMENT_STATUS_LIST'] = 'Статусы';
$MESS ['ORDER_TYPES_LIST'] = 'Типы заказа';
$MESS ['CRM_ORDER_METHODS'] = 'Передача заказов из CRM в Битрикс';
$MESS ['LP_WARNING'] = 'Программа лояльности RetailCRM доступна только при активной опции "Выгрузка заказов по событию"';
$MESS ['CRM_ORDER_METHODS_OPTION'] = 'Выгружать из RetailCRM заказы оформленные выбранными способами';
$MESS ['CONTRAGENTS_TYPES_LIST'] = 'Тип контрагента';
$MESS ['PAYMENT_LIST'] = 'Оплата';
@ -55,7 +63,7 @@ $MESS ['ICRM_OPTIONS_ORDER_DISCHARGE_TAB'] = 'Режим выгрузки зак
$MESS ['ORDER_DISCH'] = 'Режим выгрузки заказов';
$MESS ['DISCHARGE_AGENT'] = 'Выгрузка заказов с помощью агента';
$MESS ['DISCHARGE_EVENTS'] = 'Выгрузка заказов по событию';
$MESS ['DISCHARGE_WITHOUT_UPDATE'] = 'Выгрузка заказов по агенту (только создание заказов)';
$MESS ['INFO_2'] = ' Задайте соответствие между полями заказа 1C-Битрикс и RetailCRM.';
$MESS ['ORDER_PROPS'] = 'Настройки соответствия полей заказа RetailCRM свойствам заказа 1С-Битрикс';
@ -205,7 +213,7 @@ $MESS ['NO_INTEGRATION_PAYMENT'] = '(Не интеграционная)';
$MESS ['ERR_CHECK_JOURNAL'] = 'Ошибка при сохранении. Подробности в журнале событий';
$MESS ['ERROR_LINK_INTEGRATION_PAYMENT'] = 'Ошибка при сопоставлении интеграционных оплат';
$MESS ['ERROR_UPDATE_PAYMENT_TYPES_DELIVERY'] = 'Ошибка при обновлении способов оплаты для доставок';
$MESS ['INTEGRATION_PAYMENT_LABEL'] = 'При сопоставлении интеграционных оплат CRM, на стороне системы создаётся обычная оплата, к которой будут привязываться заказы.';
$MESS ['INTEGRATION_PAYMENT_LABEL'] = 'При сопоставлении интеграционных оплат CRM, на стороне системы создаётся обычная оплата, к которой будут привязываться заказы. <br> Если в вашей CRM используются интеграционные доставки, новый способ оплаты необходимо вручную активировать в настройках интеграций.';
$MESS ['NEED_PERMISSIONS_REFERENCE_LABEL'] = 'Для корректной работы опции апи-ключу необходимы доступы на получение и редактирование справочников';
$MESS ['FIX_UPLOAD_CUSTOMER_HEADER'] = 'Исправление даты регистрации клиентов в CRM';

View file

@ -0,0 +1,113 @@
<?php
namespace Intaro\RetailCrm\Component\Advanced;
use Bitrix\Main\ArgumentException;
use Bitrix\Main\EventManager;
use Bitrix\Main\ObjectPropertyException;
use Bitrix\Main\SystemException;
use Bitrix\Main\Type\DateTime;
use CUserTypeEntity;
use Intaro\RetailCrm\Component\Constants;
trait InstallerTrait
{
public function installExport()
{
$pathFrom = $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . Constants::MODULE_ID . '/install';
CopyDirFiles(
$pathFrom . '/export/bitrix/php_interface/include/catalog_export',
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export',
true,
true,
false
);
$pathFrom = $_SERVER['DOCUMENT_ROOT'] .
'/bitrix/modules/' .
Constants::MODULE_ID .
'/install/export/bitrix/js/intaro/export'
;
CopyDirFiles(
$pathFrom,
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/js/intaro/export/',
true,
true,
false
);
}
public function subscriptionSetup()
{
$pathFrom = $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . Constants::MODULE_ID . '/install';
CopyDirFiles(
$pathFrom . '/export/sub-register',
$_SERVER['DOCUMENT_ROOT'] . '/sub-register',
true,
true,
false
);
$templateNames = [
'default_subscribe' => [
0 => [
'name' => 'sale.personal.section',
'templateDirectory' => '.default'
],
1 => [
'name' => 'main.register',
'templateDirectory' => '.default_subscribe'
]
]
];
foreach ($templateNames as $directory => $templates) {
foreach ($templates as $template) {
$this->copy($directory, $template);
}
}
$property = [
'ENTITY_ID' => 'USER',
'FIELD_NAME' => 'UF_SUBSCRIBE_USER_EMAIL',
'USER_TYPE_ID' => 'boolean',
'MULTIPLE' => 'N',
'MANDATORY' => 'N',
'EDIT_FORM_LABEL' => ['ru' => GetMessage('UF_SUBSCRIBE_USER_EMAIL_TITLE')],
];
$obUserField = new CUserTypeEntity();
$dbRes = CUserTypeEntity::GetList([], ['FIELD_NAME' => 'UF_SUBSCRIBE_USER_EMAIL'])->fetch();
if (!$dbRes['ID']) {
$obUserField->Add($property);
}
}
private function copy($directory, $template): void
{
$templatePath = $_SERVER['DOCUMENT_ROOT']
. '/local/templates/.default/components/bitrix/' . $template['name'] . '/'. $directory
;
if (!file_exists($templatePath)) {
$pathFrom = $_SERVER['DOCUMENT_ROOT']
. '/bitrix/modules/intaro.retailcrm/install/export/local/components/intaro/'
. $template['name']
. '/templates/' . $template['templateDirectory']
;
CopyDirFiles(
$pathFrom,
$templatePath,
true,
true,
false
);
}
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace Intaro\RetailCrm\Component\Installer;
namespace Intaro\RetailCrm\Component\Advanced;
use Bitrix\Main\ArgumentException;
use Bitrix\Main\EventManager;
@ -17,7 +17,7 @@ use RCrmActions;
IncludeModuleLangFile(__FILE__);
trait InstallerTrait
class LoyaltyInstaller
{
/**
* Создание событий для программы лояльности
@ -67,7 +67,7 @@ trait InstallerTrait
CopyDirFiles(
$pathFrom . '/export',
$_SERVER['DOCUMENT_ROOT'],
true,
false,
true,
false
);
@ -86,17 +86,6 @@ trait InstallerTrait
'name' => 'main.register',
'templateDirectory' => '.default'
],
],
'default_subscribe' => [
0 => [
'name' => 'sale.personal.section',
'templateDirectory' => '.default'
],
1 => [
'name' => 'main.register',
'templateDirectory' => '.default_subscribe'
]
]
];
@ -108,7 +97,7 @@ trait InstallerTrait
}
/**
* Добавление полей пользователя для ПЛ и подписки
* Добавление полей пользователя для ПЛ
*/
public function addUserFields(): void
{
@ -150,10 +139,6 @@ trait InstallerTrait
[
'name' => 'UF_EXT_REG_PL_INTARO',
'title' => GetMessage('UF_EXT_REG_PL_INTARO_TITLE'),
],
[
'name' => 'UF_SUBSCRIBE_USER_EMAIL',
'title' => GetMessage('UF_SUBSCRIBE_USER_EMAIL_TITLE')
]
]
);
@ -176,9 +161,10 @@ trait InstallerTrait
'EDIT_FORM_LABEL' => ['ru' => $filed['title']],
];
$props = array_merge($arProps, $customProps);
$obUserField = new CUserTypeEntity();
$dbRes = CUserTypeEntity::GetList([], ['FIELD_NAME' => $filed['name']])->fetch();
$dbRes = CUserTypeEntity::GetList([], ['FIELD_NAME' => $filed['name']])->fetch();
if (!$dbRes['ID']) {
$obUserField->Add($props);
@ -232,23 +218,10 @@ trait InstallerTrait
}
}
public function createCustomPropertyFile(): void
{
$path = $_SERVER['DOCUMENT_ROOT'] . '/local/';
CheckDirPath($path);
$file = new \Bitrix\Main\IO\File($path . 'icml_property_retailcrm.txt', $siteId = null);
if (!$file->isExists()) {
$file->putContents("");
}
}
/**
* delete loyalty program events handlers
*/
private function deleteLPEvents(): void
public function deleteLPEvents(): void
{
$eventManager = EventManager::getInstance();
@ -256,7 +229,7 @@ trait InstallerTrait
$eventManager->unRegisterEventHandler(
$event['FROM_MODULE'],
$event['EVENT_NAME'],
$this->MODULE_ID,
Constants::MODULE_ID,
EventsHandlers::class,
$event['EVENT_NAME'].'Handler'
);
@ -279,7 +252,7 @@ trait InstallerTrait
CopyDirFiles(
$pathFrom,
$templatePath,
true,
false,
true,
false
);

View file

@ -548,6 +548,36 @@ class ConfigProvider
return static::getOption(Constants::CRM_ORDER_LAST_ID);
}
/**
* getLastOrderUpdate
*
* @return bool|string|null
*/
public static function getLastOrderUpdate()
{
return static::getOption(Constants::LAST_ORDER_UPDATE);
}
/**
* setLastOrderUpdate
*
* @return bool|string|null
*/
public static function setLastOrderUpdate($value)
{
static::setOption(Constants::LAST_ORDER_UPDATE, $value);
}
/**
* getOrderDischarge
*
* @return bool|string|null
*/
public static function getOrderDischarge()
{
return static::getOption(Constants::CRM_ORDER_DISCHARGE);
}
/**
* getSendPaymentAmount
*

View file

@ -18,6 +18,7 @@ namespace Intaro\RetailCrm\Component;
*/
class Constants
{
public const MODULE_VERSION = '6.6.11';
public const CRM_PURCHASE_PRICE_NULL = 'purchasePrice_null';
public const BITRIX_USER_ID_PREFIX = 'bitrixUserId-';
public const CRM_USERS_MAP = 'crm_users_map';
@ -69,6 +70,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 +130,9 @@ 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';
public const LAST_ORDER_UPDATE = 'last_order_update';
}

View file

@ -83,7 +83,8 @@ class EventsHandlers
$isWriteOffAvailable = $bonusInput > 0
&& $availableBonuses > 0
&& $jsDataTotal['ORDER_TOTAL_PRICE'] >= $bonusDiscount + $loyaltyDiscountInput;
&& $jsDataTotal['ORDER_TOTAL_PRICE'] >= $bonusDiscount + $loyaltyDiscountInput
;
if ($isWriteOffAvailable || $loyaltyDiscountInput > 0) {
$jsDataTotal['ORDER_TOTAL_PRICE']
@ -133,10 +134,6 @@ class EventsHandlers
/** @var Order $order */
$order = $event->getParameter('ENTITY');
// TODO: Replace old call with a new one.
$saveResult = RetailCrmEvent::orderSave($order);
Utils::handleApiErrors($saveResult);
$isBonusInput = (
!empty($_POST['bonus-input'])
&& !empty($_POST['available-bonuses'])
@ -181,9 +178,7 @@ class EventsHandlers
//Если есть бонусы
if ($isBonusesIssetAndAvailable) {
$applyBonusResponse = $loyaltyService->applyBonusesInOrder($order, $bonusFloat);
$hlInfoBuilder->setApplyResponse($applyBonusResponse);
$hlInfoBuilder->setApplyResponse($loyaltyService->applyBonusesInOrder($order, $bonusFloat));
$loyaltyBonusMsg = $bonusFloat;
$hlInfoBuilder->setBonusCountTotal($bonusFloat);
}
@ -191,7 +186,6 @@ class EventsHandlers
//Если бонусов нет, но скидка по ПЛ есть
if (
($isDataForLoyaltyDiscount && !$isBonusInput)
|| ($applyBonusResponse instanceof OrderLoyaltyApplyResponse && !$applyBonusResponse->order)
) {
$loyaltyService->saveDiscounts($order, $calculateItemsInput);
}

View file

@ -0,0 +1,95 @@
<?php
namespace Intaro\RetailCrm\Controller;
use Bitrix\Main\Engine\Controller;
use Bitrix\Main\Result;
use Bitrix\Main\Error;
use Bitrix\Main\Application;
use Intaro\RetailCrm\Icml\SettingsService;
/**
* @category Integration
* @package Intaro\RetailCrm\Controller
* @author RetailCRM <integration@retailcrm.ru>
* @license MIT
* @link http://retailcrm.ru
* @see http://retailcrm.ru/docs
*/
class CustomExportProps extends Controller
{
private function getRequestData(): array
{
$data = $this->getRequest()->getInput();
if ($data === null) {
}
return json_decode($data, true);
}
public function saveAction()
{
$requestData = $this->getRequestData();
$props = $requestData['properties'];
$profileId = $requestData['profileId'];
$settingsService = SettingsService::getInstance(
[],
null,
$profileId
);
$idCategories = array_keys($props);
if ($idCategories !== []) {
$settingsService->setProfileCatalogs($idCategories);//сразу заменяет и create и update
}
foreach ($props as $catalogId => $propsArray) {
$catalogCustomProps = [];
foreach ($propsArray as $property) {
$catalogCustomProps[] = [
'code' => $property['code'],
'title' => $property['title']
];
}
$settingsService
->setCatalogCustomPropsOptionName($catalogId)
->saveCustomProps($catalogCustomProps)
;
}
}
public function deleteAction()
{
$requestData = $this->getRequestData();
$props = $requestData['properties'];
$profileId = $requestData['profileId'];
$settingsService = SettingsService::getInstance(
[],
null,
$profileId
);
foreach ($props as $catalogId => $propsArray) {
$catalogCustomProps = [];
foreach ($propsArray as $property) {
$catalogCustomProps[] = [
'code' => $property['code'],
'title' => $property['title']
];
}
$settingsService
->setCatalogCustomPropsOptionName($catalogId)
->removeCustomProps($catalogCustomProps, $catalogId)
;
}
}
}

View file

@ -163,7 +163,7 @@ class IcmlWriter
$this->writeOptionalSimpleElement('vatRate', $offer->vatRate);
$this->writeOptionalSimpleElement('weight', $offer->weight);
$this->writeOptionalSimpleElement('dimensions', $offer->dimensions);
$this->writeOptionalSimpleElement('purchasePrice', $offer->purchasePrice);
$this->writeOptionalPurchasePrice($offer->purchasePrice);
$this->writer->endElement();
}
@ -180,6 +180,16 @@ class IcmlWriter
}
}
/**
* Запись закупочной стоимости
*
* @param $value
*/
private function writeOptionalPurchasePrice($value): void
{
$this->writeSimpleElement('purchasePrice', !empty($value) ? $value : 0);
}
/**
* @param string $name
* @param $value

View file

@ -8,14 +8,19 @@ use CCatalogGroup;
use CCatalogSku;
use CCatalogVat;
use CIBlock;
use COption;
use Bitrix\Main\Config\Option;
use Intaro\RetailCrm\Service\Hl;
use RetailcrmConfigProvider;
use Bitrix\Main\Application;
use Bitrix\Main\Entity\Query;
/**
* Отвечает за управление настройками выгрузки icml каталога
*
* @var $PROFILE_ID - зачем если получаем в в конструкторе инстансе
* Class SettingsService
*
*
* @package Intaro\RetailCrm\Icml
*/
class SettingsService
@ -32,6 +37,14 @@ class SettingsService
*/
public const INFOBLOCK_WITH_SKU = 'P';
private const MODULE_ID = 'intaro.retailcrm';
private string $catalogCustomPropsOptionName;
private string $profileCatalogsOptionName;
private string $exportProfileId;
/**
* @var array
*/
@ -98,7 +111,13 @@ class SettingsService
public $loadNonActivity;
/** @var array */
public $actrualPropList = [];
public $actualPropList = [];
/** @var array */
public $customPropList = [];
/** @var array */
public $defaultPropList = [];
/**
* @var \Intaro\RetailCrm\Icml\SettingsService|null
@ -112,7 +131,7 @@ class SettingsService
* @param array $arOldSetupVars
* @param string|null $action
*/
private function __construct(array $arOldSetupVars, ?string $action)
private function __construct(array $arOldSetupVars, ?string $action, ?string $profileId)
{
$this->arOldSetupVars = $arOldSetupVars;
$this->action = $action;
@ -128,7 +147,15 @@ class SettingsService
$this->getPriceTypes();
$this->getVatRates();
$this->actrualPropList = array_merge($this->getIblockPropsPreset(), $this->parseNewProps());
$this->exportProfileId = $profileId ?? '0';
$this->profileCatalogsOptionName = sprintf('exportProfileId_%s_catalogs', $this->exportProfileId);
$this->linkNewProfile();
$this->deleteEmptyProfileCatalogs();
$this->customPropList = $this->getNewProps();
$this->defaultPropList = $this->getIblockPropsPreset();
$this->actualPropList = $this->getActualPropList();
}
/**
@ -137,16 +164,29 @@ class SettingsService
*
* @return \Intaro\RetailCrm\Icml\SettingsService|null
*/
public static function getInstance(array $arOldSetupVars, ?string $action): ?SettingsService
public static function getInstance(array $arOldSetupVars, ?string $action, ?string $profileId): ?SettingsService
{
if (is_null(self::$instance)) {
self::$instance = new self($arOldSetupVars, $action);
self::$instance = new self($arOldSetupVars, $action, $profileId);
}
return self::$instance;
}
public function getPriceTypes()
private function getActualPropList(): array
{
$customProps = [];
foreach ($this->customPropList as $propsByCatalog) {
foreach ($propsByCatalog as $code => $value) {
$customProps[$code] = $value;
}
}
return array_merge($this->defaultPropList, $customProps);
}
private function getPriceTypes()
{
$dbPriceType = CCatalogGroup::GetList(['SORT' => 'ASC'], [], [], [], ['ID', 'NAME', 'BASE']);
@ -155,7 +195,7 @@ class SettingsService
}
}
public function getVatRates()
private function getVatRates()
{
$dbVatRate = CCatalogVat::GetListEx(['SORT' => 'ASC'], ['ACTIVE' => 'Y'], false, false, ['ID', 'NAME', 'RATE']);
@ -230,7 +270,9 @@ class SettingsService
private function setProperties(array &$properties, string $propName): void
{
foreach ($this->arOldSetupVars[$propName] as $iblock => $val) {
$properties[$iblock][$propName] = $val;
if (!empty($val)) {
$properties[$iblock][$propName] = $val;
}
}
}
@ -260,27 +302,22 @@ class SettingsService
];
}
private function parseNewProps(): array
private function getNewProps(): array
{
global $APPLICATION;
$result = [];
$text = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"] . "/local/icml_property_retailcrm.txt");
$currentProfileCatalogIds = $this->getProfileCatalogs();
if ($text === false) {
return $result;
}
if (!is_null($currentProfileCatalogIds)) {
foreach ($currentProfileCatalogIds as $catalogId) {
$catalogCustomProps = $this
->setCatalogCustomPropsOptionName($catalogId)
->getCustomProps()
;
preg_match_all('/\w+\s*=\s*\w+[ *\w+]*/mu', $text, $matches);
foreach ($matches[0] as $newProp) {
$elements = explode("=", $newProp);
if (empty($elements[0]) || empty($elements[1])) {
continue;
foreach ($catalogCustomProps as $prop) {
$result[$catalogId][$prop['code']] = $prop['title'];
}
}
$result[trim($elements[0])] = trim($elements[1]);
}
return $result;
@ -289,7 +326,7 @@ class SettingsService
/**
* @return array
*/
public function getHintProps(): array
private function getHintProps(): array
{
return [
'article' => ['ARTICLE', 'ART', 'ARTNUMBER', 'ARTICUL', 'ARTIKUL'],
@ -365,7 +402,7 @@ class SettingsService
public function setProps(): void
{
foreach (array_keys($this->actrualPropList) as $prop) {
foreach (array_keys($this->actualPropList) as $prop) {
$this->setProperties($this->iblockPropertySku, 'iblockPropertySku_' . $prop);
$this->setProperties($this->iblockPropertyUnitSku, 'iblockPropertyUnitSku_' . $prop);
$this->setProperties($this->iblockPropertyProduct, 'iblockPropertyProduct_' . $prop);
@ -548,7 +585,7 @@ class SettingsService
*
* @return array
*/
public function getSiteList(int $iblockId): array
private function getSiteList(int $iblockId): array
{
$siteList = [];
@ -576,7 +613,9 @@ class SettingsService
$dbSkuProperties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], [], ['MULTIPLE' => 'N']);
while ($prop = $dbSkuProperties->Fetch()) {
$propertiesSKU[] = $prop;
if ($prop['CODE'] !== '') {
$propertiesSKU[] = $prop;
}
}
}
@ -597,7 +636,7 @@ class SettingsService
$props = [];
if (isset($oldValues[$iblockId])) {
foreach (array_keys($this->actrualPropList) as $prop) {
foreach (array_keys($this->actualPropList) as $prop) {
$fullKey = $keyGroup . '_' . $prop;
$props[$prop] = $oldValues[$iblockId][$fullKey];
}
@ -623,14 +662,16 @@ class SettingsService
*
* @return array|null
*/
public function getProductProps(int $iblockId): ?array
private function getProductProps(int $iblockId): ?array
{
$propertiesProduct = null;
$iblockResult = CIBlock::GetProperties($iblockId, [], ['MULTIPLE' => 'N']);
while ($prop = $iblockResult->Fetch()) {
$propertiesProduct[] = $prop;
if ($prop['CODE'] !== '') {
$propertiesProduct[] = $prop;
}
}
return $propertiesProduct;
@ -642,7 +683,7 @@ class SettingsService
*
* @return bool
*/
public function isExport($iblockId, $iblockExport): bool
private function isExport($iblockId, $iblockExport): bool
{
if (is_array($iblockExport) && count($iblockExport) !== 0) {
return (in_array($iblockId, $iblockExport));
@ -747,4 +788,152 @@ class SettingsService
return [$arIBlockList, $intCountChecked, $intCountAvailIBlock, $arIBlockList['iblockExport'] ?? false];
}
public function setCatalogCustomPropsOptionName(string $catalogId): self
{
$this->catalogCustomPropsOptionName = sprintf(
'exportCustomProps_ProfileId_%s_catalogId_%s',
$this->exportProfileId,
$catalogId
);
return $this;
}
private function getCustomProps(): ?array
{
$props = unserialize(COption::GetOptionString(self::MODULE_ID, $this->catalogCustomPropsOptionName));
if (!$props) {
return null;
}
return $props;
}
public function removeCustomProps(array $propsToDelete, string $catalogId): void
{
$currentCatalogProps = $this->getCustomProps();
$updatedCatalogProps = array_values(
array_filter(
$currentCatalogProps,
fn ($currentProp) => !in_array($currentProp, $propsToDelete)
));
if (empty($updatedCatalogProps)) {
$this->deleteOptionEntry($this->catalogCustomPropsOptionName);
$this->deleteProfileCatalog($catalogId);
} else {
$this->updateCustomProps($updatedCatalogProps);
}
}
private function updateCustomProps(array $updatedProps)
{
$serializedProps = serialize($updatedProps);
$this->updateOptionEntry($this->catalogCustomPropsOptionName, $serializedProps);
}
private function setCustomProps(array $props)
{
$propsString = serialize($props);
$this->setOptionEntry($this->catalogCustomPropsOptionName, $propsString);
}
public function saveCustomProps(array $newProps): void
{
$currentProps = $this->getCustomProps();
if (is_null($currentProps)) {
$this->setCustomProps($newProps);
} else {
$updatedProps = array_merge($currentProps, $newProps);
$this->updateCustomProps($updatedProps);
}
}
private function getProfileCatalogs(): ?array
{
$catalogs = unserialize(COption::GetOptionString(self::MODULE_ID, $this->profileCatalogsOptionName));
if (!$catalogs) {
return null;
}
return $catalogs;
}
public function setProfileCatalogs(array $catalogsId): void
{
$catalogs = serialize($catalogsId);
$this->setOptionEntry($this->profileCatalogsOptionName, $catalogs);
}
private function deleteProfileCatalog(string $catalogId): void
{
$currentCatalogs = $this->getProfileCatalogs();
$catalogIdIndex = array_search($catalogId, $currentCatalogs);
if ($catalogIdIndex !== false) {
unset($currentCatalogs[$catalogIdIndex]);
}
$updatedCatalogs = serialize($currentCatalogs);
$this->updateOptionEntry($this->profileCatalogsOptionName, $updatedCatalogs);
}
private function deleteEmptyProfileCatalogs(): void
{
$currentCatalogs = $this->getProfileCatalogs();
if (is_null($currentCatalogs)) {
$this->deleteOptionEntry($this->profileCatalogsOptionName);
}
}
private function setOptionEntry(string $name, string $value)
{
COption::SetOptionString(self::MODULE_ID, $name, $value);
}
private function updateOptionEntry(string $name, string $value)
{
COption::SetOptionString(self::MODULE_ID, $name, '');
COption::SetOptionString(self::MODULE_ID, $name, $value);
}
private function deleteOptionEntry(string $name)
{
COption::RemoveOption(self::MODULE_ID, $name);
}
private function linkNewProfile(): void
{
$currentProfileCatalogs = unserialize(COption::GetOptionString(self::MODULE_ID, $this->profileCatalogsOptionName));
if (!$currentProfileCatalogs) {
$tmpProfileName = 'exportProfileId_0_catalogs';
$currentProfileCatalogs = unserialize(COption::GetOptionString(self::MODULE_ID, $tmpProfileName));
if ($currentProfileCatalogs) {
$this->setOptionEntry($this->profileCatalogsOptionName, serialize($currentProfileCatalogs));
$this->deleteOptionEntry($tmpProfileName);
}
}
foreach ($currentProfileCatalogs as $catalogId) {
$optionName = sprintf('exportCustomProps_ProfileId_%s_catalogId_%s', $this->exportProfileId, $catalogId);
$propsCatalog = unserialize(COption::GetOptionString(self::MODULE_ID, $optionName));
if (!$propsCatalog) {
$tmpOptionName = sprintf('exportCustomProps_ProfileId_%s_catalogId_%s', '0', $catalogId);
$propsCatalog = unserialize(COption::GetOptionString(self::MODULE_ID, $tmpOptionName));
if ($propsCatalog) {
$this->setOptionEntry($optionName, serialize($propsCatalog));
$this->deleteOptionEntry($tmpOptionName);
}
}
}
}
}

View file

@ -115,8 +115,8 @@ class XmlOfferBuilder
public function __construct(XmlSetup $setup, array $measure, ?string $serverName)
{
$this->setup = $setup;
$this->setSettingsService();
$this->purchasePriceNull = RetailcrmConfigProvider::getCrmPurchasePrice();
$this->settingsService = SettingsService::getInstance([], '');
$this->vatRates = $this->settingsService->vatRates;
$this->measures = $this->prepareMeasures($measure);
$this->serverName = $serverName;
@ -141,6 +141,12 @@ class XmlOfferBuilder
return $this->xmlOffer;
}
private function setSettingsService(): void
{
global $PROFILE_ID;
$this->settingsService = SettingsService::getInstance([], '', $PROFILE_ID);
}
/**
* @param array $categories
*/
@ -479,7 +485,7 @@ class XmlOfferBuilder
private function createParamObject(array $params): array
{
$offerParams = [];
$names = $this->settingsService->actrualPropList;
$names = $this->settingsService->actualPropList;
foreach ($params as $code => $value) {
@ -578,15 +584,13 @@ class XmlOfferBuilder
/**
* Метод для проверки можно ли маркировать товар.
*
* Таблица в БД - b_hlsys_marking_code_group
* По умолчанию ID Highload-блока ProductMarkingCodeGroup - 1.
*
* @param $offerId
* @return void
*
* @return string|null
*/
private function isMarkableOffer($offerId): ?string
{
$idHlBlock = 1;
$idHlBlock = $this->getHighloadBlockIdByName('ProductMarkingCodeGroup');
$hlBlock = HighloadBlockTable::getById($idHlBlock)->fetch();
$hlBlockData = HighloadBlockTable::compileEntity($hlBlock)->getDataClass();
$userFieldManager = UserFieldHelper::getInstance()->getManager();
@ -601,4 +605,21 @@ class XmlOfferBuilder
return $isMarkableOffer;
}
/**
* Метод для получения ID Highload-блока по названию блока.
*
* Таблица в БД - b_hlsys_marking_code_group
* По умолчанию ID Highload-блока ProductMarkingCodeGroup - 1.
*
* @param $blockName
*
* @return mixed|null
*/
private function getHighloadBlockIdByName($blockName)
{
$hlBlock = HighloadBlockTable::getList(['filter' => ['NAME' => $blockName], 'select' => ['ID']])->fetch();
return $hlBlock['ID'] ?? 1;
}
}

View file

@ -0,0 +1,20 @@
<?php
$MESS['REG_COMPLETE'] = 'Account in the loyalty program is created and activated';
$MESS['FIELD_ERROR'] = 'To activate participation in the loyalty program, the following fields should be filled in for the customer:';
$MESS['ACTIVATE_YOUR_ACCOUNT'] = 'Account in the loyalty program is created, but not activated. Please fill out the form to activate it.';
$MESS['ACTIVATE'] = 'Activate';
$MESS['SMS_VERIFICATION'] = 'To activate your account you need to enter the verification code that was sent to your phone';
$MESS['SEND'] = 'Send';
$MESS['COMPLETE_YOUR_REGISTRATION'] = 'To complete the registration in the Loyalty Program, you need to fill out the form.';
$MESS['CREATE'] = 'Create';
$MESS['TRY_AGAIN'] = 'Try Again';
$MESS['INVITATION_TO_REGISTER'] = 'To register for the Loyalty Program, fill out the form.';
$MESS['REGISTER_ERROR'] = 'Error of registration in the Loyalty Program';
$MESS['ACTIVATE_ERROR'] = 'Error of account activation in the Loyalty Program.';
$MESS['DEBITING_BONUSES_ERROR'] = 'Error writing off bonuses.';
$MESS['RUB'] = 'rub.';
$MESS['BONUS_MESSAGE'] = '. Payment with bonuses: ';
$MESS['NEW_BONUS_EVENT'] = 'The number of bonuses in the order has been changed to ';
$MESS['LP_BONUS_INFO'] = 'Loyalty program bonuses';
$MESS['RUB'] = 'rub.';
$MESS['BONUSES'] = 'bonuses';

View file

@ -7,6 +7,7 @@ use Bitrix\Main\LoaderException;
use Bitrix\Main\SystemException;
use Bitrix\Main\UI\Extension;
use Bitrix\Sale\Delivery\Services\Manager;
use Bitrix\Sale\Internals\OrderTable;
use Intaro\RetailCrm\Component\ApiClient\ClientAdapter;
use Intaro\RetailCrm\Component\ConfigProvider;
use Intaro\RetailCrm\Component\Constants;
@ -16,58 +17,14 @@ use Intaro\RetailCrm\Service\CurrencyService;
use Intaro\RetailCrm\Service\OrderLoyaltyDataService;
use Intaro\RetailCrm\Service\Utils as RetailCrmUtils;
use RetailCrm\Exception\CurlException;
use Intaro\RetailCrm\Component\Advanced\LoyaltyInstaller;
IncludeModuleLangFile(__FILE__);
$mid = 'intaro.retailcrm';
$uri = $APPLICATION->GetCurPage() . '?mid=' . htmlspecialchars($mid) . '&lang=' . LANGUAGE_ID;
include (__DIR__ . '/lib/component/advanced/loyaltyinstaller.php');
$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';
$mid = 'intaro.retailcrm';
$loyaltyEventClass = 'Intaro\RetailCrm\Component\Handlers\EventsHandlers';
$uri = $APPLICATION->GetCurPage() . '?mid=' . htmlspecialchars($mid) . '&lang=' . LANGUAGE_ID;
if (!CModule::IncludeModule('intaro.retailcrm') || !CModule::IncludeModule('sale') || !CModule::IncludeModule('iblock') || !CModule::IncludeModule('catalog')) {
return;
@ -89,6 +46,7 @@ if (!empty($_GET['ok']) && $_GET['ok'] === 'Y') {
$arResult = [];
$enabledCustom = false;
$loyaltySetup = new LoyaltyInstaller();
if (file_exists($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/intaro.retailcrm/classes/general/config/options.xml')) {
$options = simplexml_load_file($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/intaro.retailcrm/classes/general/config/options.xml');
@ -129,9 +87,9 @@ 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);
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, 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,12 +105,12 @@ 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) {
foreach ($arDeliveryServiceAll as $deliveryService) {
if ($deliveryService['PARENT_ID'] != 0 && $deliveryService['PARENT_ID'] === $key) {
if ($deliveryService['PARENT_ID'] != 0 && $deliveryService['PARENT_ID'] == $key) {
try {
$api->deliveryServicesEdit(RCrmActions::clearArr([
'code' => 'bitrix-' . $deliveryService['ID'],
@ -354,23 +312,67 @@ 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
// 2 - agent without update
$orderDischarge = (int) htmlspecialchars(trim($_POST['order-discharge']));
if (($orderDischarge != $previousDischarge) && ($orderDischarge === 0)) {
if (($orderDischarge != $previousDischarge) && ($orderDischarge === 0 || $orderDischarge === 2 )) {
// remove depenedencies
UnRegisterModuleDependences('sale', 'OnOrderUpdate', $mid, 'RetailCrmEvent', "onUpdateOrder");
UnRegisterModuleDependences('sale', 'OnSaleOrderDeleted', $mid, 'RetailCrmEvent', "orderDelete");
UnRegisterModuleDependences('sale', 'OnSaleOrderSaved', $mid, 'RetailCrmEvent', "orderSave");
UnRegisterModuleDependences('sale', 'OnOrderUpdate', $mid, 'RetailCrmEvent', "onUpdateOrder");
UnRegisterModuleDependences('sale', 'OnSaleOrderSaved', $mid, $loyaltyEventClass, 'OnSaleOrderSavedHandler');
UnRegisterModuleDependences('sale', 'OnSaleComponentOrderResultPrepared', $mid, $loyaltyEventClass, 'OnSaleComponentOrderResultPreparedHandler');
ConfigProvider::setLoyaltyProgramStatus('N');
$dateAgent = new DateTime();
$intAgent = new DateInterval('PT60S');
$dateAgent->add($intAgent);
CAgent::AddAgent(
'RCrmActions::uploadOrdersAgent();',
$mid,
'N',
180,
$dateAgent->format('d.m.Y H:i:s'),
'Y',
$dateAgent->format('d.m.Y H:i:s'),
30
);
if ($orderDischarge === 0) {
COption::SetOptionString($mid, Constants::LAST_ORDER_UPDATE, date("Y-m-d H:i:s"));
} else {
COption::RemoveOption($mid, Constants::LAST_ORDER_UPDATE);
}
$dbOrder = OrderTable::GetList([
'order' => ['ID' => 'DESC'],
'limit' => 1,
'select' => ['ID'],
]);
$arOrder = $dbOrder->fetch();
if ($dbOrder) {
COption::SetOptionString($mid, Constants::CRM_ORDER_LAST_ID, $arOrder['ID']);
} else {
COption::SetOptionString($mid, Constants::CRM_ORDER_LAST_ID, 0);
}
} elseif (($orderDischarge != $previousDischarge) && ($orderDischarge === 1)) {
// event dependencies
RegisterModuleDependences('sale', 'OnOrderUpdate', $mid, 'RetailCrmEvent', "onUpdateOrder");
RegisterModuleDependences('sale', 'OnSaleOrderDeleted', $mid, 'RetailCrmEvent', "orderDelete");
RegisterModuleDependences('sale', 'OnSaleOrderSaved', $mid, 'RetailCrmEvent', "orderSave");
COption::RemoveOption($mid, Constants::LAST_ORDER_UPDATE);
CAgent::RemoveAgent("RCrmActions::uploadOrdersAgent();", $mid);
}
$optionCart = COption::GetOptionString($mid, $CRM_CART, 'N');
$optionCart = COption::GetOptionString($mid, Constants::CART, 'N');
$cart = htmlspecialchars(trim($_POST['cart']));
@ -595,7 +597,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,25 +623,32 @@ 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') {
try {
$loyaltySetup->CopyFiles();
$loyaltySetup->addEvents();
$loyaltySetup->addAgreement();
$loyaltySetup->addUserFields();
$hlName = RetailCrmUtils::getHlClassByName(Constants::HL_LOYALTY_CODE);
if (empty($hlName)) {
OrderLoyaltyDataService::createLoyaltyHlBlock();
$service = new OrderLoyaltyDataService();
$service->addCustomersLoyaltyFields();
}
} catch (LoaderException | SystemException $exception) {
} catch (Exception $exception) {
RCrmActions::eventLog(
'intaro.retailcrm/options.php', 'OrderLoyaltyDataService::createLoyaltyHlBlock',
$e->getCode() . ': ' . $exception->getMessage()
@ -649,6 +658,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
ConfigProvider::setLoyaltyProgramStatus('Y');
} else {
ConfigProvider::setLoyaltyProgramStatus('N');
UnRegisterModuleDependences('sale', 'OnSaleOrderSaved', $mid, $loyaltyEventClass, 'OnSaleOrderSavedHandler');
UnRegisterModuleDependences('sale', 'OnSaleComponentOrderResultPrepared', $mid, $loyaltyEventClass, 'OnSaleComponentOrderResultPreparedHandler');
}
try {
@ -706,17 +717,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 +747,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 +773,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 +781,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'
);
@ -866,7 +877,9 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
$substitutionPaymentList[$integrationPayment] = $codePayment;
foreach ($originalPayment['deliveryTypes'] as $codeDelivery) {
if (!isset($arResult['deliveryTypesList'][$codeDelivery])) {
if (!isset($arResult['deliveryTypesList'][$codeDelivery]) ||
isset($arResult['deliveryTypesList'][$codeDelivery]['integrationCode'])
) {
continue;
}
@ -910,7 +923,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 +933,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 +973,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 +1002,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 +1028,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 +1078,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 +1091,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 +1252,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 +1352,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 +1369,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 +1400,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 +1418,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);
@ -3044,9 +3057,17 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
<label><input class="addr" type="radio" name="order-discharge" value="0" <?php if ($optionsDischarge === 0) {
echo "checked";
} ?>><?php echo GetMessage('DISCHARGE_AGENT'); ?></label>
<label><input class="addr" type="radio" name="order-discharge" value="2" <?php if ($optionsDischarge === 2) {
echo "checked";
} ?>><?php echo GetMessage('DISCHARGE_WITHOUT_UPDATE'); ?></label>
</b>
</td>
</tr>
<tr>
<td colspan="2" class="option-head option-other-top option-other-bottom" style="color:#c24141">
<b><?php echo GetMessage('LP_WARNING'); ?></b>
</td>
</tr>
<tr>
<td colspan="2" class="option-head option-other-top option-other-bottom">
<b><?php echo GetMessage('COUPON_CUSTOM_FIELD'); ?></b>

1291
intaro.retailcrm/updater.php Normal file → Executable file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,110 @@
<?php
namespace classes\general\cart;
use DateTime;
use Mockery;
use PHPUnit\Framework\TestCase;
use RCrmActions;
use RetailCrmCart;
class RetailCrmCartTest extends TestCase
{
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testSetBasket(): void
{
$arBasket = $this->getBasket();
$crmBasket = $this->getCrmCart();
$actionsMock = Mockery::mock('alias:' . RCrmActions::class);
$actionsMock->shouldReceive('apiMethod')->withAnyArgs()->andReturn($crmBasket, ['success' => true]);
$result = RetailCrmCart::handlerCart($arBasket);
self::assertTrue($result['success']);
}
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testClearBasket(): void
{
$arBasket = ['LID' => 's1', 'USER_ID' => '1'];
$crmBasket = $this->getCrmCart();
$actionsMock = Mockery::mock('alias:' . RCrmActions::class);
$actionsMock->shouldReceive('apiMethod')->withAnyArgs()->andReturn($crmBasket, ['success' => true]);
$result = RetailCrmCart::handlerCart($arBasket);
self::assertTrue($result['success']);
}
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testIgnoreChangeBasket()
{
$arBasket = ['LID' => 's1', 'USER_ID' => '1'];
$crmBasket = [];
$actionsMock = Mockery::mock('alias:' . RCrmActions::class);
$actionsMock->shouldReceive('apiMethod')->withAnyArgs()->andReturn($crmBasket);
$result = RetailCrmCart::handlerCart($arBasket);
self::assertNull($result);
}
public function testGenerateCartLink()
{
$cartLink = RetailCrmCart::generateCartLink();
self::assertNotNull($cartLink);
self::assertContains('/personal/cart', $cartLink);
}
/**
* @return array
*/
public function getBasket(): array
{
return [
'LID' => 's1',
'USER_ID' => '1',
'BASKET' => [
[
'QUANTITY' => 2,
'PRICE' => 100,
'DATE_INSERT' => new DateTime('now'),
'DATE_UPDATE' => new DateTime('now'),
'PRODUCT_ID' => '10'
],
[
'QUANTITY' => 1,
'PRICE' => 300,
'DATE_INSERT' => new DateTime('now'),
'DATE_UPDATE' => new DateTime('now'),
'PRODUCT_ID' => '2'
],
],
];
}
/**
* @return array
*/
public function getCrmCart(): array
{
return [
'cart' => [
'items' => 'items'
]
];
}
}

View file

@ -271,67 +271,12 @@ class RetailCrmEventTest extends PHPUnit\Framework\TestCase
'ORDER_PROP' => []
];
$result = RetailCrmEvent::OnUpdateOrder(1, $arFields);
RetailCrmEvent::OnUpdateOrder(1, $arFields);
$this->assertEquals(true, $GLOBALS['RETAILCRM_ORDER_OLD_EVENT']);
$this->assertEquals(true, $GLOBALS['ORDER_DELETE_USER_ADMIN']);
}
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testSetBasket(): void
{
$arBasket = $this->getBasket();
$crmBasket = $this->getCrmCart();
$actionsMock = Mockery::mock('alias:' . RCrmActions::class);
$actionsMock->shouldReceive('apiMethod')->withAnyArgs()->andReturn($crmBasket, ['success' => true]);
$result = RetailCrmCart::handlerCart($arBasket);
self::assertTrue($result['success']);
}
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testClearBasket(): void
{
$arBasket = ['LID' => 's1', 'USER_ID' => '1'];
$crmBasket = $this->getCrmCart();
$actionsMock = Mockery::mock('alias:' . RCrmActions::class);
$actionsMock->shouldReceive('apiMethod')->withAnyArgs()->andReturn($crmBasket, ['success' => true]);
$result = RetailCrmCart::handlerCart($arBasket);
self::assertTrue($result['success']);
}
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testIgnoreChangeBasket()
{
$arBasket = ['LID' => 's1', 'USER_ID' => '1'];
$crmBasket = [];
$actionsMock = Mockery::mock('alias:' . RCrmActions::class);
$actionsMock->shouldReceive('apiMethod')->withAnyArgs()->andReturn($crmBasket);
$result = RetailCrmCart::handlerCart($arBasket);
self::assertNull($result);
}
/**
* @return array
*/
@ -392,43 +337,4 @@ class RetailCrmEventTest extends PHPUnit\Framework\TestCase
$GLOBALS['RETAILCRM_ORDER_OLD_EVENT'] = true;
$GLOBALS['RETAILCRM_ORDER_DELETE'] = false;
}
/**
* @return array
*/
public function getBasket(): array
{
return [
'LID' => 's1',
'USER_ID' => '1',
'BASKET' => [
[
'QUANTITY' => 2,
'PRICE' => 100,
'DATE_INSERT' => new DateTime('now'),
'DATE_UPDATE' => new DateTime('now'),
'PRODUCT_ID' => '10'
],
[
'QUANTITY' => 1,
'PRICE' => 300,
'DATE_INSERT' => new DateTime('now'),
'DATE_UPDATE' => new DateTime('now'),
'PRODUCT_ID' => '2'
],
],
];
}
/**
* @return array
*/
public function getCrmCart(): array
{
return [
'cart' => [
'items' => 'items'
]
];
}
}

View file

@ -13,28 +13,6 @@ class EventsHandlersTest extends \BitrixTestCase
CModule::IncludeModule('intaro.retailcrm');
}
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testOnSaleOrderSavedHandler()
{
$order = \Bitrix\Sale\Order::create('s1', 2, 'RUB');
$order->setPersonTypeId(2);
$event = $this->createMock(\Bitrix\Main\Event::class);
$event->method('getParameter')->willReturn($order);
$spy = \Mockery::spy('overload:' .RetailCrmEvent::class);
EventsHandlers::OnSaleOrderSavedHandler($event);
//Проверяет, был ли вызван метод класса. Если метод не вызывался, выдает ошибку теста
//Если метод вызывался, ошибку не выдает, но phpunit выдает сообщение об отсутствии тестов
$spy->shouldHaveReceived('orderSave');
self::assertTrue(true);
}
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
@ -56,4 +34,4 @@ class EventsHandlersTest extends \BitrixTestCase
$spy->shouldNotHaveReceived('orderSave');
self::assertTrue(true);
}
}
}

View file

@ -17,25 +17,6 @@ class SettingServiceTest extends \BitrixTestCase
;
}
public function testConstruct(): SettingsService
{
$path = $_SERVER['DOCUMENT_ROOT'] . '/local/';
CheckDirPath($path);
$file = new \Bitrix\Main\IO\File($path . '/icml_property_retailcrm.txt', $siteId = null);
$file->putContents("property1 = test prop \n property2 = test prop 2");
$settingService = SettingsService::getInstance($this->getSetupVars(), "");
$this->assertInstanceOf(SettingsService::class, $settingService);
$this->assertArrayHasKey('property1', $settingService->actrualPropList);
$this->assertArrayHasKey('property2', $settingService->actrualPropList);
return $settingService;
}
private function getSetupVars()
{
return [