diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b85dc0e..48525d5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2016-10-14 v.2.0.6 +* Оптимизация History +* Исправлены ошибки + ## 2016-10-11 v.2.0.5 * Исправлена ошибка при обработке Ф.И.О. * Исправлена ошибка с неверной кодировкой свойств diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory.php index 3eb1c970..98c37ac6 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory.php @@ -327,6 +327,8 @@ class RetailCrmHistory } } + $log->write($order, 'assemblyOrderHistory'); + if (isset($order['deleted'])) { continue; } @@ -470,9 +472,9 @@ class RetailCrmHistory if ($optionsPayStatuses[$order['status']]) { $newOrder->setField('STATUS_ID', $optionsPayStatuses[$order['status']]); if (in_array($optionsPayStatuses[$order['status']], $optionsCanselOrder)) { - $newOrder->setField('CANCELED', 'Y'); + $newOrder->setFieldNoDemand('CANCELED', 'Y'); } else { - $newOrder->setField('CANCELED', 'N'); + $newOrder->setFieldNoDemand('CANCELED', 'N'); } } @@ -520,7 +522,10 @@ class RetailCrmHistory $fio = ''; foreach ($propertyCollectionArr['properties'] as $prop) { if (in_array($optionsOrderProps[$personType]['fio'], $prop)) { - $fio = $newOrder->getPropertyCollection()->getItemByOrderPropertyId($prop['ID'])->getValue(); + $getFio = $newOrder->getPropertyCollection()->getItemByOrderPropertyId($prop['ID']); + if (method_exists($getFio, 'getValue')) { + $fio = $getFio->getValue(); + } } } @@ -1141,12 +1146,12 @@ class RetailCrmHistory return $outputArray; } - public static function setProp($obj, $value, $prop) + public static function setProp($obj, $value = '', $prop) { if (!isset($obj)) { return false; } - if ($prop && $value) { + if ($prop) { $obj->setField($prop, $value); } elseif ($value) { $obj->setValue($value); diff --git a/intaro.retailcrm/classes/general/order/RetailCrmOrder.php b/intaro.retailcrm/classes/general/order/RetailCrmOrder.php index 562242e7..7e3df3a1 100644 --- a/intaro.retailcrm/classes/general/order/RetailCrmOrder.php +++ b/intaro.retailcrm/classes/general/order/RetailCrmOrder.php @@ -83,12 +83,13 @@ class RetailCrmOrder $order[$search] = $prop['VALUE'][0];//телефон и почта } } 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(); - $location = \Bitrix\Sale\Location\Name\LocationTable::getList(array( - 'filter' => array('=LOCATION_ID' => $arLoc['CITY_ID'], 'LANGUAGE_ID'=>'ru') - ))->fetch(); - + if ($arLoc) { + $location = \Bitrix\Sale\Location\Name\LocationTable::getList(array( + 'filter' => array('=LOCATION_ID' => $arLoc['CITY_ID'], 'LANGUAGE_ID' => 'ru') + ))->fetch(); + } $prop['VALUE'][0] = $location['NAME']; } @@ -100,7 +101,7 @@ class RetailCrmOrder //доставки if (array_key_exists($arFields['DELIVERYS'][0]['id'], $arParams['optionsDelivTypes'])) { $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']; } } diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index afa761f8..0347839e 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1,3 +1,2 @@ -- Исправлена ошибка в истории при обработке Ф.И.О. -- Исправлена ошибка с неверной кодировкой свойств -- Исправлена ошибка формирования списка статусов \ No newline at end of file +- Оптимизация History +- Исправлены ошибки \ No newline at end of file diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index 87a40ad2..8f87522f 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ "2.0.4", - "VERSION_DATE" => "2016-10-06 18:00:00" + "VERSION" => "2.0.6", + "VERSION_DATE" => "2016-10-14 18:00:00" );