This commit is contained in:
parent
8db6531fc8
commit
7404105dec
@ -1,3 +1,6 @@
|
||||
## 2023-10-10 v.6.4.7
|
||||
- Изменена логика передачи адреса доставки в заказе из Bitrix в CRM
|
||||
|
||||
## 2023-09-07 v.6.4.6
|
||||
- Исправлена передача ФИО покупателя в заказе
|
||||
|
||||
@ -8,7 +11,7 @@
|
||||
- Исправлены ошибки при работе с программой лояльности
|
||||
|
||||
## 2023-08-29 v.6.4.3
|
||||
- Добавлена валидация валют при установке и настройке модуля
|
||||
- Добавлена валидация валют при настройке модуля
|
||||
|
||||
## 2023-08-23 v.6.4.2
|
||||
- Исправлена ошибка создания заказов для корпоративных клиентов при использовании функционала брошенных корзин
|
||||
@ -29,7 +32,7 @@
|
||||
- Исправлена передача брошенных корзин
|
||||
|
||||
## 2023-07-04 v.6.3.17
|
||||
- Добавлен функционал передачи примененного купона в заказе Битрикс в пользовательское поле заказа CRM
|
||||
- Добавлен функционал передачи примененного купона в заказе Bitrix в пользовательское поле заказа CRM
|
||||
|
||||
## 2023-06-30 v.6.3.16
|
||||
- Добавлена передача НДС товаров
|
||||
|
@ -321,6 +321,7 @@ class RCrmActions
|
||||
|
||||
/** @var \Intaro\RetailCrm\Service\Utils $utils */
|
||||
$utils = ServiceLocator::getOrCreate(\Intaro\RetailCrm\Service\Utils::class);
|
||||
|
||||
return $utils->fromUTF8($str);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@ use RetailCrm\ApiClient;
|
||||
use Intaro\RetailCrm\Service\ManagerService;
|
||||
use Intaro\RetailCrm\Service\LoyaltyAccountService;
|
||||
use RetailCrm\Response\ApiResponse;
|
||||
use \Bitrix\Sale\Location\Name\LocationTable as LocationTableName;
|
||||
use Intaro\RetailCrm\Component\ConfigProvider;
|
||||
use Intaro\RetailCrm\Model\Api\Response\OrdersCreateResponse;
|
||||
|
||||
@ -121,7 +120,11 @@ class RetailCrmOrder
|
||||
|
||||
$order['contragent']['contragentType'] = $arParams['optionsContragentType'][$arOrder['PERSON_TYPE_ID']];
|
||||
|
||||
//fields
|
||||
|
||||
$countryList = RetailCrmService::getCountryList();
|
||||
$deliveryAddress = ['city' => '', 'text' => '', 'index' => '', 'region' => '', 'countryIso' => ''];
|
||||
|
||||
//Order fields
|
||||
foreach ($arOrder['PROPS']['properties'] as $prop) {
|
||||
if (!empty($arParams['optionsLegalDetails'])
|
||||
&& is_array($arParams['optionsLegalDetails'][$arOrder['PERSON_TYPE_ID']])
|
||||
@ -147,44 +150,39 @@ class RetailCrmOrder
|
||||
|
||||
$order[$search] = $prop['VALUE'][0];//phone, email
|
||||
}
|
||||
} else {//address
|
||||
if ($prop['TYPE'] === 'LOCATION' && isset($prop['VALUE'][0]) && $prop['VALUE'][0] != '') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($prop['CODE'] === 'ZIP' && !empty($prop['VALUE'][0])) {
|
||||
$deliveryAddress['index'] = $prop['VALUE'][0];
|
||||
}
|
||||
|
||||
if ($prop['CODE'] === 'CITY' && $deliveryAddress['city'] === '' && !empty($prop['VALUE'][0])) {
|
||||
$deliveryAddress['city'] = $prop['VALUE'][0];
|
||||
}
|
||||
|
||||
if ($prop['CODE'] === 'ADDRESS' && !empty($prop['VALUE'][0])) {
|
||||
$deliveryAddress['text'] = $prop['VALUE'][0];
|
||||
}
|
||||
|
||||
if ($prop['TYPE'] === 'LOCATION' && isset($prop['VALUE'][0]) && !empty($prop['VALUE'][0])) {
|
||||
$arLoc = LocationTable::getByCode($prop['VALUE'][0])->fetch();
|
||||
if ($arLoc) {
|
||||
$server = Context::getCurrent()->getServer()->getDocumentRoot();
|
||||
$countrys = [];
|
||||
$deliveryLocation = CSaleLocation::GetByID($arLoc['ID']);
|
||||
|
||||
if (file_exists($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml')) {
|
||||
$countrysFile = simplexml_load_file($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml');
|
||||
foreach ($countrysFile->country as $country) {
|
||||
$countrys[RCrmActions::fromJSON((string) $country->name)] = (string) $country->alpha;
|
||||
$deliveryAddress['city'] = $deliveryLocation['CITY_NAME'] ?? '';
|
||||
$deliveryAddress['region'] = $deliveryLocation['REGION_NAME'] ?? '';
|
||||
$deliveryAddress['countryIso'] = $countryList['COUNTRY_NAME'] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
$location = LocationTableName::getList([
|
||||
'filter' => ['=LOCATION_ID' => $arLoc['CITY_ID'], 'LANGUAGE_ID' => 'ru']
|
||||
])->fetch();
|
||||
// Clear empty fields
|
||||
$deliveryAddress = array_filter($deliveryAddress);
|
||||
|
||||
if (count($countrys) > 0) {
|
||||
$countryOrder = LocationTableName::getList([
|
||||
'filter' => ['=LOCATION_ID' => $arLoc['COUNTRY_ID'], 'LANGUAGE_ID' => 'ru']
|
||||
])->fetch();
|
||||
if(isset($countrys[$countryOrder['NAME']])){
|
||||
$order['countryIso'] = $countrys[$countryOrder['NAME']];
|
||||
}
|
||||
}
|
||||
}
|
||||
$prop['VALUE'][0] = $location['NAME'];
|
||||
if (!empty($deliveryAddress)) {
|
||||
$order['delivery']['address'] = $deliveryAddress;
|
||||
}
|
||||
|
||||
if (!empty($prop['VALUE'][0])) {
|
||||
$order['delivery']['address'][$search] = $prop['VALUE'][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//deliverys
|
||||
//Deliverys
|
||||
if (array_key_exists($arOrder['DELIVERYS'][0]['id'], $arParams['optionsDelivTypes'])) {
|
||||
$order['delivery']['code'] = $arParams['optionsDelivTypes'][$arOrder['DELIVERYS'][0]['id']];
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Bitrix\Main\Context;
|
||||
|
||||
/**
|
||||
* Class RetailCrmService
|
||||
*/
|
||||
@ -178,4 +180,20 @@ class RetailCrmService
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getCountryList()
|
||||
{
|
||||
$server = Context::getCurrent()->getServer()->getDocumentRoot();
|
||||
$countryList = [];
|
||||
|
||||
if (file_exists($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml')) {
|
||||
$countryFile = simplexml_load_file($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml');
|
||||
|
||||
foreach ($countryFile->country as $country) {
|
||||
$countryList[RCrmActions::fromJSON((string) $country->name)] = (string) $country->alpha;
|
||||
}
|
||||
}
|
||||
|
||||
return $countryList;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$arModuleVersion = [
|
||||
'VERSION' => '6.4.6',
|
||||
'VERSION_DATE' => '2023-09-07 16:30:00'
|
||||
'VERSION' => '6.4.7',
|
||||
'VERSION_DATE' => '2023-10-10 18:00:00'
|
||||
];
|
||||
|
@ -154,6 +154,7 @@ class RetailCrmOrder_v5Test extends BitrixTestCase {
|
||||
|
||||
$rcrmActions = Mockery::mock('alias:' . RCrmActions::class);
|
||||
$rcrmActions->shouldReceive('apiMethod')->withAnyArgs()->andReturn(true);
|
||||
$rcrmActions->shouldReceive('fromJSON')->withAnyArgs()->andReturn('');
|
||||
|
||||
$result = RetailCrmOrder::uploadOrders();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user