v2.3.6
This commit is contained in:
parent
7ae099236c
commit
ab51935b92
@ -1,3 +1,11 @@
|
||||
## 2018-05-23 v.2.3.6
|
||||
* Улучшена выгрузка свойств товаров типа "справочник"
|
||||
* Добавлена настройка выгрузки габаритов и веса в заказе
|
||||
* Добавлена совместимость натройки экспорта для Google Chrome
|
||||
* Исправлена ошибка при выгрузке истории с пустым городом
|
||||
* Добавлены проверки на существование модуля Highloadblock
|
||||
* Исправлен баг с отправкой пустого заказа при удалении в 1С-Битрикс
|
||||
|
||||
## 2018-03-22 v.2.3.5
|
||||
* В настройку экспорта добавлена настройка свойств типа "справочник"(highloadblock)
|
||||
* Добавлена проверка необходимости резервации товаров при выгрузке заказов из retailCRM
|
||||
|
@ -202,11 +202,10 @@ class RetailCrmEvent
|
||||
*
|
||||
* @param object $event - Payment object
|
||||
*/
|
||||
|
||||
function paymentSave($event)
|
||||
{
|
||||
{
|
||||
$apiVersion = COption::GetOptionString(self::$MODULE_ID, 'api_version', 0);
|
||||
|
||||
|
||||
if ((isset($GLOBALS['RETAIL_CRM_HISTORY']) && $GLOBALS['RETAIL_CRM_HISTORY']) || $apiVersion != 'v5') {
|
||||
return;
|
||||
}
|
||||
|
@ -557,16 +557,21 @@ class RetailCrmHistory
|
||||
$parameters['filter']['PHRASE'] = RCrmActions::fromJSON(trim($loc[0]));
|
||||
} elseif (count($loc) == 2) {
|
||||
$parameters['filter']['PHRASE'] = RCrmActions::fromJSON(trim($loc[1]));
|
||||
} else{
|
||||
} else {
|
||||
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'RetailCrmHistory::setProp', 'Error location. ' . $order['delivery']['address'][$key] . ' not found add in order number=' . $order['number']);
|
||||
continue;
|
||||
}
|
||||
$parameters['filter']['NAME.LANGUAGE_ID'] = 'ru';
|
||||
$location = \Bitrix\Sale\Location\Search\Finder::find($parameters, array('USE_INDEX' => false, 'USE_ORM' => false))->fetch();
|
||||
|
||||
$somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
||||
self::setProp($somePropValue, $location['CODE']);
|
||||
} else {
|
||||
$parameters['filter']['NAME.LANGUAGE_ID'] = 'ru';
|
||||
|
||||
try {
|
||||
$location = \Bitrix\Sale\Location\Search\Finder::find($parameters, array('USE_INDEX' => false, 'USE_ORM' => false))->fetch();
|
||||
$somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
||||
self::setProp($somePropValue, $location['CODE']);
|
||||
} catch (\Bitrix\Main\ArgumentException $argumentException) {
|
||||
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'RetailCrmHistory::setProp', 'Location parameter is incorrect in order number=' . $order['number']);
|
||||
}
|
||||
} else {
|
||||
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'RetailCrmHistory::setProp', 'Error location. ' . $order['delivery']['address'][$key] . ' is empty in order number=' . $order['number']);
|
||||
|
||||
continue;
|
||||
|
@ -14,6 +14,8 @@ class RetailCrmICML
|
||||
public $propertiesUnitSKU;
|
||||
public $propertiesProduct;
|
||||
public $propertiesUnitProduct;
|
||||
public $highloadblockSkuProperties;
|
||||
public $highloadblockProductProperties;
|
||||
public $application;
|
||||
public $encoding = 'utf-8';
|
||||
public $encodingDefault = 'utf-8';
|
||||
@ -412,10 +414,10 @@ class RetailCrmICML
|
||||
$resPropertiesProduct[$key . "_UNIT"] = $this->measurementLink[$this->propertiesUnitProduct[$id][$key]];
|
||||
}
|
||||
if (isset($highloadblockProductProps[$propProduct])) {
|
||||
$propVal = $this->getHBprop($highloadblockProductProps[$propProduct], $offer["PROPERTY_" . $propProduct . "_VALUE"]);
|
||||
$propVal = $this->getHBprop($highloadblockProductProps[$propProduct], $product["PROPERTY_" . $propProduct . "_VALUE"]);
|
||||
$tableName = $highloadblockProductProps[$propProduct]['USER_TYPE_SETTINGS']['TABLE_NAME'];
|
||||
$field = $this->highloadblockSkuProperties[$tableName][$iblockOffer['IBLOCK_ID']][$key];
|
||||
|
||||
$field = $this->highloadblockProductProperties[$tableName][$iblockOffer['IBLOCK_ID']][$key];
|
||||
|
||||
$resPropertiesProduct[$key] = $propVal[$field];
|
||||
}
|
||||
}
|
||||
@ -595,20 +597,23 @@ class RetailCrmICML
|
||||
|
||||
private function getHBprop($hbProp, $xml_id)
|
||||
{
|
||||
CModule::IncludeModule('highloadblock');
|
||||
$hlblockArr = \Bitrix\Highloadblock\HighloadBlockTable::getList([
|
||||
'filter' => ['=TABLE_NAME' => $hbProp['USER_TYPE_SETTINGS']['TABLE_NAME']]
|
||||
])->fetch();
|
||||
if (CModule::IncludeModule('highloadblock')) {
|
||||
$hlblockArr = \Bitrix\Highloadblock\HighloadBlockTable::getList(array(
|
||||
'filter' => array('=TABLE_NAME' => $hbProp['USER_TYPE_SETTINGS']['TABLE_NAME'])
|
||||
))->fetch();
|
||||
|
||||
$hlblock = HL\HighloadBlockTable::getById($hlblockArr["ID"])->fetch();
|
||||
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
|
||||
$entityClass = $entity->getDataClass();
|
||||
$hlblock = HL\HighloadBlockTable::getById($hlblockArr["ID"])->fetch();
|
||||
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
|
||||
$entityClass = $entity->getDataClass();
|
||||
|
||||
$result = $entityClass::getList(array(
|
||||
'select' => array('*'),
|
||||
'filter' => array('UF_XML_ID' => $xml_id)
|
||||
));
|
||||
$result = $entityClass::getList(array(
|
||||
'select' => array('*'),
|
||||
'filter' => array('UF_XML_ID' => $xml_id)
|
||||
));
|
||||
|
||||
return $result->fetch();
|
||||
return $result->fetch();
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ class RetailCrmOrder
|
||||
public static $CRM_ORDER_HISTORY_DATE = 'order_history_date';
|
||||
public static $CRM_CATALOG_BASE_PRICE = 'catalog_base_price';
|
||||
public static $CRM_ORDER_NUMBERS = 'order_numbers';
|
||||
public static $CRM_ORDER_DIMENSIONS = 'order_dimensions';
|
||||
|
||||
const CANCEL_PROPERTY_CODE = 'INTAROCRM_IS_CANCELED';
|
||||
|
||||
@ -44,6 +45,8 @@ class RetailCrmOrder
|
||||
return false;
|
||||
}
|
||||
|
||||
$dimensions = COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_DIMENSIONS, 'N');
|
||||
|
||||
$order = array(
|
||||
'number' => $arFields['NUMBER'],
|
||||
'externalId' => $arFields['ID'],
|
||||
@ -147,7 +150,7 @@ class RetailCrmOrder
|
||||
|
||||
$order['items'][] = $item;
|
||||
|
||||
if ($send) {
|
||||
if ($send && $dimensions == 'Y') {
|
||||
$dimensions = RCrmActions::unserializeArrayRecursive($product['DIMENSIONS']);
|
||||
$width += $dimensions['WIDTH'];
|
||||
$height += $dimensions['HEIGHT'];
|
||||
@ -156,7 +159,7 @@ class RetailCrmOrder
|
||||
}
|
||||
}
|
||||
|
||||
if ($send) {
|
||||
if ($send && $dimensions == 'Y') {
|
||||
$order['width'] = $width;
|
||||
$order['height'] = $height;
|
||||
$order['length'] = $length;
|
||||
|
@ -1,4 +1,6 @@
|
||||
- В настройку экспорта добавлена настройка свойств типа "справочник"(highloadblock)
|
||||
- Добавлена проверка необходимости резервации товаров при выгрузке заказов из retailCRM
|
||||
- Исправлен вызов рекурсивного метода в RCrmActions
|
||||
- Добавлены недостающие поля retailcrm.json
|
||||
- Улучшена выгрузка свойств товаров типа "справочник"
|
||||
- Добавлена настройка выгрузки габаритов и веса в заказе
|
||||
- Добавлена совместимость натройки экспорта для Google Chrome
|
||||
- Исправлена ошибка при выгрузке истории с пустым городом
|
||||
- Добавлены проверки на существование модуля Highloadblock
|
||||
- Исправлен баг с отправкой пустого заказа при удалении в 1С-Битрикс
|
||||
|
@ -23,12 +23,16 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
}
|
||||
}
|
||||
|
||||
CModule::IncludeModule('highloadblock');
|
||||
$hlblockList = array();
|
||||
$hlblockListDb = \Bitrix\Highloadblock\HighloadBlockTable::getList();
|
||||
$hlblockModule = false;
|
||||
|
||||
while ($hlblockArr = $hlblockListDb->Fetch()) {
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]] = $hlblockArr;
|
||||
if (CModule::IncludeModule('highloadblock')) {
|
||||
$hlblockModule = true;
|
||||
$hlblockList = array();
|
||||
$hlblockListDb = \Bitrix\Highloadblock\HighloadBlockTable::getList();
|
||||
|
||||
while ($hlblockArr = $hlblockListDb->Fetch()) {
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]] = $hlblockArr;
|
||||
}
|
||||
}
|
||||
|
||||
$iblockProperties = array(
|
||||
@ -61,17 +65,20 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$hbProps = ('highloadblock' . $hlblockTable . '_' . $prop);
|
||||
$hbProps = $$hbProps;
|
||||
if ($hlblockModule === true) {
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$hbProps = ('highloadblock' . $hlblockTable . '_' . $prop);
|
||||
$hbProps = $$hbProps;
|
||||
|
||||
if (is_array($hbProps)) {
|
||||
foreach ($hbProps as $iblock => $val) {
|
||||
$IBLOCK_PROPERTY_SKU_HIGHLOADBLOCK[$hlblockTable][$iblock][$prop] = $val;
|
||||
if (is_array($hbProps)) {
|
||||
foreach ($hbProps as $iblock => $val) {
|
||||
$IBLOCK_PROPERTY_SKU_HIGHLOADBLOCK[$hlblockTable][$iblock][$prop] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$IBLOCK_PROPERTY_PRODUCT = array();
|
||||
$IBLOCK_PROPERTY_PRODUCT_HIGHLOADBLOCK = array();
|
||||
$IBLOCK_PROPERTY_UNIT_PRODUCT = array();
|
||||
@ -92,13 +99,15 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$hbProps = ('highloadblock_product' . $hlblockTable . '_' . $prop);
|
||||
$hbProps = $$hbProps;
|
||||
if ($hlblockModule === true) {
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$hbProps = ('highloadblock_product' . $hlblockTable . '_' . $prop);
|
||||
$hbProps = $$hbProps;
|
||||
|
||||
if (is_array($hbProps)) {
|
||||
foreach ($hbProps as $iblock => $val) {
|
||||
$IBLOCK_PROPERTY_PRODUCT_HIGHLOADBLOCK[$hlblockTable][$iblock][$prop] = $val;
|
||||
if (is_array($hbProps)) {
|
||||
foreach ($hbProps as $iblock => $val) {
|
||||
$IBLOCK_PROPERTY_PRODUCT_HIGHLOADBLOCK[$hlblockTable][$iblock][$prop] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -111,8 +120,12 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
$loader->propertiesUnitSKU = $IBLOCK_PROPERTY_UNIT_SKU;
|
||||
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
|
||||
$loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_PRODUCT;
|
||||
$loader->highloadblockSkuProperties = $IBLOCK_PROPERTY_SKU_HIGHLOADBLOCK;
|
||||
$loader->highloadblockProductProperties = $IBLOCK_PROPERTY_PRODUCT_HIGHLOADBLOCK;
|
||||
|
||||
if ($hlblockModule === true) {
|
||||
$loader->highloadblockSkuProperties = $IBLOCK_PROPERTY_SKU_HIGHLOADBLOCK;
|
||||
$loader->highloadblockProductProperties = $IBLOCK_PROPERTY_PRODUCT_HIGHLOADBLOCK;
|
||||
}
|
||||
|
||||
$loader->filename = $SETUP_FILE_NAME;
|
||||
$loader->serverName = $SERVER_NAME;
|
||||
$loader->application = $APPLICATION;
|
||||
|
@ -51,18 +51,20 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
}
|
||||
|
||||
//highloadblock
|
||||
CModule::IncludeModule('highloadblock');
|
||||
$hlblockList = array();
|
||||
$hlblockListDb = \Bitrix\Highloadblock\HighloadBlockTable::getList();
|
||||
if (CModule::IncludeModule('highloadblock')) {
|
||||
$hlblockModule = true;
|
||||
$hlblockList = array();
|
||||
$hlblockListDb = \Bitrix\Highloadblock\HighloadBlockTable::getList();
|
||||
|
||||
while ($hlblockArr = $hlblockListDb->Fetch()) {
|
||||
$hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlblockArr["ID"])->fetch();
|
||||
$entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
|
||||
$hbFields = $entity->getFields();
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['LABEL'] = $hlblockArr["NAME"];
|
||||
while ($hlblockArr = $hlblockListDb->Fetch()) {
|
||||
$hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlblockArr["ID"])->fetch();
|
||||
$entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
|
||||
$hbFields = $entity->getFields();
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['LABEL'] = $hlblockArr["NAME"];
|
||||
|
||||
foreach ($hbFields as $hbFieldCode => $hbField) {
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['FIELDS'][] = $hbFieldCode;
|
||||
foreach ($hbFields as $hbFieldCode => $hbField) {
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['FIELDS'][] = $hbFieldCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +90,6 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$IBLOCK_PROPERTY_PRODUCT = array();
|
||||
$IBLOCK_PROPERTY_UNIT_PRODUCT = array();
|
||||
foreach ($iblockProperties as $prop) {
|
||||
@ -612,13 +613,13 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
<font class="text"><?=GetMessage("FILENAME");?><br><br></font>
|
||||
<input type="text" name="SETUP_FILE_NAME"
|
||||
value="<?=htmlspecialcharsbx(strlen($SETUP_FILE_NAME) > 0 ?
|
||||
$SETUP_FILE_NAME :
|
||||
(COption::GetOptionString(
|
||||
'catalog',
|
||||
'export_default_path',
|
||||
'/bitrix/catalog_export/'))
|
||||
.'retailcrm'.'.xml'
|
||||
); ?>" size="50">
|
||||
$SETUP_FILE_NAME :
|
||||
(COption::GetOptionString(
|
||||
'catalog',
|
||||
'export_default_path',
|
||||
'/bitrix/catalog_export/'))
|
||||
.'retailcrm'.'.xml'
|
||||
); ?>" size="50">
|
||||
<br>
|
||||
<br>
|
||||
|
||||
@ -733,17 +734,21 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
$("#" + bid).siblings('#highloadblock').remove();
|
||||
}
|
||||
}
|
||||
|
||||
if ($(obj).find('option')[obj.selectedIndex].className == 'not-highloadblock') {
|
||||
var a = $(obj).find('option')[obj.selectedIndex].parent('select').siblings('#highloadblock');
|
||||
$(a).remove();
|
||||
}
|
||||
|
||||
if ($(obj).find('option')[obj.selectedIndex].className == 'highloadblock') {
|
||||
getHbFromAjax($(obj).find('option')[obj.selectedIndex], 'sku');
|
||||
}
|
||||
|
||||
if ($(obj).find('option')[obj.selectedIndex].className == 'highloadblock-product') {
|
||||
getHbFromAjax($(obj).find('option')[obj.selectedIndex], 'product');
|
||||
}
|
||||
};
|
||||
$('.highloadblock').on('click', function() {
|
||||
getHbFromAjax($(this), 'sku');
|
||||
});
|
||||
$('.highloadblock-product').on('click', function() {
|
||||
getHbFromAjax($(this), 'product');
|
||||
});
|
||||
$('.not-highloadblock').on('click', function() {
|
||||
var a = $(this).parent('select').siblings('#highloadblock');
|
||||
$(a).remove();
|
||||
});
|
||||
|
||||
function getHbFromAjax(that, type) {
|
||||
var url = $('td .adm-list-table-cell').parents('form').attr('action');
|
||||
var get = '<?php echo http_build_query($_GET); ?>';
|
||||
@ -790,12 +795,14 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
$vals .= ",IBLOCK_PROPERTY_PRODUCT_" . $val;
|
||||
$vals .= ",IBLOCK_PROPERTY_UNIT_PRODUCT_" . $val;
|
||||
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$vals .= ',highloadblock'. $hlblockTable .'_' . $val;
|
||||
}
|
||||
if ($hlblockModule === true) {
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$vals .= ',highloadblock' . $hlblockTable . '_' . $val;
|
||||
}
|
||||
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$vals .= ',highloadblock_product'. $hlblockTable .'_' . $val;
|
||||
foreach ($hlblockList as $hlblockTable => $hlblock) {
|
||||
$vals .= ',highloadblock_product' . $hlblockTable . '_' . $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -807,7 +814,6 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
<input type="hidden" name="SETUP_FIELDS_LIST" value="<? echo $vals ?>">
|
||||
<input type="submit" value="<?echo ($ACTION=="EXPORT")?GetMessage("CET_EXPORT"):GetMessage("CET_SAVE")?>">
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
<?
|
||||
@ -818,4 +824,4 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
|
||||
$FINITE = true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -768,19 +768,22 @@ class intaro_retailcrm extends CModule
|
||||
$iblocks = $_POST['IBLOCK_EXPORT'];
|
||||
}
|
||||
|
||||
$hlblockModule = false;
|
||||
//highloadblock
|
||||
CModule::IncludeModule('highloadblock');
|
||||
$hlblockList = array();
|
||||
$hlblockListDb = \Bitrix\Highloadblock\HighloadBlockTable::getList();
|
||||
if (CModule::IncludeModule('highloadblock')) {
|
||||
$hlblockModule = true;
|
||||
$hlblockList = array();
|
||||
$hlblockListDb = \Bitrix\Highloadblock\HighloadBlockTable::getList();
|
||||
|
||||
while ($hlblockArr = $hlblockListDb->Fetch()) {
|
||||
$hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlblockArr["ID"])->fetch();
|
||||
$entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
|
||||
$hbFields = $entity->getFields();
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['LABEL'] = $hlblockArr["NAME"];
|
||||
while ($hlblockArr = $hlblockListDb->Fetch()) {
|
||||
$hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlblockArr["ID"])->fetch();
|
||||
$entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
|
||||
$hbFields = $entity->getFields();
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['LABEL'] = $hlblockArr["NAME"];
|
||||
|
||||
foreach ($hbFields as $hbFieldCode => $hbField) {
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['FIELDS'][] = $hbFieldCode;
|
||||
foreach ($hbFields as $hbFieldCode => $hbField) {
|
||||
$hlblockList[$hlblockArr["TABLE_NAME"]]['FIELDS'][] = $hbFieldCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -805,13 +808,16 @@ class intaro_retailcrm extends CModule
|
||||
foreach ($_POST['IBLOCK_PROPERTY_UNIT_SKU'. '_' . $prop] as $iblock => $val) {
|
||||
$propertiesUnitSKU[$iblock][$prop] = $val;
|
||||
}
|
||||
foreach ($hlblockList as $tableName => $hb) {
|
||||
foreach ($_POST['highloadblock' . $tableName . '_' . $prop] as $iblock => $val) {
|
||||
$propertiesHbSKU[$tableName][$iblock][$prop] = $val;
|
||||
|
||||
if ($hlblockModule === true) {
|
||||
foreach ($hlblockList as $tableName => $hb) {
|
||||
foreach ($_POST['highloadblock' . $tableName . '_' . $prop] as $iblock => $val) {
|
||||
$propertiesHbSKU[$tableName][$iblock][$prop] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$propertiesProduct = array();
|
||||
$propertiesUnitProduct = array();
|
||||
$propertiesHbProduct = array();
|
||||
@ -822,9 +828,12 @@ class intaro_retailcrm extends CModule
|
||||
foreach ($_POST['IBLOCK_PROPERTY_UNIT_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
||||
$propertiesUnitProduct[$iblock][$prop] = $val;
|
||||
}
|
||||
foreach ($hlblockList as $tableName => $hb) {
|
||||
foreach ($_POST['highloadblock_product' . $tableName . '_' . $prop] as $iblock => $val) {
|
||||
$propertiesHbProduct[$tableName][$iblock][$prop] = $val;
|
||||
|
||||
if ($hlblockModule === true) {
|
||||
foreach ($hlblockList as $tableName => $hb) {
|
||||
foreach ($_POST['highloadblock_product' . $tableName . '_' . $prop] as $iblock => $val) {
|
||||
$propertiesHbProduct[$tableName][$iblock][$prop] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -834,7 +843,7 @@ class intaro_retailcrm extends CModule
|
||||
} else {
|
||||
$filename = $_POST['SETUP_FILE_NAME'];
|
||||
}
|
||||
|
||||
|
||||
if (!isset($_POST['TYPE_LOADING'])) {
|
||||
$typeLoading = 0;
|
||||
} else {
|
||||
@ -850,11 +859,11 @@ class intaro_retailcrm extends CModule
|
||||
if ($typeLoading != 'none' && $profileName == "") {
|
||||
$arResult['errCode'] = 'ERR_FIELDS_PROFILE';
|
||||
}
|
||||
|
||||
|
||||
if ($filename == "") {
|
||||
$arResult['errCode'] = 'ERR_FIELDS_FILE';
|
||||
}
|
||||
|
||||
|
||||
if (isset($arResult['errCode']) && $arResult['errCode']) {
|
||||
$arOldValues = array(
|
||||
'IBLOCK_EXPORT' => $iblocks,
|
||||
@ -870,7 +879,7 @@ class intaro_retailcrm extends CModule
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step5.php'
|
||||
);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -878,7 +887,7 @@ class intaro_retailcrm extends CModule
|
||||
RegisterModuleDependences("sale", "OnOrderUpdate", $this->MODULE_ID, "RetailCrmEvent", "onUpdateOrder");
|
||||
RegisterModuleDependences("main", "OnAfterUserUpdate", $this->MODULE_ID, "RetailCrmEvent", "OnAfterUserUpdate");
|
||||
RegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $this->MODULE_ID, "RetailCrmEvent", "orderSave");
|
||||
RegisterModuleDependences("sale", "OnSaleOrderEntityDelete", $this->MODULE_ID, "RetailCrmEvent", "orderDelete");
|
||||
RegisterModuleDependences("sale", "OnSaleOrderDeleted", $this->MODULE_ID, "RetailCrmEvent", "orderDelete");
|
||||
RegisterModuleDependences("sale", "OnSalePaymentEntitySaved", $this->MODULE_ID, "RetailCrmEvent", "paymentSave");
|
||||
RegisterModuleDependences("sale", "OnSalePaymentEntityDeleted", $this->MODULE_ID, "RetailCrmEvent", "paymentDelete");
|
||||
|
||||
@ -888,6 +897,19 @@ class intaro_retailcrm extends CModule
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_COLLECTOR, 'N');
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_UA, 'N');
|
||||
|
||||
//agent
|
||||
$dateAgent = new DateTime();
|
||||
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
|
||||
$dateAgent->add($intAgent);
|
||||
|
||||
CAgent::AddAgent(
|
||||
"RCrmActions::orderAgent();", $this->MODULE_ID, "N", 600, // interval - 10 mins
|
||||
$dateAgent->format('d.m.Y H:i:s'), // date of first check
|
||||
"Y", // agent is active
|
||||
$dateAgent->format('d.m.Y H:i:s'), // date of first start
|
||||
30
|
||||
);
|
||||
|
||||
$this->CopyFiles();
|
||||
if (isset($_POST['LOAD_NOW'])) {
|
||||
$loader = new RetailCrmICML();
|
||||
@ -896,14 +918,18 @@ class intaro_retailcrm extends CModule
|
||||
$loader->propertiesProduct = $propertiesProduct;
|
||||
$loader->propertiesUnitSKU = $propertiesUnitSKU;
|
||||
$loader->propertiesSKU = $propertiesSKU;
|
||||
$loader->highloadblockSkuProperties = $propertiesHbSKU;
|
||||
$loader->highloadblockProductProperties = $propertiesHbProduct;
|
||||
|
||||
if ($hlblockModule === true) {
|
||||
$loader->highloadblockSkuProperties = $propertiesHbSKU;
|
||||
$loader->highloadblockProductProperties = $propertiesHbProduct;
|
||||
}
|
||||
|
||||
$loader->filename = $filename;
|
||||
$loader->serverName = \Bitrix\Main\Context::getCurrent()->getServer()->getHttpHost();
|
||||
$loader->application = $APPLICATION;
|
||||
$loader->Load();
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
@ -915,6 +941,7 @@ class intaro_retailcrm extends CModule
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ar = $this->GetProfileSetupVars(
|
||||
$iblocks,
|
||||
$propertiesProduct,
|
||||
@ -1010,19 +1037,6 @@ class intaro_retailcrm extends CModule
|
||||
}
|
||||
}
|
||||
|
||||
//agent
|
||||
$dateAgent = new DateTime();
|
||||
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
|
||||
$dateAgent->add($intAgent);
|
||||
|
||||
CAgent::AddAgent(
|
||||
"RCrmActions::orderAgent();", $this->MODULE_ID, "N", 600, // interval - 10 mins
|
||||
$dateAgent->format('d.m.Y H:i:s'), // date of first check
|
||||
"Y", // agent is active
|
||||
$dateAgent->format('d.m.Y H:i:s'), // date of first start
|
||||
30
|
||||
);
|
||||
|
||||
$api_host = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, 0);
|
||||
$api_key = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, 0);
|
||||
$this->RETAIL_CRM_API = new \RetailCrm\ApiClient($api_host, $api_key);
|
||||
@ -1036,7 +1050,7 @@ class intaro_retailcrm extends CModule
|
||||
}
|
||||
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step6.php'
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step6.php'
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1095,7 +1109,7 @@ class intaro_retailcrm extends CModule
|
||||
UnRegisterModuleDependences("sale", "OnOrderUpdate", $this->MODULE_ID, "RetailCrmEvent", "onUpdateOrder");
|
||||
UnRegisterModuleDependences("main", "OnAfterUserUpdate", $this->MODULE_ID, "RetailCrmEvent", "OnAfterUserUpdate");
|
||||
UnRegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $this->MODULE_ID, "RetailCrmEvent", "orderSave");
|
||||
UnRegisterModuleDependences("sale", "OnSaleOrderEntityDelete", $this->MODULE_ID, "RetailCrmEvent", "orderDelete");
|
||||
UnRegisterModuleDependences("sale", "OnSaleBeforeOrderDelete", $this->MODULE_ID, "RetailCrmEvent", "orderDelete");
|
||||
UnRegisterModuleDependences("main", "OnBeforeProlog", $this->MODULE_ID, "RetailCrmCollector", "add");
|
||||
UnRegisterModuleDependences("main", "OnBeforeProlog", $this->MODULE_ID, "RetailCrmUa", "add");
|
||||
UnRegisterModuleDependences("sale", "OnSalePaymentEntitySaved", $this->MODULE_ID, "RetailCrmEvent", "paymentSave");
|
||||
@ -1170,14 +1184,18 @@ class intaro_retailcrm extends CModule
|
||||
foreach ($propertiesUnitProduct as $iblock => $arr)
|
||||
foreach ($arr as $id => $val)
|
||||
$strVars .= 'IBLOCK_PROPERTY_UNIT_PRODUCT_' . $id . '[' . $iblock . ']=' . $val . '&';
|
||||
foreach ($propertiesHbSKU as $table => $arr)
|
||||
foreach ($arr as $iblock => $val)
|
||||
foreach ($val as $id => $value)
|
||||
$strVars .= 'highloadblock' . $table . '_' . $id . '[' . $iblock . ']=' . $value . '&';
|
||||
foreach ($propertiesHbProduct as $table => $arr)
|
||||
foreach ($arr as $iblock => $val)
|
||||
foreach ($val as $id => $value)
|
||||
$strVars .= 'highloadblock_product' . $table . '_' . $id . '[' . $iblock . ']=' . $value . '&';
|
||||
if ($propertiesHbSKU) {
|
||||
foreach ($propertiesHbSKU as $table => $arr)
|
||||
foreach ($arr as $iblock => $val)
|
||||
foreach ($val as $id => $value)
|
||||
$strVars .= 'highloadblock' . $table . '_' . $id . '[' . $iblock . ']=' . $value . '&';
|
||||
}
|
||||
if ($propertiesHbProduct) {
|
||||
foreach ($propertiesHbProduct as $table => $arr)
|
||||
foreach ($arr as $iblock => $val)
|
||||
foreach ($val as $id => $value)
|
||||
$strVars .= 'highloadblock_product' . $table . '_' . $id . '[' . $iblock . ']=' . $value . '&';
|
||||
}
|
||||
|
||||
$strVars .= 'SETUP_FILE_NAME=' . urlencode($filename);
|
||||
|
||||
@ -1276,4 +1294,4 @@ class intaro_retailcrm extends CModule
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,6 @@ if (!empty($oldValues)) {
|
||||
$boolExport = (in_array($iblock['ID'], $IBLOCK_EXPORT));
|
||||
else
|
||||
$boolExport = true;
|
||||
|
||||
|
||||
$arIBlockList[] = array(
|
||||
'ID' => $iblock['ID'],
|
||||
@ -457,8 +456,6 @@ if (!empty($oldValues)) {
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<? endforeach;?>
|
||||
</div>
|
||||
|
||||
@ -469,14 +466,13 @@ if (!empty($oldValues)) {
|
||||
<font class="text"><?=GetMessage("FILENAME");?><br><br></font>
|
||||
<input type="text" name="SETUP_FILE_NAME"
|
||||
value="<?=htmlspecialcharsbx(strlen($SETUP_FILE_NAME) > 0 ?
|
||||
$SETUP_FILE_NAME :
|
||||
(COption::GetOptionString(
|
||||
'catalog',
|
||||
'export_default_path',
|
||||
'/bitrix/catalog_export/'))
|
||||
.'retailcrm'/* .mt_rand(0, 999999) */.'.xml'
|
||||
); ?>" size="50">
|
||||
|
||||
$SETUP_FILE_NAME :
|
||||
(COption::GetOptionString(
|
||||
'catalog',
|
||||
'export_default_path',
|
||||
'/bitrix/catalog_export/'))
|
||||
.'retailcrm'/* .mt_rand(0, 999999) */.'.xml'
|
||||
); ?>" size="50">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
@ -536,9 +532,9 @@ if (!empty($oldValues)) {
|
||||
transition : BX.easing.transitions.linear,
|
||||
step : function(state){
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
BX('IBLOCK_EXPORT_TABLE'+(i+1)).style.opacity = state.opacity/100;
|
||||
}
|
||||
{
|
||||
BX('IBLOCK_EXPORT_TABLE'+(i+1)).style.opacity = state.opacity/100;
|
||||
}
|
||||
},
|
||||
complete : function() {
|
||||
for (i = 0; i < cnt; i++)
|
||||
@ -594,6 +590,19 @@ if (!empty($oldValues)) {
|
||||
$("#" + bid).siblings('#highloadblock').remove();
|
||||
}
|
||||
}
|
||||
|
||||
if ($(obj).find('option')[obj.selectedIndex].className == 'not-highloadblock') {
|
||||
var a = $(obj).find('option')[obj.selectedIndex].parent('select').siblings('#highloadblock');
|
||||
$(a).remove();
|
||||
}
|
||||
|
||||
if ($(obj).find('option')[obj.selectedIndex].className == 'highloadblock') {
|
||||
getHbFromAjax($(obj).find('option')[obj.selectedIndex], 'sku');
|
||||
}
|
||||
|
||||
if ($(obj).find('option')[obj.selectedIndex].className == 'highloadblock-product') {
|
||||
getHbFromAjax($(obj).find('option')[obj.selectedIndex], 'product');
|
||||
}
|
||||
};
|
||||
function checkProfile(obj)
|
||||
{
|
||||
@ -602,16 +611,7 @@ if (!empty($oldValues)) {
|
||||
else
|
||||
$('#profile-field').hide();
|
||||
};
|
||||
$('.highloadblock').on('click', function() {
|
||||
getHbFromAjax($(this), 'sku');
|
||||
});
|
||||
$('.highloadblock-product').on('click', function() {
|
||||
getHbFromAjax($(this), 'product');
|
||||
});
|
||||
$('.not-highloadblock').on('click', function() {
|
||||
var a = $(this).parent('select').siblings('#highloadblock');
|
||||
$(a).remove();
|
||||
});
|
||||
|
||||
function getHbFromAjax(that, type) {
|
||||
var url = $('td .adm-list-table-cell').parents('form').attr('action');
|
||||
var td = $(that).parents('td .adm-list-table-cell');
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?
|
||||
$arModuleVersion = array(
|
||||
"VERSION" => "2.3.5",
|
||||
"VERSION_DATE" => "2018-03-22 17:15:00"
|
||||
"VERSION" => "2.3.6",
|
||||
"VERSION_DATE" => "2018-05-23 13:15:00"
|
||||
);
|
||||
|
@ -73,6 +73,7 @@ $MESS ['ORDER_NUMBERS'] = 'Транслировать номера заказо
|
||||
|
||||
$MESS ['CRM_API_VERSION'] = 'Версия API клиента';
|
||||
$MESS ['CURRENCY'] = 'Валюта, устанавливаемая в заказе при выгрузке из CRM';
|
||||
$MESS ['ORDER_DIMENSIONS'] = 'Передавать габариты и вес товаров в заказе';
|
||||
|
||||
$MESS ['INVENTORIES_UPLOAD'] = 'Включить выгрузку остатков в разрезе складов';
|
||||
$MESS ['INVENTORIES'] = 'Склады';
|
||||
|
@ -42,6 +42,7 @@ $CRM_API_VERSION = 'api_version';
|
||||
|
||||
$CRM_CURRENCY = 'currency';
|
||||
$CRM_ADDRESS_OPTIONS = 'address_options';
|
||||
$CRM_DIMENSIONS = 'order_dimensions';
|
||||
|
||||
if(!CModule::IncludeModule('intaro.retailcrm') || !CModule::IncludeModule('sale') || !CModule::IncludeModule('iblock') || !CModule::IncludeModule('catalog'))
|
||||
return;
|
||||
@ -278,7 +279,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
// remove depenedencies
|
||||
UnRegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $mid, "RetailCrmEvent", "orderSave");
|
||||
UnRegisterModuleDependences("sale", "OnOrderUpdate", $mid, "RetailCrmEvent", "onUpdateOrder");
|
||||
UnRegisterModuleDependences("sale", "OnSaleOrderEntityDelete", $mid, "RetailCrmEvent", "orderDelete");
|
||||
UnRegisterModuleDependences("sale", "OnSaleOrderDeleted", $mid, "RetailCrmEvent", "orderDelete");
|
||||
UnRegisterModuleDependences("sale", "OnSalePaymentEntitySaved", $mid, "RetailCrmEvent", "paymentSave");
|
||||
UnRegisterModuleDependences("sale", "OnSalePaymentEntityDeleted", $mid, "RetailCrmEvent", "paymentDelete");
|
||||
|
||||
@ -286,7 +287,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
// event dependencies
|
||||
RegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $mid, "RetailCrmEvent", "orderSave");
|
||||
RegisterModuleDependences("sale", "OnOrderUpdate", $mid, "RetailCrmEvent", "onUpdateOrder");
|
||||
RegisterModuleDependences("sale", "OnSaleOrderEntityDelete", $mid, "RetailCrmEvent", "orderDelete");
|
||||
RegisterModuleDependences("sale", "OnSaleOrderDeleted", $mid, "RetailCrmEvent", "orderDelete");
|
||||
RegisterModuleDependences("sale", "OnSalePaymentEntitySaved", $mid, "RetailCrmEvent", "paymentSave");
|
||||
RegisterModuleDependences("sale", "OnSalePaymentEntityDeleted", $mid, "RetailCrmEvent", "paymentDelete");
|
||||
}
|
||||
@ -335,7 +336,9 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
}
|
||||
//order numbers
|
||||
$orderNumbers = htmlspecialchars(trim($_POST['order-numbers'])) ? htmlspecialchars(trim($_POST['order-numbers'])) : 'N';
|
||||
|
||||
|
||||
$orderDimensions = htmlspecialchars(trim($_POST[$CRM_DIMENSIONS])) ? htmlspecialchars(trim($_POST[$CRM_DIMENSIONS])) : 'N';
|
||||
|
||||
//stores
|
||||
$bitrixStoresArr = array();
|
||||
$bitrixShopsArr = array();
|
||||
@ -480,7 +483,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST['currency']) {
|
||||
if ($_POST[$CRM_CURRENCY]) {
|
||||
COption::SetOptionString($mid, $CRM_CURRENCY, $_POST['currency']);
|
||||
}
|
||||
|
||||
@ -514,6 +517,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
|
||||
COption::SetOptionString($mid, $CRM_UA, $ua);
|
||||
COption::SetOptionString($mid, $CRM_UA_KEYS, serialize(RCrmActions::clearArr($uaKeys)));
|
||||
COption::SetOptionString($mid, $CRM_DIMENSIONS, $orderDimensions);
|
||||
|
||||
$uri .= '&ok=Y';
|
||||
LocalRedirect($uri);
|
||||
@ -620,6 +624,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
$currencyOption = COption::GetOptionString($mid, $CRM_CURRENCY, 0) ? COption::GetOptionString($mid, $CRM_CURRENCY, 0) : $baseCurrency;
|
||||
$currencyList = \Bitrix\Currency\CurrencyManager::getCurrencyList();
|
||||
|
||||
$optionsOrderDimensions = COption::GetOptionString($mid, $CRM_DIMENSIONS, 'N');
|
||||
$addressOptions = unserialize(COption::GetOptionString($mid, $CRM_ADDRESS_OPTIONS, 0));
|
||||
|
||||
$aTabs = array(
|
||||
@ -1075,7 +1080,16 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
<label><input class="addr" type="checkbox" name="order-numbers" value="Y" <?php if($optionsOrderNumbers == 'Y') echo "checked"; ?>> <?php echo GetMessage('ORDER_NUMBERS'); ?></label>
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
||||
<b>
|
||||
<label>
|
||||
<input class="addr" type="checkbox" name="order_dimensions" value="Y" <?php if($optionsOrderDimensions == 'Y') echo "checked"; ?>> <?php echo GetMessage('ORDER_DIMENSIONS'); ?>
|
||||
</label>
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
||||
<b>
|
||||
@ -1112,7 +1126,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<?php if ($optionInventotiesUpload === 'Y' || count($arResult['bitrixStoresExportList']) > 0) :?>
|
||||
<tr class="heading inventories-batton">
|
||||
<td colspan="2" class="option-other-heading">
|
||||
|
Loading…
x
Reference in New Issue
Block a user