diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e9ebf64..3cdab3b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2019-01-15 v.2.4.3 +* Добавлена выгрузка НДС в ICML каталоге +* Улучшена выгрузка истории изменений заказа +* Улучшена настройка выгрузки типов цен + ## 2018-12-26 v.2.4.2 * Добавлена конвертация закупочной цены при выгрузке заказа * Исправлен файл переводов для выгрузки каталога diff --git a/intaro.retailcrm/classes/general/RCrmActions.php b/intaro.retailcrm/classes/general/RCrmActions.php index fde89489..0ebf2589 100644 --- a/intaro.retailcrm/classes/general/RCrmActions.php +++ b/intaro.retailcrm/classes/general/RCrmActions.php @@ -110,9 +110,15 @@ class RCrmActions public static function PricesExportList() { - $priceId = COption::GetOptionString(self::$MODULE_ID, 'catalog_base_price', 0); $catalogExportPrices = array(); - $dbPriceType = CCatalogGroup::GetList(array(), array('!ID' => $priceId), false, false, array('ID', 'NAME', 'NAME_LANG')); + $dbPriceType = CCatalogGroup::GetList( + array(), + array(), + false, + false, + array('ID', 'NAME', 'NAME_LANG') + ); + while ($arPriceType = $dbPriceType->Fetch()) { $catalogExportPrices[$arPriceType['ID']] = $arPriceType; diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php index 945ddfcf..0377e55b 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php @@ -487,7 +487,13 @@ class RetailCrmHistory foreach ($propertyCollectionArr['properties'] as $orderProp) { if ($orderProp['ID'][0] == 'n') { $orderProp['ID'] = substr($orderProp['ID'], 1); - $orderProp['ID'] = $propertyCollection->getItemById($orderProp['ID'])->getField('ORDER_PROPS_ID'); + $property = $propertyCollection->getItemById($orderProp['ID']); + + if ($property) { + $orderProp['ID'] = $property->getField('ORDER_PROPS_ID'); + } else { + continue; + } } $nProps[] = $orderProp; } diff --git a/intaro.retailcrm/classes/general/icml/RetailCrmICML.php b/intaro.retailcrm/classes/general/icml/RetailCrmICML.php index cd726c87..a9438646 100644 --- a/intaro.retailcrm/classes/general/icml/RetailCrmICML.php +++ b/intaro.retailcrm/classes/general/icml/RetailCrmICML.php @@ -268,10 +268,23 @@ class RetailCrmICML { $basePriceId = COption::GetOptionString( $this->MODULE_ID, - $this->CRM_CATALOG_BASE_PRICE . (is_null($this->profileID) === false ? '_' . $this->profileID : ''), - 1 + $this->CRM_CATALOG_BASE_PRICE . '_' . $this->profileID, + 0 ); + if (!$basePriceId) { + $dbPriceType = CCatalogGroup::GetList( + array(), + array('BASE' => 'Y'), + false, + false, + array('ID') + ); + + $result = $dbPriceType->GetNext(); + $basePriceId = $result['ID']; + } + foreach ($this->iblocks as $key => $id) { $this->setSiteAddress($id); $barcodes = array(); @@ -284,7 +297,7 @@ class RetailCrmICML array('PRODUCT_ID', 'BARCODE') ); - while($arBarCode = $dbBarCode->GetNext()) { + while ($arBarCode = $dbBarCode->GetNext()) { if (!empty($arBarCode)) { $barcodes[$arBarCode['PRODUCT_ID']] = $arBarCode['BARCODE']; } @@ -312,7 +325,7 @@ class RetailCrmICML } } - $arSelect = Array ( + $arSelect = array( "ID", "LID", "IBLOCK_ID", @@ -650,6 +663,13 @@ class RetailCrmICML $offer.= "" . $this->PrepareValue($arOffer["BARCODE"]) . "\n"; } + if ($arOffer["CATALOG_VAT"]) { + $vatRate = $arOffer["CATALOG_VAT"]; + } else { + $vatRate = 'none'; + } + + $offer.= "" . $this->PrepareValue($vatRate) . "\n"; $offer.= "\n"; return $offer; diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index fc95c52e..47ec11ac 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1,4 +1,3 @@ -- Добавлена конвертация закупочной цены при выгрузке заказа -- Исправлен файл переводов для выгрузки каталога -- В настройку экспорта каталога добавлена настройка максимального количества торговых предложений у товара -- Исправлен вызов обработчика сохранения оплаты при создании заказа \ No newline at end of file +- Добавлена выгрузка НДС в ICML каталоге +- Улучшена выгрузка истории изменений заказа +- Улучшена настройка выгрузки типов цен \ No newline at end of file diff --git a/intaro.retailcrm/export/export_run.php b/intaro.retailcrm/export/export_run.php index f69a5b9d..283faa3b 100644 --- a/intaro.retailcrm/export/export_run.php +++ b/intaro.retailcrm/export/export_run.php @@ -130,7 +130,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor } $loader = new RetailCrmICML(); - $loader->profileID = $PROFILE_ID; + $loader->profileID = $profile_id; $loader->iblocks = $IBLOCK_EXPORT; $loader->propertiesSKU = $IBLOCK_PROPERTY_SKU; $loader->propertiesUnitSKU = $IBLOCK_PROPERTY_UNIT_SKU; diff --git a/intaro.retailcrm/install/index.php b/intaro.retailcrm/install/index.php index f791c99f..29fb8772 100644 --- a/intaro.retailcrm/install/index.php +++ b/intaro.retailcrm/install/index.php @@ -955,6 +955,8 @@ class intaro_retailcrm extends CModule $loader->Load(); } + COption::RemoveOption($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE); + if ($typeLoading == 'agent' || $typeLoading == 'cron') { if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/' . $this->RETAIL_CRM_EXPORT . '_run.php')) { $dbProfile = CCatalogExport::GetList(array(), array("FILE_NAME" => $this->RETAIL_CRM_EXPORT)); @@ -994,6 +996,13 @@ class intaro_retailcrm extends CModule return; } + + COption::SetOptionString( + $this->MODULE_ID, + $this->CRM_CATALOG_BASE_PRICE . '_' . $PROFILE_ID, + htmlspecialchars(trim($_POST['price-types'])) + ); + if ($typeLoading == 'agent') { $dateAgent = new DateTime(); $intAgent = new DateInterval('PT60S'); // PT60S - 60 sec; diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index ae5bd9a1..349e710b 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,5 +1,5 @@ "2.4.2", - "VERSION_DATE" => "2018-12-26 11:00:00" + "VERSION" => "2.4.3", + "VERSION_DATE" => "2019-01-15 17:00:00" );