Bugfix release
* Исправлена ошибка при обработке Ф.И.О. * Исправлена ошибка с неверной кодировкой свойств * Исправлена ошибка формирования списка статусов * Оптимизация History * Исправлены ошибки
This commit is contained in:
commit
eaa54795c5
@ -1,3 +1,12 @@
|
|||||||
|
## 2016-10-14 v.2.0.6
|
||||||
|
* Оптимизация History
|
||||||
|
* Исправлены ошибки
|
||||||
|
|
||||||
|
## 2016-10-11 v.2.0.5
|
||||||
|
* Исправлена ошибка при обработке Ф.И.О.
|
||||||
|
* Исправлена ошибка с неверной кодировкой свойств
|
||||||
|
* Исправлена ошибка формирования списка статусов
|
||||||
|
|
||||||
## 2016-10-06 v.2.0.4
|
## 2016-10-06 v.2.0.4
|
||||||
* Оптимизация History
|
* Оптимизация History
|
||||||
* Исправлена ошибка выгрузки доставок при установке
|
* Исправлена ошибка выгрузки доставок при установке
|
||||||
|
@ -67,9 +67,15 @@ class RCrmActions
|
|||||||
public static function StatusesList()
|
public static function StatusesList()
|
||||||
{
|
{
|
||||||
$bitrixPaymentStatusesList = array();
|
$bitrixPaymentStatusesList = array();
|
||||||
$arStatusesAll = \Bitrix\Sale\OrderStatus::getAllStatusesNames();
|
$obStatuses = \Bitrix\Sale\Internals\StatusTable::getList(array(
|
||||||
foreach ($arStatusesAll as $key => $arStatus) {
|
'filter' => array('TYPE' => 'O'),
|
||||||
$bitrixPaymentStatusesList[$key] = array('ID' => $key, 'NAME' => $arStatus);
|
'select' => array('ID', "NAME" => 'Bitrix\Sale\Internals\StatusLangTable:STATUS.NAME')
|
||||||
|
));
|
||||||
|
while ($arStatus = $obStatuses->fetch()) {
|
||||||
|
$bitrixPaymentStatusesList[$arStatus['ID']] = array(
|
||||||
|
'ID' => $arStatus['ID'],
|
||||||
|
'NAME' => $arStatus['NAME'],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $bitrixPaymentStatusesList;
|
return $bitrixPaymentStatusesList;
|
||||||
|
@ -327,6 +327,8 @@ class RetailCrmHistory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$log->write($order, 'assemblyOrderHistory');
|
||||||
|
|
||||||
if (isset($order['deleted'])) {
|
if (isset($order['deleted'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -470,14 +472,14 @@ class RetailCrmHistory
|
|||||||
if ($optionsPayStatuses[$order['status']]) {
|
if ($optionsPayStatuses[$order['status']]) {
|
||||||
$newOrder->setField('STATUS_ID', $optionsPayStatuses[$order['status']]);
|
$newOrder->setField('STATUS_ID', $optionsPayStatuses[$order['status']]);
|
||||||
if (in_array($optionsPayStatuses[$order['status']], $optionsCanselOrder)) {
|
if (in_array($optionsPayStatuses[$order['status']], $optionsCanselOrder)) {
|
||||||
$newOrder->setField('CANCELED', 'Y');
|
$newOrder->setFieldNoDemand('CANCELED', 'Y');
|
||||||
} else {
|
} else {
|
||||||
$newOrder->setField('CANCELED', 'N');
|
$newOrder->setFieldNoDemand('CANCELED', 'N');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('statusComment', $order)) {
|
if (array_key_exists('statusComment', $order)) {
|
||||||
self::setProp($newOrder, $order['statusComment'], 'REASON_CANCELED');
|
self::setProp($newOrder, RCrmActions::fromJSON($order['statusComment']), 'REASON_CANCELED');
|
||||||
}
|
}
|
||||||
|
|
||||||
$propertyCollection = $newOrder->getPropertyCollection();
|
$propertyCollection = $newOrder->getPropertyCollection();
|
||||||
@ -520,53 +522,44 @@ class RetailCrmHistory
|
|||||||
$fio = '';
|
$fio = '';
|
||||||
foreach ($propertyCollectionArr['properties'] as $prop) {
|
foreach ($propertyCollectionArr['properties'] as $prop) {
|
||||||
if (in_array($optionsOrderProps[$personType]['fio'], $prop)) {
|
if (in_array($optionsOrderProps[$personType]['fio'], $prop)) {
|
||||||
$fio = $newOrder->getPropertyCollection()->getItemByOrderPropertyId($prop['ID']);
|
$getFio = $newOrder->getPropertyCollection()->getItemByOrderPropertyId($prop['ID']);
|
||||||
|
if (method_exists($getFio, 'getValue')) {
|
||||||
|
$fio = $getFio->getValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fio = RCrmActions::explodeFIO($fio);
|
$fio = RCrmActions::explodeFIO($fio);
|
||||||
|
$newFio = array();
|
||||||
if ($fio) {
|
if ($fio) {
|
||||||
$order['fio'] = trim(
|
$newFio[] = isset($order['lastName']) ? RCrmActions::fromJSON($order['lastName']) : (isset($fio['lastName']) ? $fio['lastName'] : '');
|
||||||
implode(
|
$newFio[] = isset($order['firstName']) ? RCrmActions::fromJSON($order['firstName']) : (isset($fio['firstName']) ? $fio['firstName'] : '');
|
||||||
' ',
|
$newFio[] = isset($order['patronymic']) ? RCrmActions::fromJSON($order['patronymic']) : (isset($fio['patronymic']) ? $fio['patronymic'] : '');
|
||||||
array(
|
$order['fio'] = trim(implode(' ', $newFio));
|
||||||
isset($order['lastName']) ? $order['lastName'] : (isset($fio['lastName']) ? $fio['lastName'] : ''),
|
|
||||||
isset($order['firstName']) ? $order['firstName'] : (isset($fio['firstName']) ? $fio['firstName'] : ''),
|
|
||||||
isset($order['patronymic']) ? $order['patronymic'] : (isset($fio['patronymic']) ? $fio['patronymic'] : ''),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
$order['fio'] = trim(
|
$newFio[] = isset($order['lastName']) ? RCrmActions::fromJSON($order['lastName']) : '';
|
||||||
implode(
|
$newFio[] = isset($order['firstName']) ? RCrmActions::fromJSON($order['firstName']) : '';
|
||||||
' ',
|
$newFio[] = isset($order['patronymic']) ? RCrmActions::fromJSON($order['patronymic']) : '';
|
||||||
array(
|
$order['fio'] = trim(implode(' ', $newFio));
|
||||||
isset($order['lastName']) ? $order['lastName'] : '',
|
|
||||||
isset($order['firstName']) ? $order['firstName'] : '',
|
|
||||||
isset($order['patronymic']) ? $order['patronymic'] : '',
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//optionsOrderProps
|
//optionsOrderProps
|
||||||
|
|
||||||
if ($optionsOrderProps[$personType]) {
|
if ($optionsOrderProps[$personType]) {
|
||||||
foreach ($optionsOrderProps[$personType] as $key => $orderProp) {
|
foreach ($optionsOrderProps[$personType] as $key => $orderProp) {
|
||||||
if (array_key_exists($key, $order)) {
|
if (array_key_exists($key, $order)) {
|
||||||
$somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
$somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
||||||
self::setProp($somePropValue, $order[$key]);
|
self::setProp($somePropValue, RCrmActions::fromJSON($order[$key]));
|
||||||
} elseif (array_key_exists($key, $order['delivery']['address'])) {
|
} elseif (array_key_exists($key, $order['delivery']['address'])) {
|
||||||
if ($propsKey[$key]['TYPE'] == 'LOCATION') {
|
if ($propsKey[$key]['TYPE'] == 'LOCATION') {
|
||||||
$parameters['filter']['NAME'] = $order['delivery']['address'][$key];
|
$parameters['filter']['NAME'] = RCrmActions::fromJSON($order['delivery']['address'][$key]);
|
||||||
$parameters['filter']['LANGUAGE_ID'] = 'ru';
|
$parameters['filter']['LANGUAGE_ID'] = 'ru';
|
||||||
$location = \Bitrix\Sale\Location\LocationTable::getListFast($parameters)->fetch();
|
$location = \Bitrix\Sale\Location\LocationTable::getListFast($parameters)->fetch();
|
||||||
$somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
$somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
||||||
self::setProp($somePropValue, $location['CODE']);
|
self::setProp($somePropValue, $location['CODE']);
|
||||||
} else {
|
} else {
|
||||||
$somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
$somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
||||||
self::setProp($somePropValue, $order['delivery']['address'][$key]);
|
self::setProp($somePropValue, RCrmActions::fromJSON($order['delivery']['address'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -590,10 +583,10 @@ class RetailCrmHistory
|
|||||||
}
|
}
|
||||||
//comments
|
//comments
|
||||||
if (array_key_exists('customerComment', $order)) {
|
if (array_key_exists('customerComment', $order)) {
|
||||||
self::setProp($newOrder, $order['customerComment'], 'USER_DESCRIPTION');
|
self::setProp($newOrder, RCrmActions::fromJSON($order['customerComment']), 'USER_DESCRIPTION');
|
||||||
}
|
}
|
||||||
if (array_key_exists('managerComment', $order)) {
|
if (array_key_exists('managerComment', $order)) {
|
||||||
self::setProp($newOrder, $order['managerComment'], 'COMMENTS');
|
self::setProp($newOrder, RCrmActions::fromJSON($order['managerComment']), 'COMMENTS');
|
||||||
}
|
}
|
||||||
|
|
||||||
//items
|
//items
|
||||||
@ -608,12 +601,12 @@ class RetailCrmHistory
|
|||||||
}
|
}
|
||||||
$item = $basket->createItem('catalog', $product['offer']['externalId']);
|
$item = $basket->createItem('catalog', $product['offer']['externalId']);
|
||||||
if ($item instanceof \Bitrix\Sale\Basket) {
|
if ($item instanceof \Bitrix\Sale\Basket) {
|
||||||
$elem = self::getInfoElement();
|
$elem = self::getInfoElement($product['offer']['externalId']);
|
||||||
$item->setFields(array(
|
$item->setFields(array(
|
||||||
'CURRENCY' => \Bitrix\Currency\CurrencyManager::getBaseCurrency(),
|
'CURRENCY' => \Bitrix\Currency\CurrencyManager::getBaseCurrency(),
|
||||||
'LID' => \Bitrix\Main\Context::getCurrent()->getSite(),
|
'LID' => \Bitrix\Main\Context::getCurrent()->getSite(),
|
||||||
'BASE_PRICE' => $product['initialPrice'],
|
'BASE_PRICE' => $product['initialPrice'],
|
||||||
'NAME' => $elem['NAME'],
|
'NAME' => $product['name'] ? RCrmActions::fromJSON($product['name']) : $elem['NAME'],
|
||||||
'DETAIL_PAGE_URL' => $elem['URL']
|
'DETAIL_PAGE_URL' => $elem['URL']
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
@ -1129,7 +1122,7 @@ class RetailCrmHistory
|
|||||||
|
|
||||||
public static function newValue($value)
|
public static function newValue($value)
|
||||||
{
|
{
|
||||||
if (isset($value['code'])) {
|
if (array_key_exists('code', $value)) {
|
||||||
return $value['code'];
|
return $value['code'];
|
||||||
} else {
|
} else {
|
||||||
return $value;
|
return $value;
|
||||||
@ -1153,12 +1146,12 @@ class RetailCrmHistory
|
|||||||
return $outputArray;
|
return $outputArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setProp($obj, $value, $prop)
|
public static function setProp($obj, $value = '', $prop)
|
||||||
{
|
{
|
||||||
if (!isset($obj)) {
|
if (!isset($obj)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($prop && $value) {
|
if ($prop) {
|
||||||
$obj->setField($prop, $value);
|
$obj->setField($prop, $value);
|
||||||
} elseif ($value) {
|
} elseif ($value) {
|
||||||
$obj->setValue($value);
|
$obj->setValue($value);
|
||||||
|
@ -83,12 +83,13 @@ class RetailCrmOrder
|
|||||||
$order[$search] = $prop['VALUE'][0];//телефон и почта
|
$order[$search] = $prop['VALUE'][0];//телефон и почта
|
||||||
}
|
}
|
||||||
} else {//остальное - адрес
|
} else {//остальное - адрес
|
||||||
if ($prop['TYPE'] == 'LOCATION') {
|
if ($prop['TYPE'] == 'LOCATION' && isset($prop['VALUE'][0]) && $prop['VALUE'][0] != '') {
|
||||||
$arLoc = \Bitrix\Sale\Location\LocationTable::getByCode($prop['VALUE'][0])->fetch();
|
$arLoc = \Bitrix\Sale\Location\LocationTable::getByCode($prop['VALUE'][0])->fetch();
|
||||||
$location = \Bitrix\Sale\Location\Name\LocationTable::getList(array(
|
if ($arLoc) {
|
||||||
'filter' => array('=LOCATION_ID' => $arLoc['CITY_ID'], 'LANGUAGE_ID'=>'ru')
|
$location = \Bitrix\Sale\Location\Name\LocationTable::getList(array(
|
||||||
))->fetch();
|
'filter' => array('=LOCATION_ID' => $arLoc['CITY_ID'], 'LANGUAGE_ID' => 'ru')
|
||||||
|
))->fetch();
|
||||||
|
}
|
||||||
$prop['VALUE'][0] = $location['NAME'];
|
$prop['VALUE'][0] = $location['NAME'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ class RetailCrmOrder
|
|||||||
//доставки
|
//доставки
|
||||||
if (array_key_exists($arFields['DELIVERYS'][0]['id'], $arParams['optionsDelivTypes'])) {
|
if (array_key_exists($arFields['DELIVERYS'][0]['id'], $arParams['optionsDelivTypes'])) {
|
||||||
$order['delivery']['code'] = $arParams['optionsDelivTypes'][$arFields['DELIVERYS'][0]['id']];
|
$order['delivery']['code'] = $arParams['optionsDelivTypes'][$arFields['DELIVERYS'][0]['id']];
|
||||||
if (isset($arFields['DELIVERYS'][0]['service'])) {
|
if (isset($arFields['DELIVERYS'][0]['service']) && $arFields['DELIVERYS'][0]['service'] != '') {
|
||||||
$order['delivery']['service'] = $arFields['DELIVERYS'][0]['service'];
|
$order['delivery']['service'] = $arFields['DELIVERYS'][0]['service'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,7 +129,7 @@ class RetailCrmOrder
|
|||||||
|
|
||||||
//отправка
|
//отправка
|
||||||
if (function_exists('retailCrmBeforeOrderSend')) {
|
if (function_exists('retailCrmBeforeOrderSend')) {
|
||||||
$newResOrder = retailCrmBeforeOrderSend($order);
|
$newResOrder = retailCrmBeforeOrderSend($order, $arFields);
|
||||||
if (is_array($newResOrder) && !empty($newResOrder)) {
|
if (is_array($newResOrder) && !empty($newResOrder)) {
|
||||||
$order = $newResOrder;
|
$order = $newResOrder;
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
- Оптимизация History
|
- Оптимизация History
|
||||||
- Исправлена ошибка выгрузки доставок при установке
|
- Исправлены ошибки
|
@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
$arModuleVersion = array(
|
$arModuleVersion = array(
|
||||||
"VERSION" => "2.0.4",
|
"VERSION" => "2.0.6",
|
||||||
"VERSION_DATE" => "2016-10-06 18:00:00"
|
"VERSION_DATE" => "2016-10-14 18:00:00"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user