diff --git a/CHANGELOG.md b/CHANGELOG.md index 18f9db4e..35b27a3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2016-10-20 v.2.0.8 +* Исправлена ошибка с отсутствием LID +* Изменены методы для совместимости с ранними версиями sale 16 версии + ## 2016-10-20 v.2.0.7 * Исправлена ошибка с недобавлением товара в заказ по истории * Исправлена ошибка с недобавлением сервиса доставки в црм diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory.php index 91005022..69908a07 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory.php @@ -263,22 +263,6 @@ class RetailCrmHistory $optionsOrderNumbers = COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_NUMBERS, 0); $optionsCanselOrder = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_CANSEL_ORDER, 0)); - /*foreach ($optionsOrderProps as $code => $value) { - if (isset($optionsLegalDetails[$code])) { - $optionsOrderProps[$code] = array_merge($optionsOrderProps[$code], $optionsLegalDetails[$code]); - } - if (isset($optionsCustomFields[$code])) { - $optionsOrderProps[$code] = array_merge($optionsOrderProps[$code], $optionsCustomFields[$code]); - } - $optionsOrderProps[$code]['location'] = 'LOCATION'; - if (array_search('CITY', $optionsOrderProps[$code]) == false) { - $optionsOrderProps[$code]['city'] = 'CITY'; - } - if (array_search('ZIP', $optionsOrderProps[$code]) == false) { - $optionsOrderProps[$code]['index'] = 'ZIP'; - } - }*/ - $api = new RetailCrm\ApiClient($api_host, $api_key); $historyFilter = array(); @@ -329,7 +313,7 @@ class RetailCrmHistory $log->write($order, 'assemblyOrderHistory'); - if (isset($order['deleted'])) { + if ($order['deleted']) { continue; } @@ -410,7 +394,7 @@ class RetailCrmHistory $order['customer']['externalId'] = $registeredUserID; } - if (isset($optionsSitesList)) { + if ($optionsSitesList) { $site = array_search($order['site'], $optionsSitesList); } else { $site = CSite::GetDefSite(); @@ -449,9 +433,15 @@ class RetailCrmHistory $newOrder = Bitrix\Sale\Order::load($order['externalId']); if (!$newOrder instanceof \Bitrix\Sale\Order) { - RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'Bitrix\Sale\Order::load', 'Error order load'); + RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'Bitrix\Sale\Order::load', 'Error order load id=' . $order['externalId']); continue; } + + if ($optionsSitesList) { + $site = array_search($order['site'], $optionsSitesList); + } else { + $site = CSite::GetDefSite(); + } if ($optionsOrderNumbers == 'Y' && isset($order['number'])) { $newOrder->setField('ACCOUNT_NUMBER', $order['number']); @@ -604,7 +594,7 @@ class RetailCrmHistory $elem = self::getInfoElement($product['offer']['externalId']); $item->setFields(array( 'CURRENCY' => \Bitrix\Currency\CurrencyManager::getBaseCurrency(), - 'LID' => \Bitrix\Main\Context::getCurrent()->getSite(), + 'LID' => $site, 'BASE_PRICE' => $product['initialPrice'], 'NAME' => $product['name'] ? RCrmActions::fromJSON($product['name']) : $elem['NAME'], 'DETAIL_PAGE_URL' => $elem['URL'] @@ -1101,10 +1091,10 @@ class RetailCrmHistory } //запись в историю } else {//ошибка, нет такой активной платежной системы - RCrmActions::eventLog('RetailCrmHistory::paySystemUpdate', 'RCrmActions::PaymentList()', 'Error paySystem not found'); + RCrmActions::eventLog('RetailCrmHistory::paySystemUpdate', 'RCrmActions::PaymentList()', 'Error paySystem not found in order id=' . $order['externalId']); } } else {//ошибка, возможно платежная система не сопоставлена - RCrmActions::eventLog('RetailCrmHistory::paySystemUpdate', 'RCrmActions::PaymentList()', 'Error paySystem not found in option');; + RCrmActions::eventLog('RetailCrmHistory::paySystemUpdate', 'RCrmActions::PaymentList()', 'Error paySystem not found in option in order id=' . $order['externalId']);; } } else { \Bitrix\Sale\OrderTable::update($order['externalId'], array('PAY_SYSTEM_ID' => '')); diff --git a/intaro.retailcrm/classes/general/order/RetailCrmOrder.php b/intaro.retailcrm/classes/general/order/RetailCrmOrder.php index 8fdc48af..ea239215 100644 --- a/intaro.retailcrm/classes/general/order/RetailCrmOrder.php +++ b/intaro.retailcrm/classes/general/order/RetailCrmOrder.php @@ -188,7 +188,7 @@ class RetailCrmOrder } elseif ($orderList !== false && count($orderList) > 0) { $orderIds = $orderList; } else { - $dbOrder = \Bitrix\Sale\Order::GetList(array( + $dbOrder = \Bitrix\Sale\Internals\OrderTable::GetList(array( 'order' => array("ID" => "ASC"), 'filter' => array('>ID' => $lastUpOrderId), 'limit' => $pSize, diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index 06550085..a7220437 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1,2 +1,2 @@ -- Исправлена ошибка с недобавлением товара в заказ по истории -- Исправлена ошибка с недобавлением сервиса доставки в црм \ No newline at end of file +- Исправлена ошибка с отсутствием LID +- Изменены методы для совместимости с ранними версиями sale 16 версии \ No newline at end of file diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index 365e2fcd..b107c8e6 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ "2.0.7", - "VERSION_DATE" => "2016-10-20 18:00:00" + "VERSION" => "2.0.8", + "VERSION_DATE" => "2016-10-20 19:00:00" );