1
0
mirror of synced 2024-11-26 07:16:08 +03:00

Исправление передачи местоположения в адресе доставки по истории (#253)

* Корректировка передачи местоположения в адресе доставки по истории
This commit is contained in:
Vlad 2022-06-14 11:57:44 +03:00 committed by GitHub
parent 134c92199a
commit 60e818e793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 36 deletions

View File

@ -1,3 +1,6 @@
## 2021-05-18 v.6.0.4
* Исправление передачи местоположения в адресе доставки по истории
## 2021-05-13 v.6.0.3 ## 2021-05-13 v.6.0.3
* Исправление автозагрузки классов * Исправление автозагрузки классов

View File

@ -716,45 +716,30 @@ class RetailCrmHistory
} }
} elseif (array_key_exists($key, $order['delivery']['address'])) { } elseif (array_key_exists($key, $order['delivery']['address'])) {
if ($propsKey[$orderProp]['TYPE'] == 'LOCATION') { if ($propsKey[$orderProp]['TYPE'] == 'LOCATION') {
if( $order['delivery']['address']['index'] ) {
$location = CSaleLocation::GetByZIP($order['delivery']['address']['index']);
}
$order['delivery']['address'][$key] = trim($order['delivery']['address'][$key]);
if (!empty($order['delivery']['address'][$key])) { if (!empty($order['delivery']['address'][$key])) {
$parameters = array(); $parameters['filter']['NAME.LANGUAGE_ID'] = 'ru';
$parameters['limit'] = 1;
$parameters['select'] = array('*');
// if address have a dot
$loc = explode('.', $order['delivery']['address'][$key]); $loc = explode('.', $order['delivery']['address'][$key]);
if (count($loc) == 1) { if (count($loc) == 1) {
$parameters['filter']['PHRASE'] = RCrmActions::fromJSON(trim($loc[0])); $parameters['filter']['=NAME.NAME'] = RCrmActions::fromJSON(trim($loc[0]));
} elseif (count($loc) == 2) {
$parameters['filter']['PHRASE'] = RCrmActions::fromJSON(trim($loc[1]));
} else { } else {
RCrmActions::eventLog( $parameters['filter']['=NAME.NAME'] = RCrmActions::fromJSON(trim($loc[1]));
'RetailCrmHistory::orderHistory',
'RetailCrmHistory::setProp',
sprintf(
'Error location. %s not found add in order number = %s',
$order['delivery']['address'][$key],
$order['number']
)
);
continue;
} }
$parameters['filter']['NAME.LANGUAGE_ID'] = 'ru';
try {
if (!isset($location)) {
$location = Finder::find( $location = Finder::find(
$parameters, $parameters
['USE_INDEX' => false, 'USE_ORM' => false]
)->fetch(); )->fetch();
} }
if (!empty($location)) {
$somePropValue = $propertyCollection $somePropValue = $propertyCollection
->getItemByOrderPropertyId($propsKey[$orderProp]['ID']); ->getItemByOrderPropertyId($propsKey[$orderProp]['ID'])
;
try {
self::setProp($somePropValue, $location['CODE']); self::setProp($somePropValue, $location['CODE']);
} catch (ArgumentException $argumentException) { } catch (ArgumentException $argumentException) {
RCrmActions::eventLog( RCrmActions::eventLog(
@ -773,8 +758,6 @@ class RetailCrmHistory
$order['number'] $order['number']
) )
); );
continue;
} }
} else { } else {
$somePropValue = $propertyCollection $somePropValue = $propertyCollection

View File

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

View File

@ -1,6 +1,6 @@
<?php <?php
$arModuleVersion = [ $arModuleVersion = [
'VERSION' => '6.0.3', 'VERSION' => '6.0.4',
'VERSION_DATE' => '2022-05-13 14:00:00' 'VERSION_DATE' => '2022-05-18 17:00:00'
]; ];