1
0
mirror of synced 2025-01-18 08:51:40 +03:00
This commit is contained in:
Akolzin Dmitry 2018-10-04 16:28:14 +03:00
parent b22d464b56
commit 038739d45f
12 changed files with 474 additions and 414 deletions

View File

@ -1,3 +1,9 @@
## 2018-10-04 v.2.3.11
* Добавлен учет настроек часового пояса при создании заказа
* Устранено удаление событий изменения оплат при переводе выгрузки на агент
* Добавлена возможность указать свойство в настройках экспорта, из которого будет подставляться картинка, если отсутствует в "Подробно" и "Анонс"
* Добавлена подстановка домена в ссылках каталога в зависимости от пренадлежности инфоблока к сайту
## 2018-09-26 v.2.3.10
* Исправлена некорректная генерация скрипта UA
* Исправлена выгрузка остатков, если для товара указано более 50 складов

View File

@ -10,6 +10,7 @@ class RetailCrmICML
public $iblocks;
public $filename;
public $serverName;
public $defaultServerName;
public $propertiesSKU;
public $propertiesUnitSKU;
public $propertiesProduct;
@ -20,6 +21,8 @@ class RetailCrmICML
public $encoding = 'utf-8';
public $encodingDefault = 'utf-8';
public $loadPurchasePrice = false;
public $productPictures;
public $skuPictures;
protected $fp;
protected $mainSection = 1000000;
@ -136,7 +139,7 @@ class RetailCrmICML
$newText = $this->application->ConvertCharset($text, $this->encodingDefault, $this->encoding);
$newText = strip_tags($newText);
$newText = str_replace("&", "&", $newText);
return $newText;
}
@ -245,7 +248,6 @@ class RetailCrmICML
protected function BuildOffers(&$allCategories)
{
$basePriceId = COption::GetOptionString(
$this->MODULE_ID,
$this->CRM_CATALOG_BASE_PRICE . (is_null($this->profileID) === false ? '_' . $this->profileID : ''),
@ -253,7 +255,16 @@ class RetailCrmICML
);
foreach ($this->iblocks as $key => $id) {
$site = CAllIBlock::GetSite($id)->Fetch();
if ($site['SERVER_NAME']) {
$this->serverName = $site['SERVER_NAME'];
} else {
$this->serverName = $this->defaultServerName;
}
$barcodes = array();
$dbBarCode = CCatalogStoreBarCode::getList(
array(),
array("IBLOCK_ID" => $id),
@ -270,8 +281,8 @@ class RetailCrmICML
$highloadblockSkuProps = array();
$highloadblockProductProps = array();
$productProps = CIBlockproperty::GetList(array(), array("IBLOCK_ID" => $id));
while ($arrProductProps = $productProps->Fetch()) {
if ($arrProductProps["USER_TYPE"] == 'directory') {
@ -282,10 +293,9 @@ class RetailCrmICML
// Get Info by infoblocks
$iblock['IBLOCK_DB'] = CIBlock::GetByID($id)->Fetch();
$iblockOffer = CCatalogSKU::GetInfoByProductIBlock($id);
$skuProps = CIBlockproperty::GetList(array(), array("IBLOCK_ID" => $iblockOffer['IBLOCK_ID']));
while ($arrSkuProps = $skuProps->Fetch()) {
while ($arrSkuProps = $skuProps->Fetch()) {
if ($arrSkuProps["USER_TYPE"] == 'directory') {
$highloadblockSkuProps[$arrSkuProps['CODE']] = $arrSkuProps;
}
@ -306,19 +316,26 @@ class RetailCrmICML
// Set selected properties
foreach ($this->propertiesProduct[$id] as $key => $propProduct) {
if ($this->propertiesProduct[$id][$key] != "") {
$arSelect[] = "PROPERTY_" . $propProduct;
$arSelect[] = "PROPERTY_" . $propProduct . ".NAME";
$arSelect[] = "PROPERTY_" . $propProduct;
$arSelect[] = "PROPERTY_" . $propProduct . ".NAME";
}
}
if ($this->productPictures && isset($this->productPictures[$id])) {
$arSelect[] = "PROPERTY_" . $this->productPictures[$id]['picture'];
$arSelect[] = "PROPERTY_" . $this->productPictures[$id]['picture'] . ".NAME";
}
$arSelectOffer = array(
'ID',
"NAME",
"DETAIL_PAGE_URL",
"DETAIL_PICTURE",
"PREVIEW_PICTURE",
'PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'],
"CATALOG_GROUP_" . $basePriceId
);
// Set selected properties
foreach ($this->propertiesSKU[$id] as $key => $propSKU) {
if ($this->propertiesSKU[$id][$key] != "") {
@ -327,6 +344,11 @@ class RetailCrmICML
}
}
if ($this->skuPictures && isset($this->skuPictures[$id])) {
$arSelectOffer[] = "PROPERTY_" . $this->skuPictures[$id]['picture'];
$arSelectOffer[] = "PROPERTY_" . $this->skuPictures[$id]['picture'] . ".NAME";
}
// Set filter
$filter = array(
"IBLOCK_ID" => $id
@ -352,40 +374,16 @@ class RetailCrmICML
$dbResProducts = CIBlockElement::GetList($order, $arfilter, false, false, $arSelect);
$pictures = array();
$products = array();
while ($product = $dbResProducts->GetNext()) {
// Compile products to array
$products[$product['ID']] = $product;
$products[$product['ID']]['offers'] = array();
$detailPicture = intval($product["DETAIL_PICTURE"]);
$previewPicture = intval($product["PREVIEW_PICTURE"]);
if ($detailPicture > 0 || $previewPicture > 0) {
$picture = $detailPicture;
if ($picture <= 0) {
$picture = $previewPicture;
}
// Link pictureID and productID
$pictures[$picture] = $product['ID'];
}
}
unset($product);
unset($detailPicture, $previewPicture, $picture);
$pictureIDs = array_keys($pictures);
// Get pathes of pictures
$dbFiles = CFile::GetList(array(), array("@ID" => implode(',', $pictureIDs)));
while ($file = $dbFiles->GetNext()) {
// Link picture to product
$products[$pictures[$file['ID']]]['PICTURE'] = $this->protocol .
$this->serverName .
'/upload/' . $file['SUBDIR'] .
'/' . $file['FILE_NAME'] ;
}
unset($pictures);
if (!empty($iblockOffer['IBLOCK_ID'])) {
$arFilterOffer = array(
@ -411,116 +409,140 @@ class RetailCrmICML
$stringOffers = "";
foreach ($products as $product) {
// Get properties of product
$resPropertiesProduct = Array();
foreach ($this->propertiesProduct[$id] as $key => $propProduct) {
$resPropertiesProduct[$key] = "";
if (CFile::GetPath($product["DETAIL_PICTURE"])) {
$product['PICTURE'] = $this->protocol . $this->serverName . CFile::GetPath($product["DETAIL_PICTURE"]);
} elseif (CFile::GetPath($product["PREVIEW_PICTURE"])){
$product['PICTURE'] = $this->protocol . $this->serverName . CFile::GetPath($product["PREVIEW_PICTURE"]);
} elseif (
$this->productPictures
&& isset($this->productPictures[$id])
&& CFile::GetPath($product["PROPERTY_" . $this->productPictures[$id]['picture'] . "_VALUE"])
) {
$picture = CFile::GetPath($product["PROPERTY_" . $this->productPictures[$id]['picture'] . "_VALUE"]);
$product['PICTURE'] = $this->protocol . $this->serverName . $picture;
}
if ($propProduct != "") {
if (isset($product["PROPERTY_" . $propProduct . "_NAME"])) {
$resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_NAME"];
} elseif (isset($product["PROPERTY_" . $propProduct . "_VALUE"])) {
$resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_VALUE"];
} elseif (isset($product[$propProduct])) {
$resPropertiesProduct[$key] = $product[$propProduct];
}
if (array_key_exists($key, $this->propertiesUnitProduct[$id])) {
$resPropertiesProduct[$key] *= $this->measurement[$this->propertiesUnitProduct[$id][$key]];
$resPropertiesProduct[$key . "_UNIT"] = $this->measurementLink[$this->propertiesUnitProduct[$id][$key]];
}
if (isset($highloadblockProductProps[$propProduct])) {
$propVal = $this->getHBprop($highloadblockProductProps[$propProduct], $product["PROPERTY_" . $propProduct . "_VALUE"]);
$tableName = $highloadblockProductProps[$propProduct]['USER_TYPE_SETTINGS']['TABLE_NAME'];
$field = $this->highloadblockProductProperties[$tableName][$iblockOffer['IBLOCK_ID']][$key];
// Get properties of product
$resPropertiesProduct = Array();
foreach ($this->propertiesProduct[$id] as $key => $propProduct) {
$resPropertiesProduct[$key] = "";
$resPropertiesProduct[$key] = $propVal[$field];
}
if ($propProduct != "") {
if (isset($product["PROPERTY_" . $propProduct . "_NAME"])) {
$resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_NAME"];
} elseif (isset($product["PROPERTY_" . $propProduct . "_VALUE"])) {
$resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_VALUE"];
} elseif (isset($product[$propProduct])) {
$resPropertiesProduct[$key] = $product[$propProduct];
}
if (array_key_exists($key, $this->propertiesUnitProduct[$id])) {
$resPropertiesProduct[$key] *= $this->measurement[$this->propertiesUnitProduct[$id][$key]];
$resPropertiesProduct[$key . "_UNIT"] = $this->measurementLink[$this->propertiesUnitProduct[$id][$key]];
}
if (isset($highloadblockProductProps[$propProduct])) {
$propVal = $this->getHBprop($highloadblockProductProps[$propProduct], $product["PROPERTY_" . $propProduct . "_VALUE"]);
$tableName = $highloadblockProductProps[$propProduct]['USER_TYPE_SETTINGS']['TABLE_NAME'];
$field = $this->highloadblockProductProperties[$tableName][$id][$key];
$resPropertiesProduct[$key] = $propVal[$field];
}
}
}
// Get categories of product
$categories = array();
$dbResCategories = CIBlockElement::GetElementGroups($product['ID'], true);
while ($arResCategory = $dbResCategories->Fetch()) {
$categories[$arResCategory["ID"]] = array(
'ID' => $arResCategory["ID"],
'NAME' => $arResCategory["NAME"],
);
}
if (count($categories) == 0) {
$catId = $this->mainSection + $id;
$categories[$catId] = $allCategories[$catId];
}
// Get categories of product
$categories = array();
$dbResCategories = CIBlockElement::GetElementGroups($product['ID'], true);
while ($arResCategory = $dbResCategories->Fetch()) {
$categories[$arResCategory["ID"]] = array(
'ID' => $arResCategory["ID"],
'NAME' => $arResCategory["NAME"],
);
}
if (count($categories) == 0) {
$catId = $this->mainSection + $id;
$categories[$catId] = $allCategories[$catId];
}
$existOffer = false;
if (!empty($iblockOffer['IBLOCK_ID'])) {
foreach ($product['offers'] as $offer) {
$offer['BARCODE'] = isset($barcodes[$offer['ID']]) ? $barcodes[$offer['ID']] : '';
$offer['PRODUCT_ID'] = $product["ID"];
$offer['DETAIL_PAGE_URL'] = $product["DETAIL_PAGE_URL"];
$existOffer = false;
if (!empty($iblockOffer['IBLOCK_ID'])) {
foreach ($product['offers'] as $offer) {
$offer['BARCODE'] = isset($barcodes[$offer['ID']]) ? $barcodes[$offer['ID']] : '';
$offer['PRODUCT_ID'] = $product["ID"];
$offer['DETAIL_PAGE_URL'] = $product["DETAIL_PAGE_URL"];
if (CFile::GetPath($offer["DETAIL_PICTURE"])) {
$offer['PICTURE'] = $this->protocol . $this->serverName . CFile::GetPath($offer["DETAIL_PICTURE"]);
} else {
$offer['PICTURE'] = $product["PICTURE"];
}
$offer['PRODUCT_NAME'] = $product["NAME"];
$offer['PRODUCT_ACTIVE'] = $product["ACTIVE"];
$offer['PRICE'] = $offer['CATALOG_PRICE_' . $basePriceId];
$offer['PURCHASE_PRICE'] = $offer['CATALOG_PURCHASING_PRICE'];
$offer['QUANTITY'] = $offer["CATALOG_QUANTITY"];
// Get properties of product
foreach ($this->propertiesSKU[$id] as $key => $propSKU) {
if ($propSKU != "") {
if (isset ($offer["PROPERTY_" . $propSKU . "_NAME"])) {
$offer['_PROP_' . $key] = $offer["PROPERTY_" . $propSKU . "_NAME"];
} elseif (isset($offer["PROPERTY_" . $propSKU . "_VALUE"])) {
$offer['_PROP_' . $key] = $offer["PROPERTY_" . $propSKU . "_VALUE"];
} elseif (isset($offer[$propSKU])) {
$offer['_PROP_' . $key] = $offer[$propSKU];
}
if (array_key_exists($key, $this->propertiesUnitSKU[$id])) {
$offer['_PROP_' . $key] *= $this->measurement[$this->propertiesUnitSKU[$id][$key]];
$offer['_PROP_' . $key . "_UNIT"] = $this->measurementLink[$this->propertiesUnitSKU[$id][$key]];
}
if (isset($highloadblockSkuProps[$propSKU])) {
$propVal = $this->getHBprop($highloadblockSkuProps[$propSKU], $offer["PROPERTY_" . $propSKU . "_VALUE"]);
$tableName = $highloadblockSkuProps[$propSKU]['USER_TYPE_SETTINGS']['TABLE_NAME'];
$field = $this->highloadblockSkuProperties[$tableName][$id][$key];
$offer['_PROP_' . $key] = $propVal[$field];
}
}
}
foreach ($resPropertiesProduct as $key => $propProduct) {
if ($this->propertiesProduct[$id][$key] != "" && !isset($offer[$key])) {
$offer['_PROP_' . $key] = $propProduct;
}
}
$stringOffers .= $this->BuildOffer($offer, $categories, $iblock, $allCategories);
$existOffer = true;
if (CFile::GetPath($offer["DETAIL_PICTURE"])) {
$offer['PICTURE'] = $this->protocol . $this->serverName . CFile::GetPath($offer["DETAIL_PICTURE"]);
} elseif (CFile::GetPath($offer["PREVIEW_PICTURE"])){
$offer['PICTURE'] = $this->protocol . $this->serverName . CFile::GetPath($offer["PREVIEW_PICTURE"]);
} elseif (
$this->skuPictures
&& isset($this->skuPictures[$id])
&& CFile::GetPath($offer["PROPERTY_" . $this->skuPictures[$id]['picture'] . "_VALUE"])
) {
$picture = CFile::GetPath($offer["PROPERTY_" . $this->skuPictures[$id]['picture'] . "_VALUE"]);
$offer['PICTURE'] = $this->protocol . $this->serverName . $picture;
} else {
$offer['PICTURE'] = $product['PICTURE'];
}
$offer['PRODUCT_NAME'] = $product["NAME"];
$offer['PRODUCT_ACTIVE'] = $product["ACTIVE"];
$offer['PRICE'] = $offer['CATALOG_PRICE_' . $basePriceId];
$offer['PURCHASE_PRICE'] = $offer['CATALOG_PURCHASING_PRICE'];
$offer['QUANTITY'] = $offer["CATALOG_QUANTITY"];
// Get properties of product
foreach ($this->propertiesSKU[$id] as $key => $propSKU) {
if ($propSKU != "") {
if (isset ($offer["PROPERTY_" . $propSKU . "_NAME"])) {
$offer['_PROP_' . $key] = $offer["PROPERTY_" . $propSKU . "_NAME"];
} elseif (isset($offer["PROPERTY_" . $propSKU . "_VALUE"])) {
$offer['_PROP_' . $key] = $offer["PROPERTY_" . $propSKU . "_VALUE"];
} elseif (isset($offer[$propSKU])) {
$offer['_PROP_' . $key] = $offer[$propSKU];
}
if (array_key_exists($key, $this->propertiesUnitSKU[$id])) {
$offer['_PROP_' . $key] *= $this->measurement[$this->propertiesUnitSKU[$id][$key]];
$offer['_PROP_' . $key . "_UNIT"] = $this->measurementLink[$this->propertiesUnitSKU[$id][$key]];
}
if (isset($highloadblockSkuProps[$propSKU])) {
$propVal = $this->getHBprop($highloadblockSkuProps[$propSKU], $offer["PROPERTY_" . $propSKU . "_VALUE"]);
$tableName = $highloadblockSkuProps[$propSKU]['USER_TYPE_SETTINGS']['TABLE_NAME'];
$field = $this->highloadblockSkuProperties[$tableName][$id][$key];
$offer['_PROP_' . $key] = $propVal[$field];
}
}
}
}
if (!$existOffer) {
$offer['BARCODE'] = isset($barcodes[$product["ID"]]) ? $barcodes[$product["ID"]] : '';
$product['PRODUCT_ID'] = $product["ID"];
$product['PRODUCT_NAME'] = $product["NAME"];
$product['PRODUCT_ACTIVE'] = $product["ACTIVE"];
$product['PRICE'] = $product['CATALOG_PRICE_' . $basePriceId];
$product['PURCHASE_PRICE'] = $product['CATALOG_PURCHASING_PRICE'];
$product['QUANTITY'] = $product["CATALOG_QUANTITY"];
foreach ($resPropertiesProduct as $key => $propProduct) {
if ($this->propertiesProduct[$id][$key] != "" || $this->propertiesProduct[$id][str_replace("_UNIT", "", $key)] != "") {
$product['_PROP_' . $key] = $propProduct;
if ($this->propertiesProduct[$id][$key] != "" && !isset($offer[$key])) {
$offer['_PROP_' . $key] = $propProduct;
}
}
$stringOffers .= $this->BuildOffer($product, $categories, $iblock, $allCategories);
$stringOffers .= $this->BuildOffer($offer, $categories, $iblock, $allCategories);
$existOffer = true;
}
}
if (!$existOffer) {
$offer['BARCODE'] = isset($barcodes[$product["ID"]]) ? $barcodes[$product["ID"]] : '';
$product['PRODUCT_ID'] = $product["ID"];
$product['PRODUCT_NAME'] = $product["NAME"];
$product['PRODUCT_ACTIVE'] = $product["ACTIVE"];
$product['PRICE'] = $product['CATALOG_PRICE_' . $basePriceId];
$product['PURCHASE_PRICE'] = $product['CATALOG_PURCHASING_PRICE'];
$product['QUANTITY'] = $product["CATALOG_QUANTITY"];
foreach ($resPropertiesProduct as $key => $propProduct) {
if ($this->propertiesProduct[$id][$key] != "" || $this->propertiesProduct[$id][str_replace("_UNIT", "", $key)] != "") {
$product['_PROP_' . $key] = $propProduct;
}
}
$stringOffers .= $this->BuildOffer($product, $categories, $iblock, $allCategories);
}
}
unset($products);
@ -568,7 +590,10 @@ class RetailCrmICML
$arOffer['DETAIL_PAGE_URL'] = str_replace("#SECTION_PATH#", $path, $arOffer['DETAIL_PAGE_URL']);
}
$offer .= "<picture>" . $this->PrepareValue($arOffer["PICTURE"]) . "</picture>\n";
if (isset($arOffer["PICTURE"]) && $arOffer["PICTURE"]) {
$offer .= "<picture>" . $this->PrepareValue($arOffer["PICTURE"]) . "</picture>\n";
}
$offer .= "<url>" . $this->protocol . $this->serverName . $this->PrepareValue($arOffer['DETAIL_PAGE_URL']) . "</url>\n";
$offer .= "<price>" . $this->PrepareValue($arOffer['PRICE']) . "</price>\n";
@ -615,7 +640,7 @@ class RetailCrmICML
}
$offer.= "</offer>\n";
return $offer;
}

View File

@ -47,7 +47,7 @@ class RetailCrmOrder
$order = array(
'number' => $arFields['NUMBER'],
'externalId' => $arFields['ID'],
'createdAt' => new \DateTime($arFields['DATE_INSERT']),
'createdAt' => $arFields['DATE_INSERT'],
'customer' => array('externalId' => $arFields['USER_ID']),
'paymentType' => isset($arParams['optionsPayTypes'][$arFields['PAYMENTS'][0]]) ?
$arParams['optionsPayTypes'][$arFields['PAYMENTS'][0]] : '',
@ -92,7 +92,7 @@ class RetailCrmOrder
$server = \Bitrix\Main\Context::getCurrent()->getServer()->getDocumentRoot();
$countrys = array();
if (file_exists($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml')) {
$countrysFile = simplexml_load_file($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml');
$countrysFile = simplexml_load_file($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml');
foreach ($countrysFile->country as $country) {
$countrys[RCrmActions::fromJSON((string) $country->name)] = (string) $country->alpha;
}
@ -153,7 +153,7 @@ class RetailCrmOrder
$order = $newResOrder;
} elseif ($newResOrder === false) {
RCrmActions::eventLog('RetailCrmOrder::orderSend', 'retailCrmBeforeOrderSend()', 'OrderID = ' . $arFields['ID'] . '. Sending canceled after retailCrmBeforeOrderSend');
return false;
}
}
@ -172,7 +172,7 @@ class RetailCrmOrder
return $order;
}
/**
* Mass order uploading, without repeating; always returns true, but writes error log
* @param $pSize
@ -224,7 +224,7 @@ class RetailCrmOrder
$api_host = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_KEY_OPTION, 0);
$optionsSitesList = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_SITES_LIST, 0));
$optionsSitesList = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_SITES_LIST, 0));
$optionsOrderTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_TYPES_ARR, 0));
$optionsDelivTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_DELIVERY_TYPES_ARR, 0));
$optionsPayTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_TYPES, 0));
@ -258,19 +258,19 @@ class RetailCrmOrder
}
$order = self::orderObjToArr($id);
$user = Bitrix\Main\UserTable::getById($order['USER_ID'])->fetch();
$site = count($optionsSitesList) > 1 ? $optionsSitesList[$order['LID']] : null;
$arCustomers = RetailCrmUser::customerSend($user, $api, $optionsContragentType[$order['PERSON_TYPE_ID']], false, $site);
$arOrders = self::orderSend($order, $api, $arParams, false, $site);
$arOrders = self::orderSend($order, $api, $arParams, false, $site);
if (!$arCustomers || !$arOrders) {
continue;
}
$resCustomers[$order['LID']][] = $arCustomers;
$resOrders[$order['LID']][] = $arOrders;
$resOrders[$order['LID']][] = $arOrders;
$recOrders[] = $orderId;
}
@ -321,11 +321,12 @@ class RetailCrmOrder
public static function orderObjToArr($obOrder)
{
$culture = new \Bitrix\Main\Context\Culture(array("FORMAT_DATETIME" => "Y-m-d HH:i:s"));
$arOrder = array(
'ID' => $obOrder->getId(),
'NUMBER' => $obOrder->getField('ACCOUNT_NUMBER'),
'LID' => $obOrder->getSiteId(),
'DATE_INSERT' => $obOrder->getDateInsert()->toString(new \Bitrix\Main\Context\Culture(array("FORMAT_DATETIME" => "Y-m-d HH:i:s"))),
'DATE_INSERT' => $obOrder->getDateInsert()->toString($culture),
'STATUS_ID' => $obOrder->getField('STATUS_ID'),
'USER_ID' => $obOrder->getUserId(),
'PERSON_TYPE_ID' => $obOrder->getPersonTypeId(),
@ -341,7 +342,7 @@ class RetailCrmOrder
'COMMENTS' => $obOrder->getField('COMMENTS'),
'REASON_CANCELED' => $obOrder->getField('REASON_CANCELED'),
);
$shipmentList = $obOrder->getShipmentCollection();
foreach ($shipmentList as $shipmentData) {
if ($shipmentData->isSystem()) {
@ -370,7 +371,7 @@ class RetailCrmOrder
foreach ($basketItems as $item) {
$arOrder['BASKET'][] = $item->getFields();
}
return $arOrder;
}
}

View File

@ -36,7 +36,7 @@ class RetailCrmOrder
* @return array - array('order' = $order, 'customer' => $customer)
*/
public static function orderSend($arFields, $api, $arParams, $send = false, $site = null, $methodApi = 'ordersEdit')
{
{
if (!$api || empty($arParams)) { // add cond to check $arParams
return false;
}
@ -50,7 +50,7 @@ class RetailCrmOrder
$order = array(
'number' => $arFields['NUMBER'],
'externalId' => $arFields['ID'],
'createdAt' => new \DateTime($arFields['DATE_INSERT']),
'createdAt' => $arFields['DATE_INSERT'],
'customer' => array('externalId' => $arFields['USER_ID']),
'orderType' => isset($arParams['optionsOrderTypes'][$arFields['PERSON_TYPE_ID']]) ?
$arParams['optionsOrderTypes'][$arFields['PERSON_TYPE_ID']] : '',
@ -96,7 +96,7 @@ class RetailCrmOrder
$server = \Bitrix\Main\Context::getCurrent()->getServer()->getDocumentRoot();
$countrys = array();
if (file_exists($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml')) {
$countrysFile = simplexml_load_file($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml');
$countrysFile = simplexml_load_file($server . '/bitrix/modules/intaro.retailcrm/classes/general/config/country.xml');
foreach ($countrysFile->country as $country) {
$countrys[RCrmActions::fromJSON((string) $country->name)] = (string) $country->alpha;
}
@ -202,22 +202,30 @@ class RetailCrmOrder
}
$payments[] = $pm;
} else {
RCrmActions::eventLog('RetailCrmOrder::orderSend', 'payments', 'OrderID = ' . $arFields['ID'] . '. Payment not found.');
RCrmActions::eventLog(
'RetailCrmOrder::orderSend',
'payments',
'OrderID = ' . $arFields['ID'] . '. Payment not found.'
);
continue;
}
}
if (count($payments) > 0) {
$order['payments'] = $payments;
}
//send
if (function_exists('retailCrmBeforeOrderSend')) {
$newResOrder = retailCrmBeforeOrderSend($order, $arFields);
if (is_array($newResOrder) && !empty($newResOrder)) {
$order = $newResOrder;
} elseif ($newResOrder === false) {
RCrmActions::eventLog('RetailCrmOrder::orderSend', 'retailCrmBeforeOrderSend()', 'OrderID = ' . $arFields['ID'] . '. Sending canceled after retailCrmBeforeOrderSend');
RCrmActions::eventLog(
'RetailCrmOrder::orderSend',
'retailCrmBeforeOrderSend()',
'OrderID = ' . $arFields['ID'] . '. Sending canceled after retailCrmBeforeOrderSend'
);
return false;
}
@ -237,7 +245,7 @@ class RetailCrmOrder
return $order;
}
/**
* Mass order uploading, without repeating; always returns true, but writes error log
* @param $pSize
@ -289,7 +297,7 @@ class RetailCrmOrder
$api_host = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_KEY_OPTION, 0);
$optionsSitesList = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_SITES_LIST, 0));
$optionsSitesList = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_SITES_LIST, 0));
$optionsOrderTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_TYPES_ARR, 0));
$optionsDelivTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_DELIVERY_TYPES_ARR, 0));
$optionsPayTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_TYPES, 0));
@ -325,18 +333,18 @@ class RetailCrmOrder
$user = Bitrix\Main\UserTable::getById($order['USER_ID'])->fetch();
$arCustomers = RetailCrmUser::customerSend($user, $api, $optionsContragentType[$order['PERSON_TYPE_ID']], false, $site);
$arOrders = self::orderSend($order, $api, $arParams, false, $site);
$arOrders = self::orderSend($order, $api, $arParams, false, $site);
if (!$arCustomers || !$arOrders) {
continue;
}
$resCustomers[$order['LID']][] = $arCustomers;
$resOrders[$order['LID']][] = $arOrders;
$resOrders[$order['LID']][] = $arOrders;
$recOrders[] = $orderId;
}
if (count($resOrders) > 0) {
foreach ($resCustomers as $key => $customerLoad) {
if ($optionsSitesList) {
@ -384,11 +392,12 @@ class RetailCrmOrder
public static function orderObjToArr($obOrder)
{
$culture = new \Bitrix\Main\Context\Culture(array("FORMAT_DATETIME" => "Y-m-d HH:i:s"));
$arOrder = array(
'ID' => $obOrder->getId(),
'NUMBER' => $obOrder->getField('ACCOUNT_NUMBER'),
'LID' => $obOrder->getSiteId(),
'DATE_INSERT' => $obOrder->getDateInsert()->toString(new \Bitrix\Main\Context\Culture(array("FORMAT_DATETIME" => "Y-m-d HH:i:s"))),
'DATE_INSERT' => $obOrder->getDateInsert()->toString($culture),
'STATUS_ID' => $obOrder->getField('STATUS_ID'),
'USER_ID' => $obOrder->getUserId(),
'PERSON_TYPE_ID' => $obOrder->getPersonTypeId(),

View File

@ -1,3 +1,4 @@
- Исправлена некорректная генерация скрипта UA
- Улучшена выгрузка остатков по складам в retailCRM
- Улучшена обработка истории изменений заказов
- Добавлен учет настроек часового пояса при создании заказа
- Устранено удаление событий изменения оплат при переводе выгрузки на агент
- Добавлена возможность указать свойство в настройках экспорта, из которого будет подставляться картинка, если отсутствует в "Подробно" и "Анонс"
- Добавлена подстановка домена в ссылках каталога в зависимости от пренадлежности инфоблока к сайту

View File

@ -15,7 +15,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
if (!CModule::IncludeModule("intaro.retailcrm")){
return;
}
$rsSites = CSite::GetList($by, $sort, array('ACTIVE' => 'Y'));
while ($ar = $rsSites->Fetch()) {
if ($ar['DEF'] == 'Y') {
@ -113,6 +113,22 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
}
}
$productPictures = array();
if (is_array($IBLOCK_PROPERTY_PRODUCT_picture)) {
foreach ($IBLOCK_PROPERTY_PRODUCT_picture as $key => $value) {
$productPictures[$key]['picture'] = $value;
}
}
$skuPictures = array();
if (is_array($IBLOCK_PROPERTY_SKU_picture)) {
foreach ($IBLOCK_PROPERTY_SKU_picture as $key => $value) {
$skuPictures[$key]['picture'] = $value;
}
}
$loader = new RetailCrmICML();
$loader->profileID = $PROFILE_ID;
$loader->iblocks = $IBLOCK_EXPORT;
@ -120,6 +136,8 @@ 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->productPictures = $productPictures;
$loader->skuPictures = $skuPictures;
if ($hlblockModule === true) {
$loader->highloadblockSkuProperties = $IBLOCK_PROPERTY_SKU_HIGHLOADBLOCK;
@ -127,7 +145,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
}
$loader->filename = $SETUP_FILE_NAME;
$loader->serverName = $SERVER_NAME;
$loader->defaultServerName = $SERVER_NAME;
$loader->application = $APPLICATION;
$loader->loadPurchasePrice = $LOAD_PURCHASE_PRICE == 'Y';
$loader->Load();

View File

@ -29,6 +29,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
"length" => "length",
"width" => "width",
"height" => "height",
"picture" => "picture"
);
if(!check_bitrix_sessid()) {
@ -164,10 +165,10 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
"length" => GetMessage("PROPERTY_LENGTH_HEADER_NAME"),
"width" => GetMessage("PROPERTY_WIDTH_HEADER_NAME"),
"height" => GetMessage("PROPERTY_HEIGHT_HEADER_NAME"),
"picture" => GetMessage("PROPERTY_PICTURE_HEADER_NAME")
);
$iblockFieldsName = Array(
"weight" => Array("code" => "catalog_weight" , "name" => GetMessage("SELECT_WEIGHT_PROPERTY_NAME"), 'unit' => 'mass'),
"length" => Array("code" => "catalog_length" , "name" => GetMessage("SELECT_LENGTH_PROPERTY_NAME"), 'unit' => 'length'),
"width" => Array("code" => "catalog_width" , "name" => GetMessage("SELECT_WIDTH_PROPERTY_NAME"), 'unit' => 'length'),
@ -183,6 +184,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
"length" => Array("LENGTH", "DLINA"),
"width" => Array("WIDTH", "SHIRINA"),
"height" => Array("HEIGHT", "VISOTA"),
"picture" => Array("PICTURE", "PICTURE")
);
$units = Array(
@ -795,7 +797,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/php_interface/retailcrm/expor
$vals .= ",IBLOCK_PROPERTY_PRODUCT_" . $val;
$vals .= ",IBLOCK_PROPERTY_UNIT_PRODUCT_" . $val;
if ($hlblockModule === true) {
if ($hlblockModule === true && $val != 'picture') {
foreach ($hlblockList as $hlblockTable => $hlblock) {
$vals .= ',highloadblock' . $hlblockTable . '_' . $val;
}

View File

@ -10,7 +10,7 @@ IncludeModuleLangFile(__FILE__);
if (class_exists('intaro_retailcrm'))
return;
class intaro_retailcrm extends CModule
class intaro_retailcrm extends CModule
{
var $MODULE_ID = 'intaro.retailcrm';
var $OLD_MODULE_ID = 'intaro.intarocrm';
@ -19,10 +19,10 @@ class intaro_retailcrm extends CModule
var $MODULE_NAME;
var $MODULE_DESCRIPTION;
var $MODULE_GROUP_RIGHTS = 'N';
var $PARTNER_NAME;
var $PARTNER_URI;
var $RETAIL_CRM_API;
var $RETAIL_CRM_EXPORT = 'retailcrm';
var $CRM_API_HOST_OPTION = 'api_host';
@ -59,16 +59,16 @@ class intaro_retailcrm extends CModule
var $CRM_PRICES = 'prices';
var $CRM_PRICE_SHOPS = 'price_shops';
var $CRM_IBLOCKS_PRICES = 'iblock_prices';
var $CRM_COLLECTOR = 'collector';
var $CRM_COLL_KEY = 'coll_key';
var $CRM_UA = 'ua';
var $CRM_UA_KEYS = 'ua_keys';
var $CRM_API_VERSION = 'api_version';
var $HISTORY_TIME = 'history_time';
var $INSTALL_PATH;
function intaro_retailcrm()
@ -98,18 +98,18 @@ class intaro_retailcrm extends CModule
$APPLICATION->ThrowException(GetMessage("RETAILCRM_CURL_ERR"));
return false;
}
$infoSale = CModule::CreateModuleObject('sale')->MODULE_VERSION;
if (version_compare($infoSale, '16', '<=')) {
$APPLICATION->ThrowException(GetMessage("SALE_VERSION_ERR"));
return false;
}
if (!date_default_timezone_get()) {
if (!ini_get('date.timezone')) {
$APPLICATION->ThrowException(GetMessage("DATE_TIMEZONE_ERR"));
return false;
}
}
@ -124,7 +124,7 @@ class intaro_retailcrm extends CModule
include($this->INSTALL_PATH . '/../classes/general/Exception/CurlException.php');
include($this->INSTALL_PATH . '/../classes/general/RestNormalizer.php');
include($this->INSTALL_PATH . '/../classes/general/Logger.php');
$version = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_VERSION, 0);
if ($version == 'v4') {
include($this->INSTALL_PATH . '/../classes/general/ApiClient_v4.php');
@ -139,7 +139,7 @@ class intaro_retailcrm extends CModule
$step = intval($_REQUEST['step']);
if (file_exists($this->INSTALL_PATH . '/../classes/general/config/options.xml')) {
$options = simplexml_load_file($this->INSTALL_PATH . '/../classes/general/config/options.xml');
$options = simplexml_load_file($this->INSTALL_PATH . '/../classes/general/config/options.xml');
foreach ($options->contragents->contragent as $contragent) {
$type["NAME"] = $APPLICATION->ConvertCharset((string)$contragent, 'utf-8', SITE_CHARSET);
@ -157,8 +157,8 @@ class intaro_retailcrm extends CModule
$arResult['orderProps'][] = $type;
} else {
$groups = explode(",", (string)$field["group"]);
foreach ($groups as $group) {
$type["GROUP"][] = trim($group);
foreach ($groups as $group) {
$type["GROUP"][] = trim($group);
}
$arResult['legalDetails'][] = $type;
}
@ -184,14 +184,14 @@ class intaro_retailcrm extends CModule
if (!CModule::IncludeModule("catalog")) {
$arResult['errCode'] = 'ERR_CATALOG';
}
if ($api_host = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_API_HOST_OPTION, 0)) {
$arResult['API_HOST'] = $api_host;
}
if ($api_key = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_API_KEY_OPTION, 0)) {
$arResult['API_KEY'] = $api_key;
}
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
);
@ -213,17 +213,17 @@ class intaro_retailcrm extends CModule
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
);
return;
}
$api_host = htmlspecialchars(trim($_POST[$this->CRM_API_HOST_OPTION]));
$api_key = htmlspecialchars(trim($_POST[$this->CRM_API_KEY_OPTION]));
// form correct url
$api_host = parse_url($api_host);
if ($api_host['scheme'] != 'https') {
$api_host['scheme'] = 'https';
$api_host['scheme'] = 'https';
}
$api_host = $api_host['scheme'] . '://' . $api_host['host'];
@ -232,10 +232,10 @@ class intaro_retailcrm extends CModule
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
);
return;
}
$ping = self::ping($api_host, $api_key);
if (isset($ping['sitesList'])) {
$arResult['sitesList'] = $ping['sitesList'];
@ -244,13 +244,13 @@ class intaro_retailcrm extends CModule
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
);
return;
}
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, $api_host);
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, $api_key);
if ($sites_list = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_SITES_LIST, 0)) {
$arResult['SITES_LIST'] = unserialize($sites_list);
}
@ -273,14 +273,14 @@ class intaro_retailcrm extends CModule
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
);
return;
}
$arResult['arSites'] = RCrmActions::SitesList();
if (count($arResult['arSites']) > 1) {
$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);
@ -296,7 +296,7 @@ class intaro_retailcrm extends CModule
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step11.php'
);
return;
}
@ -318,10 +318,10 @@ class intaro_retailcrm extends CModule
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
);
return;
}
$ping = self::ping($api_host, $api_key);
if (isset($ping['sitesList'])) {
$arResult['sitesList'] = $ping['sitesList'];
@ -330,18 +330,18 @@ class intaro_retailcrm extends CModule
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
);
return;
}
$this->RETAIL_CRM_API = new \RetailCrm\ApiClient($api_host, $api_key);
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, $api_host);
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, $api_key);
COption::SetOptionString($this->MODULE_ID, $this->CRM_SITES_LIST, serialize(array()));
}
//prepare crm lists
try {
try {
$arResult['orderTypesList'] = $this->RETAIL_CRM_API->orderTypesList()->orderTypes;
$arResult['deliveryTypesList'] = $this->RETAIL_CRM_API->deliveryTypesList()->deliveryTypes;
$arResult['deliveryServicesList'] = $this->RETAIL_CRM_API->deliveryServicesList()->deliveryServices;
@ -359,7 +359,7 @@ class intaro_retailcrm extends CModule
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step1.php'
);
return;
}
@ -370,10 +370,10 @@ class intaro_retailcrm extends CModule
}
}
$arResult['deliveryTypesList'] = $delivTypes;
//bitrix personTypes
$arResult['bitrixOrderTypesList'] = RCrmActions::OrderTypesList($arResult['arSites']);
//bitrix deliveryList
$arResult['bitrixDeliveryTypesList'] = RCrmActions::DeliveryList();
@ -382,7 +382,7 @@ class intaro_retailcrm extends CModule
//bitrix statusesList --statuses
$arResult['bitrixStatusesList'] = RCrmActions::StatusesList();
if ($order_types = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_ORDER_TYPES_ARR, 0)) {
$arResult['ORDER_TYPES'] = array_flip(unserialize($order_types));
}
@ -421,7 +421,7 @@ class intaro_retailcrm extends CModule
//bitrix orderTypesList
$arResult['arSites'] = RCrmActions::SitesList();
$arResult['bitrixOrderTypesList'] = RCrmActions::OrderTypesList($arResult['arSites']);
$orderTypesArr = array();
foreach ($arResult['bitrixOrderTypesList'] as $orderType) {
$orderTypesArr[$orderType['ID']] = htmlspecialchars(trim($_POST['order-type-' . $orderType['ID']]));
@ -429,7 +429,7 @@ class intaro_retailcrm extends CModule
//bitrix deliveryTypesList
$arResult['bitrixDeliveryTypesList'] = RCrmActions::DeliveryList();
if (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'false') {
$deliveryTypesArr = array();
foreach ($arResult['bitrixDeliveryTypesList'] as $delivery) {
@ -482,7 +482,7 @@ class intaro_retailcrm extends CModule
//bitrix paymentTypesList
$arResult['bitrixPaymentTypesList'] = RCrmActions::PaymentList();
$paymentTypesArr = array();
foreach ($arResult['bitrixPaymentTypesList'] as $payment) {
$paymentTypesArr[$payment['ID']] = htmlspecialchars(trim($_POST['payment-type-' . $payment['ID']]));
@ -490,7 +490,7 @@ class intaro_retailcrm extends CModule
//bitrix statusesList
$arResult['bitrixStatusesList'] = RCrmActions::StatusesList();
$paymentStatusesArr = array();
$canselOrderArr = array();
@ -505,9 +505,9 @@ class intaro_retailcrm extends CModule
$paymentArr = array();
$paymentArr['Y'] = htmlspecialchars(trim($_POST['payment-Y']));
$paymentArr['N'] = htmlspecialchars(trim($_POST['payment-N']));
//new page
//form orderProps
//form orderProps
$arResult['arProp'] = RCrmActions::OrderPropsList();
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_TYPES_ARR, serialize(RCrmActions::clearArr($orderTypesArr)));
@ -519,7 +519,7 @@ class intaro_retailcrm extends CModule
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_DISCHARGE, 1);
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_FAILED_IDS, serialize(array()));
COption::SetOptionString($this->MODULE_ID, $this->CRM_CANSEL_ORDER, serialize(RCrmActions::clearArr($canselOrderArr)));
if ($orderProps = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_ORDER_PROPS, 0)) {
$arResult['ORDER_PROPS'] = unserialize($orderProps);
}
@ -532,7 +532,7 @@ class intaro_retailcrm extends CModule
if ($contragentType = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_CONTRAGENT_TYPE, 0)) {
$arResult['CONTRAGENT_TYPES'] = unserialize($contragentType);
}
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step3.php'
);
@ -573,16 +573,16 @@ class intaro_retailcrm extends CModule
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
die(json_encode(array("finish" => $finish, "percent" => $percent)));
}
if (isset($_POST['back']) && $_POST['back']) {
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step2.php'
);
}
//bitrix orderTypesList
$orderTypesList = RCrmActions::OrderTypesList(RCrmActions::SitesList());
$orderTypesArr = array();
foreach ($orderTypesList as $orderType) {
$orderTypesArr[$orderType['ID']] = htmlspecialchars(trim($_POST['order-type-' . $orderType['ID']]));
@ -601,7 +601,7 @@ class intaro_retailcrm extends CModule
}
$orderPropsArr[$orderType['ID']] = $_orderPropsArr;
}
//legal details props
$legalDetailsArr = array();
foreach ($orderTypesList as $orderType) {
@ -631,7 +631,7 @@ class intaro_retailcrm extends CModule
COption::SetOptionString($this->MODULE_ID, $this->CRM_CUSTOM_FIELDS, serialize(RCrmActions::clearArr($customFieldsArr)));
COption::SetOptionString($this->MODULE_ID, $this->CRM_LEGAL_DETAILS, serialize(RCrmActions::clearArr($legalDetailsArr)));
COption::SetOptionString($this->MODULE_ID, $this->CRM_CONTRAGENT_TYPE, serialize(RCrmActions::clearArr($contragentTypeArr)));
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step4.php'
);
@ -667,14 +667,14 @@ class intaro_retailcrm extends CModule
if (!CModule::IncludeModule("sale")) {
$arResult['errCode'] = 'ERR_SALE';
}
$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);
$api = new \RetailCrm\ApiClient($api_host, $api_key);
$customerH = self::historyLoad($api, 'customersHistory');
COption::SetOptionString($this->MODULE_ID, $this->CRM_CUSTOMER_HISTORY, $customerH);
//new data
if ($historyDate = COption::GetOptionString($this->OLD_MODULE_ID, 'order_history_date', 0)) {
try {
@ -703,7 +703,7 @@ class intaro_retailcrm extends CModule
}
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_HISTORY, $orderH);
if ($orderLastId = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_ORDER_LAST_ID, 0)) {
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, $orderLastId);
} else {
@ -719,7 +719,7 @@ class intaro_retailcrm extends CModule
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
}
}
if ($orderFailedIds = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_ORDER_FAILED_IDS, 0)) {
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_FAILED_IDS, $orderFailedIds);
}
@ -752,7 +752,7 @@ class intaro_retailcrm extends CModule
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), $this->INSTALL_PATH . '/step5.php'
);
return;
}
@ -796,11 +796,13 @@ class intaro_retailcrm extends CModule
"length" => "length",
"width" => "width",
"height" => "height",
"picture" => "picture",
);
$propertiesSKU = array();
$propertiesUnitSKU = array();
$propertiesHbSKU = array();
foreach ($iblockProperties as $prop) {
foreach ($_POST['IBLOCK_PROPERTY_SKU'. '_' . $prop] as $iblock => $val) {
$propertiesSKU[$iblock][$prop] = $val;
@ -809,7 +811,7 @@ class intaro_retailcrm extends CModule
$propertiesUnitSKU[$iblock][$prop] = $val;
}
if ($hlblockModule === true) {
if ($hlblockModule === true && $prop != 'picture') {
foreach ($hlblockList as $tableName => $hb) {
foreach ($_POST['highloadblock' . $tableName . '_' . $prop] as $iblock => $val) {
$propertiesHbSKU[$tableName][$iblock][$prop] = $val;
@ -821,6 +823,7 @@ class intaro_retailcrm extends CModule
$propertiesProduct = array();
$propertiesUnitProduct = array();
$propertiesHbProduct = array();
foreach ($iblockProperties as $prop) {
foreach ($_POST['IBLOCK_PROPERTY_PRODUCT'. '_' . $prop] as $iblock => $val) {
$propertiesProduct[$iblock][$prop] = $val;
@ -829,7 +832,7 @@ class intaro_retailcrm extends CModule
$propertiesUnitProduct[$iblock][$prop] = $val;
}
if ($hlblockModule === true) {
if ($hlblockModule === true && $prop != 'picture') {
foreach ($hlblockList as $tableName => $hb) {
foreach ($_POST['highloadblock_product' . $tableName . '_' . $prop] as $iblock => $val) {
$propertiesHbProduct[$tableName][$iblock][$prop] = $val;
@ -891,7 +894,7 @@ class intaro_retailcrm extends CModule
RegisterModuleDependences("sale", "OnSalePaymentEntitySaved", $this->MODULE_ID, "RetailCrmEvent", "paymentSave");
RegisterModuleDependences("sale", "OnSalePaymentEntityDeleted", $this->MODULE_ID, "RetailCrmEvent", "paymentDelete");
COption::SetOptionString($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE, htmlspecialchars(trim($_POST['price-types'])));
COption::SetOptionString($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE, htmlspecialchars(trim($_POST['price-types'])));
COption::SetOptionString($this->MODULE_ID, $this->CRM_INVENTORIES_UPLOAD, 'N');
COption::SetOptionString($this->MODULE_ID, $this->CRM_PRICES_UPLOAD, 'N');
COption::SetOptionString($this->MODULE_ID, $this->CRM_COLLECTOR, 'N');
@ -911,7 +914,7 @@ class intaro_retailcrm extends CModule
);
$this->CopyFiles();
if (isset($_POST['LOAD_NOW'])) {
if (isset($_POST['LOAD_NOW'])) {
$loader = new RetailCrmICML();
$loader->iblocks = $iblocks;
$loader->propertiesUnitProduct = $propertiesUnitProduct;
@ -927,8 +930,8 @@ class intaro_retailcrm extends CModule
$loader->filename = $filename;
$loader->serverName = \Bitrix\Main\Context::getCurrent()->getServer()->getHttpHost();
$loader->application = $APPLICATION;
$loader->Load();
}
$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')) {
@ -965,7 +968,7 @@ class intaro_retailcrm extends CModule
));
if (intval($PROFILE_ID) <= 0) {
$arResult['errCode'] = 'ERR_IBLOCK';
return;
}
if ($typeLoading == 'agent') {
@ -1055,7 +1058,7 @@ class intaro_retailcrm extends CModule
}
}
function DoUninstall()
function DoUninstall()
{
global $APPLICATION;
@ -1086,23 +1089,23 @@ class intaro_retailcrm extends CModule
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_NUMBERS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_CANSEL_ORDER);
COption::RemoveOption($this->MODULE_ID, $this->CRM_INVENTORIES_UPLOAD);
COption::RemoveOption($this->MODULE_ID, $this->CRM_STORES);
COption::RemoveOption($this->MODULE_ID, $this->CRM_SHOPS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_IBLOCKS_INVENTORIES);
COption::RemoveOption($this->MODULE_ID, $this->CRM_PRICES_UPLOAD);
COption::RemoveOption($this->MODULE_ID, $this->CRM_PRICES);
COption::RemoveOption($this->MODULE_ID, $this->CRM_PRICE_SHOPS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_IBLOCKS_PRICES);
COption::RemoveOption($this->MODULE_ID, $this->CRM_COLLECTOR);
COption::RemoveOption($this->MODULE_ID, $this->CRM_COLL_KEY);
COption::RemoveOption($this->MODULE_ID, $this->CRM_UA);
COption::RemoveOption($this->MODULE_ID, $this->CRM_UA_KEYS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_VERSION);
COption::RemoveOption($this->MODULE_ID, $this->HISTORY_TIME);
@ -1135,7 +1138,7 @@ class intaro_retailcrm extends CModule
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_UNINSTALL_TITLE'), $this->INSTALL_PATH . '/unstep1.php'
);
}
}
function CopyFiles()
{
@ -1170,18 +1173,18 @@ class intaro_retailcrm extends CModule
$filename
) {
$strVars = "";
foreach ($iblocks as $key => $val)
foreach ($iblocks as $key => $val)
$strVars .= 'IBLOCK_EXPORT[' . $key . ']=' . $val . '&';
foreach ($propertiesSKU as $iblock => $arr)
foreach ($propertiesSKU as $iblock => $arr)
foreach ($arr as $id => $val)
$strVars .= 'IBLOCK_PROPERTY_SKU_' . $id . '[' . $iblock . ']=' . $val . '&';
foreach ($propertiesUnitSKU as $iblock => $arr)
foreach ($propertiesUnitSKU as $iblock => $arr)
foreach ($arr as $id => $val)
$strVars .= 'IBLOCK_PROPERTY_UNIT_SKU_' . $id . '[' . $iblock . ']=' . $val . '&';
foreach ($propertiesProduct as $iblock => $arr)
foreach ($propertiesProduct as $iblock => $arr)
foreach ($arr as $id => $val)
$strVars .= 'IBLOCK_PROPERTY_PRODUCT_' . $id . '[' . $iblock . ']=' . $val . '&';
foreach ($propertiesUnitProduct as $iblock => $arr)
foreach ($propertiesUnitProduct as $iblock => $arr)
foreach ($arr as $id => $val)
$strVars .= 'IBLOCK_PROPERTY_UNIT_PRODUCT_' . $id . '[' . $iblock . ']=' . $val . '&';
if ($propertiesHbSKU) {
@ -1201,7 +1204,7 @@ class intaro_retailcrm extends CModule
return $strVars;
}
function historyLoad($api, $method)
{
$page = null;
@ -1244,10 +1247,10 @@ class intaro_retailcrm extends CModule
return $end['id'];
}
if (isset($history['history'])) {
$end = array_pop($history['history']);
break;
} else {
$page--;
@ -1263,7 +1266,7 @@ class intaro_retailcrm extends CModule
return $end['id'];
}
function ping($api_host, $api_key)
{
global $APPLICATION;
@ -1283,7 +1286,7 @@ class intaro_retailcrm extends CModule
}
if ($result->getStatusCode() == 200) {
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_VERSION, $version);
COption::SetOptionString($this->MODULE_ID, $this->CRM_API_VERSION, $version);
$res['sitesList'] = $APPLICATION->ConvertCharsetArray($result->sites, 'utf-8', SITE_CHARSET);
return $res;

View File

@ -20,14 +20,13 @@ if (!empty($oldValues)) {
}
?>
<style type="text/css">
.iblock-export-table-display-none {
display: none;
}
</style>
<form method="post" action="<?php echo $APPLICATION->GetCurPage(); ?>" >
<form method="post" action="<?php echo $APPLICATION->GetCurPage(); ?>" >
<h3><?=GetMessage("SETTINGS_INFOBLOCK");?></h3>
<font class="text"><?=GetMessage("EXPORT_CATALOGS");?><br><br></font>
<?
@ -35,7 +34,7 @@ if (!empty($oldValues)) {
{
$IBLOCK_EXPORT = array();
}
$iblockPropertiesName = Array(
"article" => GetMessage("PROPERTY_ARTICLE_HEADER_NAME"),
"manufacturer" => GetMessage("PROPERTY_MANUFACTURER_HEADER_NAME"),
@ -45,16 +44,16 @@ if (!empty($oldValues)) {
"length" => GetMessage("PROPERTY_LENGTH_HEADER_NAME"),
"width" => GetMessage("PROPERTY_WIDTH_HEADER_NAME"),
"height" => GetMessage("PROPERTY_HEIGHT_HEADER_NAME"),
"picture" => GetMessage("PROPERTY_PICTURE_HEADER_NAME"),
);
$iblockFieldsName = Array(
"weight" => Array("code" => "catalog_size" , "name" => GetMessage("SELECT_WEIGHT_PROPERTY_NAME"), 'unit' => 'mass'),
"length" => Array("code" => "catalog_length" , "name" => GetMessage("SELECT_LENGTH_PROPERTY_NAME"), 'unit' => 'length'),
"width" => Array("code" => "catalog_width" , "name" => GetMessage("SELECT_WIDTH_PROPERTY_NAME"), 'unit' => 'length'),
"height" => Array("code" => "catalog_height" , "name" => GetMessage("SELECT_HEIGHT_PROPERTY_NAME"), 'unit' => 'length'),
);
$iblockPropertiesHint = Array(
"article" => Array("ARTICLE", "ART", "ARTNUMBER", "ARTICUL", "ARTIKUL"),
"manufacturer" => Array("MANUFACTURER", "PROISVODITEL", "PROISVOD", "PROISV"),
@ -64,8 +63,9 @@ if (!empty($oldValues)) {
"length" => Array("LENGTH", "DLINA"),
"width" => Array("WIDTH", "SHIRINA"),
"height" => Array("HEIGHT", "VISOTA"),
"picture" => Array("PICTURE", "PICTURE"),
);
$units = Array(
'length' => Array(
'mm' => GetMessage("UNIT_MEASUREMENT_MM"),
@ -78,13 +78,11 @@ if (!empty($oldValues)) {
'kg' => GetMessage("UNIT_MEASUREMENT_KG"),
)
);
$hintUnit = Array(
'length' => 'mm',
'mass' => 'g'
);
$boolAll = false;
$intCountChecked = 0;
@ -101,11 +99,11 @@ if (!empty($oldValues)) {
if ($arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
{
$iblockOffer = CCatalogSKU::GetInfoByProductIBlock($iblock["ID"]);
$db_properties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], Array());
while($prop = $db_properties->Fetch())
$propertiesSKU[] = $prop;
$oldPropertySKU = null;
if (isset($IBLOCK_PROPERTY_SKU[$iblock['ID']])) {
foreach ($iblockPropertiesName as $key => $prop) {
@ -118,28 +116,28 @@ if (!empty($oldValues)) {
$oldPropertyUnitSKU[$key] = $IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']][$key];
}
}
}
}
$propertiesProduct = null;
$db_properties = CIBlock::GetProperties($iblock['ID'], Array());
while($prop = $db_properties->Fetch())
$propertiesProduct[] = $prop;
$oldPropertyProduct = null;
if (isset($IBLOCK_PROPERTY_PRODUCT[$iblock['ID']])) {
foreach ($iblockPropertiesName as $key => $prop) {
$oldPropertyProduct[$key] = $IBLOCK_PROPERTY_PRODUCT[$iblock['ID']][$key];
}
}
$oldPropertyUnitProduct = null;
if (isset($IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']])) {
foreach ($iblockPropertiesName as $key => $prop) {
$oldPropertyUnitProduct[$key] = $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']][$key];
}
}
$arSiteList = array();
$rsSites = CIBlock::GetSite($iblock["ID"]);
while ($arSite = $rsSites->Fetch())
@ -183,12 +181,12 @@ if (!empty($oldValues)) {
?>
<font class="text" style="font-weight: bold;"><?=GetMessage("CHECK_ALL_INFOBLOCKS");?></font>
<input
style="vertical-align: middle;"
type="checkbox"
name="icml_export_all"
id="icml_export_all"
value="Y"
<input
style="vertical-align: middle;"
type="checkbox"
name="icml_export_all"
id="icml_export_all"
value="Y"
onclick="checkAll(this,<? echo $intCountAvailIBlock; ?>);"
<? echo ($boolAll ? ' checked' : ''); ?>>
</br>
@ -213,7 +211,7 @@ if (!empty($oldValues)) {
<table class="adm-list-table" id="export_setup" <?=($arIBlock['PROPERTIES_SKU'] == null ? 'style="width: 66%;"': "" )?> >
<thead>
<tr class="adm-list-table-header">
<td class="adm-list-table-cell">
<td class="adm-list-table-cell">
<div class="adm-list-table-cell-inner"><?=GetMessage("LOADED_PROPERTY");?></div>
</td>
<td class="adm-list-table-cell">
@ -227,9 +225,9 @@ if (!empty($oldValues)) {
</tr>
</thead>
<tbody>
<? foreach ($iblockPropertiesName as $key => $property): ?>
<? $productSelected = false;?>
<tr class="adm-list-table-row">
@ -268,7 +266,7 @@ if (!empty($oldValues)) {
}
?>
>
<?=$field['name'];?>
</option>
<? endif; ?>
@ -310,7 +308,7 @@ if (!empty($oldValues)) {
</optgroup>
<?}?>
</select>
<?if (array_key_exists($key, $iblockFieldsName)) :?>
<select
style="width: 100px; margin-left: 50px;"
@ -358,7 +356,7 @@ if (!empty($oldValues)) {
<? if ($keyField == $key) :?>
<option value="<?=$field['code'];?>"
<?
<?
if (!$productSelected) {
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
if ($field['code'] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
@ -374,7 +372,7 @@ if (!empty($oldValues)) {
}
}?>
>
<?=$field['name'];?>
</option>
<? endif; ?>
@ -416,7 +414,7 @@ if (!empty($oldValues)) {
</optgroup>
<? endif; ?>
</select>
<?if (array_key_exists($key, $iblockFieldsName)) :?>
<select
style="width: 100px; margin-left: 50px;"
@ -518,7 +516,7 @@ if (!empty($oldValues)) {
function checkAll(obj,cnt)
{
for (i = 0; i < cnt; i++)
{
{
if (obj.checked)
BX.removeClass('IBLOCK_EXPORT_TABLE'+(i+1),"iblock-export-table-display-none");
}
@ -538,10 +536,10 @@ if (!empty($oldValues)) {
},
complete : function() {
for (i = 0; i < cnt; i++)
{
{
if (!obj.checked)
BX.addClass('IBLOCK_EXPORT_TABLE'+(i+1),"iblock-export-table-display-none");
}
}
}
});
easing.animate();
@ -567,7 +565,7 @@ if (!empty($oldValues)) {
},
complete : function() {
if (!obj.checked)
BX.addClass(table,"iblock-export-table-display-none");
BX.addClass(table,"iblock-export-table-display-none");
}
});
easing.animate();
@ -646,7 +644,7 @@ if (!empty($oldValues)) {
if (type == 'product') {
$(td).append('<select name="highloadblock_product' + res.table + '_' + key + '[' + iblock + ']" id="highloadblock" style="width: 100px; margin-left: 50px;">' + new_options + '</select>');
}
},
beforeSend: function() {
$(td).append('<span style="margin-left:50px;" id="waiting"><?=GetMessage("WAIT")?></span>');

View File

@ -1,5 +1,5 @@
<?
$arModuleVersion = array(
"VERSION" => "2.3.10",
"VERSION_DATE" => "2018-09-26 13:30:00"
"VERSION" => "2.3.11",
"VERSION_DATE" => "2018-10-04 16:15:00"
);

View File

@ -28,6 +28,7 @@ $MESS["PROPERTY_WEIGHT_HEADER_NAME"] = "Вес (габариты)";
$MESS["PROPERTY_LENGTH_HEADER_NAME"] = "Длина (габариты)";
$MESS["PROPERTY_WIDTH_HEADER_NAME"] = "Ширина (габариты)";
$MESS["PROPERTY_HEIGHT_HEADER_NAME"] = "Высота (габариты)";
$MESS["PROPERTY_PICTURE_HEADER_NAME"] = "Фото";
$MESS["PROPERTY_SIZE_HEADER_NAME"] = "Размер";
$MESS["SELECT_FIELD_NAME"] = "Поле";
$MESS["SELECT_PROPERTY_NAME"] = "Свойства";

View File

@ -1,4 +1,4 @@
<?php
<?php
IncludeModuleLangFile(__FILE__);
$mid = 'intaro.retailcrm';
$uri = $APPLICATION->GetCurPage() . '?mid=' . htmlspecialchars($mid) . '&lang=' . LANGUAGE_ID;
@ -56,8 +56,8 @@ if($_GET['ok'] && $_GET['ok'] == 'Y') echo CAdminMessage::ShowNote(GetMessage('I
$arResult = array();
if (file_exists($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/intaro.retailcrm/classes/general/config/options.xml')) {
$options = simplexml_load_file($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/intaro.retailcrm/classes/general/config/options.xml');
$options = simplexml_load_file($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/intaro.retailcrm/classes/general/config/options.xml');
foreach($options->contragents->contragent as $contragent) {
$type["NAME"] = $APPLICATION->ConvertCharset((string)$contragent, 'utf-8', SITE_CHARSET);
$type["ID"] = (string)$contragent["id"];
@ -74,8 +74,8 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/intaro.retailcrm/cl
$arResult['orderProps'][] = $type;
} else {
$groups = explode(",", (string)$field["group"]);
foreach ($groups as $group) {
$type["GROUP"][] = trim($group);
foreach ($groups as $group) {
$type["GROUP"][] = trim($group);
}
$arResult['legalDetails'][] = $type;
}
@ -138,7 +138,7 @@ if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_RE
$step = $_POST['step'];
$orders = $_POST['orders'];
$countStep = 50; // 50 orders on step
if ($orders) {
$ordersArr = explode(',', $orders);
$orders = array();
@ -152,37 +152,37 @@ if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_RE
$orders[] = (int)$ordersList[0];
}
}
$splitedOrders = array_chunk($orders, $countStep);
$stepOrders = $splitedOrders[$step];
RetailCrmOrder::uploadOrders($countStep, false, $stepOrders);
$percent = round((($step * $countStep + count($stepOrders)) * 100 / count($orders)), 1);
$step++;
if (!$splitedOrders[$step]) {
$step = 'end';
}
$res = array("step" => $step, "percent" => $percent, 'stepOrders' => $stepOrders);
} else {
$orders = array();
$orders = array();
for($i = 1; $i <= $countStep; $i++){
$orders[] = $i + $step * $countStep;
}
RetailCrmOrder::uploadOrders($countStep, false, $orders);
$step++;
$countLeft = (int) CSaleOrder::GetList(array("ID" => "ASC"), array('>ID' => $step * $countStep), array());
$countAll = (int) CSaleOrder::GetList(array("ID" => "ASC"), array(), array());
$percent = round(100 - ($countLeft * 100 / $countAll), 1);
if ($countLeft == 0) {
$step = 'end';
}
$res = array("step" => $step, "percent" => $percent, 'stepOrders' => $orders);
}
@ -197,7 +197,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$api_key = htmlspecialchars(trim($_POST['api_key']));
//bitrix site list
$siteListArr = array();
$siteListArr = array();
foreach ($arResult['arSites'] as $arSites) {
if (count($arResult['arSites']) > 1) {
if ($_POST['sites-id-' . $arSites['LID']]) {
@ -207,7 +207,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
}
}
}
if ($api_host && $api_key) {
$api = new RetailCrm\ApiClient($api_host, $api_key);
try {
@ -225,15 +225,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
COption::SetOptionString($mid, 'api_host', $api_host);
COption::SetOptionString($mid, 'api_key', $api_key);
}
//form order types ids arr
$orderTypesList = RCrmActions::OrderTypesList($arResult['arSites']);
$orderTypesArr = array();
foreach ($orderTypesList as $orderType) {
$orderTypesArr[$orderType['ID']] = htmlspecialchars(trim($_POST['order-type-' . $orderType['ID']]));
}
//form delivery types ids arr
$arResult['bitrixDeliveryTypesList'] = RCrmActions::DeliveryList();
@ -244,15 +244,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
//form payment types ids arr
$arResult['bitrixPaymentTypesList'] = RCrmActions::PaymentList();
$paymentTypesArr = array();
foreach ($arResult['bitrixPaymentTypesList'] as $payment) {
$paymentTypesArr[$payment['ID']] = htmlspecialchars(trim($_POST['payment-type-' . $payment['ID']]));
}
}
//form payment statuses ids arr
$arResult['bitrixStatusesList'] = RCrmActions::StatusesList();
$paymentStatusesArr = array();
$canselOrderArr = array();
//$paymentStatusesArr['YY'] = htmlspecialchars(trim($_POST['payment-status-YY']));
@ -262,32 +262,28 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$canselOrderArr[] = $status['ID'];
}
}
//form payment ids arr
$paymentArr = array();
$paymentArr['Y'] = htmlspecialchars(trim($_POST['payment-Y']));
$paymentArr['N'] = htmlspecialchars(trim($_POST['payment-N']));
$previousDischarge = COption::GetOptionString($mid, $CRM_ORDER_DISCHARGE, 0);
//order discharge mode
// 0 - agent
// 1 - event
$orderDischarge = 0;
$orderDischarge = (int) htmlspecialchars(trim($_POST['order-discharge']));
$orderDischarge = (int) htmlspecialchars(trim($_POST['order-discharge']));
if (($orderDischarge != $previousDischarge) && ($orderDischarge == 0)) {
// remove depenedencies
UnRegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $mid, "RetailCrmEvent", "orderSave");
UnRegisterModuleDependences("sale", "OnOrderUpdate", $mid, "RetailCrmEvent", "onUpdateOrder");
UnRegisterModuleDependences("sale", "OnSaleOrderDeleted", $mid, "RetailCrmEvent", "orderDelete");
} elseif (($orderDischarge != $previousDischarge) && ($orderDischarge == 1)) {
// event dependencies
RegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $mid, "RetailCrmEvent", "orderSave");
RegisterModuleDependences("sale", "OnOrderUpdate", $mid, "RetailCrmEvent", "onUpdateOrder");
RegisterModuleDependences("sale", "OnSaleOrderDeleted", $mid, "RetailCrmEvent", "orderDelete");
RegisterModuleDependences("sale", "OnSalePaymentEntitySaved", $mid, "RetailCrmEvent", "paymentSave");
RegisterModuleDependences("sale", "OnSalePaymentEntityDeleted", $mid, "RetailCrmEvent", "paymentDelete");
}
$orderPropsArr = array();
@ -307,7 +303,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
}
$orderPropsArr[$orderType['ID']] = $_orderPropsArr;
}
//legal details props
$legalDetailsArr = array();
foreach ($orderTypesList as $orderType) {
@ -354,18 +350,18 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$dateAgent->format('d.m.Y H:i:s'), // date of first start
30
);
$arResult['bitrixStoresExportList'] = RCrmActions::StoresExportList();
foreach($arResult['bitrixStoresExportList'] as $bitrixStores){
$bitrixStoresArr[$bitrixStores['ID']] = htmlspecialchars(trim($_POST['stores-export-' . $bitrixStores['ID']]));
}
function maskInv($var){
return preg_match("/^shops-exoprt/", $var);
}
$bitrixShopsArr = str_replace('shops-exoprt-', '', array_filter(array_keys($_POST), 'maskInv'));
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
foreach($arResult['bitrixIblocksExportList'] as $bitrixIblocks){
if(htmlspecialchars(trim($_POST['iblocks-stores-' . $bitrixIblocks['ID']])) === 'Y'){
$bitrixIblocksInventories[] = $bitrixIblocks['ID'];
@ -374,15 +370,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
} else {
$inventoriesUpload = 'N';
CAgent::RemoveAgent("RetailCrmInventories::inventoriesUpload();", $mid);
}
}
//prices
$bitrixPricesArr = array();
$bitrixIblocksPrices = array();
$bitrixPriceShopsArr = array();
if(htmlspecialchars(trim($_POST['prices-upload'])) == 'Y'){
$pricesUpload = 'Y';
$dateAgent = new DateTime();
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
$dateAgent->add($intAgent);
@ -394,18 +390,18 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$dateAgent->format('d.m.Y H:i:s'), // date of first start
30
);
$arResult['bitrixPricesExportList'] = RCrmActions::PricesExportList();
foreach($arResult['bitrixPricesExportList'] as $bitrixPrices){
$bitrixPricesArr[$bitrixPrices['ID']] = htmlspecialchars(trim($_POST['price-type-export-' . $bitrixPrices['ID']]));
}
function maskPrice($var){
return preg_match("/^shops-price/", $var);
}
$bitrixPriceShopsArr = str_replace('shops-price-', '', array_filter(array_keys($_POST), 'maskPrice'));
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
foreach($arResult['bitrixIblocksExportList'] as $bitrixIblocks){
if(htmlspecialchars(trim($_POST['iblocks-prices-' . $bitrixIblocks['ID']])) === 'Y'){
$bitrixIblocksPrices[] = $bitrixIblocks['ID'];
@ -414,8 +410,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
} else {
$pricesUpload = 'N';
CAgent::RemoveAgent("RetailCrmPrices::pricesUpload();", $mid);
}
}
//demon
$collectorKeys = array();
if (htmlspecialchars(trim($_POST['collector'])) == 'Y') {
@ -428,7 +424,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$collector = 'N';
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmCollector", "add");
}
//UA
$uaKeys = array();
if (htmlspecialchars(trim($_POST['ua-integration'])) == 'Y') {
@ -441,13 +437,13 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
} else {
$ua = 'N';
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmUa", "add");
}
}
//version
$version = COption::GetOptionString($mid, $CRM_API_VERSION);
if (htmlspecialchars(trim($_POST['api_version'])) != $version) {
if (htmlspecialchars(trim($_POST['api_version'])) != $version) {
if (htmlspecialchars(trim($_POST['api_version'])) == 'v4') {
$version = 'v4';
} elseif (htmlspecialchars(trim($_POST['api_version'])) == 'v5') {
@ -460,7 +456,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
//запрос к апи с $version
$crmUrl = htmlspecialchars(trim($_POST['api_host']));
$apiKey = htmlspecialchars(trim($_POST['api_key']));
if ('/' !== $crmUrl[strlen($crmUrl) - 1]) {
$crmUrl .= '/';
}
@ -472,9 +468,9 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
'/reference/payment-statuses',
'GET'
);
if ($result->getStatusCode() == 200) {
COption::SetOptionString($mid, $CRM_API_VERSION, $version);
COption::SetOptionString($mid, $CRM_API_VERSION, $version);
} else {
LocalRedirect($uri);
echo CAdminMessage::ShowMessage(GetMessage('API_NOT_WORK'));
@ -493,26 +489,26 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
COption::SetOptionString($mid, $CRM_PAYMENT_STATUSES, serialize(RCrmActions::clearArr($paymentStatusesArr)));
COption::SetOptionString($mid, $CRM_PAYMENT, serialize(RCrmActions::clearArr($paymentArr)));
COption::SetOptionString($mid, $CRM_ORDER_DISCHARGE, $orderDischarge);
COption::SetOptionString($mid, $CRM_ORDER_PROPS, serialize(RCrmActions::clearArr($orderPropsArr)));
COption::SetOptionString($mid, $CRM_CONTRAGENT_TYPE, serialize(RCrmActions::clearArr($contragentTypeArr)));
COption::SetOptionString($mid, $CRM_ORDER_PROPS, serialize(RCrmActions::clearArr($orderPropsArr)));
COption::SetOptionString($mid, $CRM_CONTRAGENT_TYPE, serialize(RCrmActions::clearArr($contragentTypeArr)));
COption::SetOptionString($mid, $CRM_LEGAL_DETAILS, serialize(RCrmActions::clearArr($legalDetailsArr)));
COption::SetOptionString($mid, $CRM_CUSTOM_FIELDS, serialize(RCrmActions::clearArr($customFieldsArr)));
COption::SetOptionString($mid, $CRM_ORDER_NUMBERS, $orderNumbers);
COption::SetOptionString($mid, $CRM_CANSEL_ORDER, serialize(RCrmActions::clearArr($canselOrderArr)));
COption::SetOptionString($mid, $CRM_INVENTORIES_UPLOAD, $inventoriesUpload);
COption::SetOptionString($mid, $CRM_STORES, serialize(RCrmActions::clearArr($bitrixStoresArr)));
COption::SetOptionString($mid, $CRM_SHOPS, serialize(RCrmActions::clearArr($bitrixShopsArr)));
COption::SetOptionString($mid, $CRM_IBLOCKS_INVENTORIES, serialize(RCrmActions::clearArr($bitrixIblocksInventories)));
COption::SetOptionString($mid, $CRM_PRICES_UPLOAD, $pricesUpload);
COption::SetOptionString($mid, $CRM_PRICES, serialize(RCrmActions::clearArr($bitrixPricesArr)));
COption::SetOptionString($mid, $CRM_PRICE_SHOPS, serialize(RCrmActions::clearArr($bitrixPriceShopsArr)));
COption::SetOptionString($mid, $CRM_IBLOCKS_PRICES, serialize(RCrmActions::clearArr($bitrixIblocksPrices)));
COption::SetOptionString($mid, $CRM_IBLOCKS_PRICES, serialize(RCrmActions::clearArr($bitrixIblocksPrices)));
COption::SetOptionString($mid, $CRM_COLLECTOR, $collector);
COption::SetOptionString($mid, $CRM_COLL_KEY, serialize(RCrmActions::clearArr($collectorKeys)));
COption::SetOptionString($mid, $CRM_UA, $ua);
COption::SetOptionString($mid, $CRM_UA_KEYS, serialize(RCrmActions::clearArr($uaKeys)));
COption::SetOptionString($mid, $CRM_DIMENSIONS, $orderDimensions);
@ -561,29 +557,29 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
//bitrix orderTypesList -- personTypes
$arResult['bitrixOrderTypesList'] = RCrmActions::OrderTypesList($arResult['arSites']);
//bitrix deliveryTypesList
$arResult['bitrixDeliveryTypesList'] = RCrmActions::DeliveryList();
//bitrix paymentTypesList
$arResult['bitrixPaymentTypesList'] = RCrmActions::PaymentList();
//bitrix statusesList
$arResult['bitrixPaymentStatusesList'] = RCrmActions::StatusesList();
//bitrix pyament Y/N
$arResult['bitrixPaymentList'][0]['NAME'] = GetMessage('PAYMENT_Y');
$arResult['bitrixPaymentList'][0]['ID'] = 'Y';
$arResult['bitrixPaymentList'][1]['NAME'] = GetMessage('PAYMENT_N');
$arResult['bitrixPaymentList'][1]['ID'] = 'N';
//bitrix orderPropsList
$arResult['arProp'] = RCrmActions::OrderPropsList();
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
$arResult['bitrixStoresExportList'] = RCrmActions::StoresExportList();
$arResult['bitrixPricesExportList'] = RCrmActions::PricesExportList();
//saved cat params
$optionsOrderTypes = unserialize(COption::GetOptionString($mid, $CRM_ORDER_TYPES_ARR, 0));
$optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0));
@ -592,29 +588,29 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$optionsPayment = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT, 0));
$optionsSitesList = unserialize(COption::GetOptionString($mid, $CRM_SITES_LIST, 0));
$optionsDischarge = COption::GetOptionString($mid, $CRM_ORDER_DISCHARGE, 0);
$optionsOrderProps = unserialize(COption::GetOptionString($mid, $CRM_ORDER_PROPS, 0));
$optionsContragentType = unserialize(COption::GetOptionString($mid, $CRM_CONTRAGENT_TYPE, 0));
$optionsOrderProps = unserialize(COption::GetOptionString($mid, $CRM_ORDER_PROPS, 0));
$optionsContragentType = unserialize(COption::GetOptionString($mid, $CRM_CONTRAGENT_TYPE, 0));
$optionsLegalDetails = unserialize(COption::GetOptionString($mid, $CRM_LEGAL_DETAILS, 0));
$optionsCustomFields = unserialize(COption::GetOptionString($mid, $CRM_CUSTOM_FIELDS, 0));
$optionsOrderNumbers = COption::GetOptionString($mid, $CRM_ORDER_NUMBERS, 0);
$canselOrderArr = unserialize(COption::GetOptionString($mid, $CRM_CANSEL_ORDER, 0));
$optionInventotiesUpload = COption::GetOptionString($mid, $CRM_INVENTORIES_UPLOAD, 0);
$optionStores = unserialize(COption::GetOptionString($mid, $CRM_STORES, 0));
$optionShops = unserialize(COption::GetOptionString($mid, $CRM_SHOPS, 0));
$optionIblocksInventories = unserialize(COption::GetOptionString($mid, $CRM_IBLOCKS_INVENTORIES, 0));
$optionPricesUpload = COption::GetOptionString($mid, $CRM_PRICES_UPLOAD, 0);
$optionPrices = unserialize(COption::GetOptionString($mid, $CRM_PRICES, 0));
$optionPriceShops = unserialize(COption::GetOptionString($mid, $CRM_PRICE_SHOPS, 0));
$optionIblocksPrices = unserialize(COption::GetOptionString($mid, $CRM_IBLOCKS_PRICES, 0));
$optionCollector = COption::GetOptionString($mid, $CRM_COLLECTOR, 0);
$optionCollectorKeys = unserialize(COption::GetOptionString($mid, $CRM_COLL_KEY));
$optionUa = COption::GetOptionString($mid, $CRM_UA, 0);
$optionUaKeys = unserialize(COption::GetOptionString($mid, $CRM_UA_KEYS));
$version = COption::GetOptionString($mid, $CRM_API_VERSION, 0);
//currency
@ -656,11 +652,11 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
?>
<?php $APPLICATION->AddHeadString('<script type="text/javascript" src="/bitrix/js/main/jquery/jquery-1.7.min.js"></script>'); ?>
<script type="text/javascript">
$(document).ready(function() {
$(document).ready(function() {
$('input.addr').change(function(){
splitName = $(this).attr('name').split('-');
orderType = splitName[2];
if(parseInt($(this).val()) === 1)
$('tr.address-detail-' + orderType).show('slow');
else if(parseInt($(this).val()) === 0)
@ -671,7 +667,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
splitName = $(this).attr('name').split('-');
contragentType = $(this).val();
orderType = splitName[2];
$('tr.legal-detail-' + orderType).hide();
$('.legal-detail-title-' + orderType).hide();
@ -682,47 +678,47 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
}
});
});
$('.inventories-batton label').change(function(){
if($(this).find('input').is(':checked') === true){
$('tr.inventories').show('slow');
} else if($(this).find('input').is(':checked') === false){
$('tr.inventories').hide('slow');
}
return true;
});
$('.prices-batton label').change(function(){
if($(this).find('input').is(':checked') === true){
$('tr.prices').show('slow');
} else if($(this).find('input').is(':checked') === false){
$('tr.prices').hide('slow');
}
return true;
});
$('.r-ua-button label').change(function(){
if($(this).find('input').is(':checked') === true){
$('tr.r-ua').show('slow');
} else if($(this).find('input').is(':checked') === false){
$('tr.r-ua').hide('slow');
}
return true;
});
$('.r-coll-button label').change(function(){
if($(this).find('input').is(':checked') === true){
$('tr.r-coll').show('slow');
} else if($(this).find('input').is(':checked') === false){
$('tr.r-coll').hide('slow');
}
return true;
});
});
});
$('input[name="update-delivery-services"]').live('click', function() {
BX.showWait();
@ -775,12 +771,12 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
border-bottom: 15px solid #f5f9f9 !important;
}
.option-head{
text-align: center;
text-align: center;
padding: 10px;
font-size: 14px;
color: #4b6267;
}
</style>
<form method="POST" action="<?php echo $uri; ?>" id="FORMACTION">
<?php
@ -806,7 +802,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<?php echo GetMessage('ICRM_SITES'); ?>
</b>
</td>
</tr>
</tr>
<?php foreach ($arResult['arSites'] as $site): ?>
<tr>
<td width="50%" class="adm-detail-content-cell-l"><?php echo $site['NAME'] . ' (' . $site['LID'] . ')'; ?></td>
@ -979,7 +975,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<?php echo GetMessage('CONTRAGENTS_TYPES_LIST'); ?>
</td>
<td width="50%" class="adm-detail-content-cell-r">
<select name="contragent-type-<?php echo $bitrixOrderType['ID']; ?>" class="typeselect">
<select name="contragent-type-<?php echo $bitrixOrderType['ID']; ?>" class="typeselect">
<?php foreach ($arResult['contragentType'] as $contragentType): ?>
<option value="<?php echo $contragentType["ID"]; ?>" <?php if ($optionsContragentType[$bitrixOrderType['ID']] == $contragentType['ID']) echo 'selected'; ?>>
<?php echo $contragentType["NAME"]; ?>
@ -988,7 +984,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</select>
</td>
</tr>
<?php $countProps = 1; foreach($arResult['orderProps'] as $orderProp): ?>
<?php $countProps = 1; foreach($arResult['orderProps'] as $orderProp): ?>
<?php if($orderProp['ID'] == 'text'): ?>
<tr class="heading">
<td colspan="2" style="background-color: transparent;">
@ -1005,7 +1001,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</td>
<td width="50%" class="adm-detail-content-cell-r">
<select name="order-prop-<?php echo $orderProp['ID'] . '-' . $bitrixOrderType['ID']; ?>" class="typeselect">
<option value=""></option>
<option value=""></option>
<?php foreach ($arResult['arProp'][$bitrixOrderType['ID']] as $arProp): ?>
<option value="<?php echo $arProp['CODE']; ?>" <?php if ($optionsOrderProps[$bitrixOrderType['ID']][$orderProp['ID']] == $arProp['CODE']) echo 'selected'; ?>>
<?php echo $arProp['NAME']; ?>
@ -1063,15 +1059,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<?php endforeach; ?>
</select>
</td>
</tr>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
<?php $tabControl->BeginNextTab(); ?>
<input type="hidden" name="tab" value="catalog">
<tr class="heading">
<td colspan="2" class="option-other-bottom"><b><?php echo GetMessage('ORDERS_OPTIONS'); ?></b></td>
</tr>
</tr>
<tr>
<td colspan="2" class="option-head option-other-top option-other-bottom">
<b>
@ -1095,14 +1091,14 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<label><input class="addr" type="radio" name="order-discharge" value="0" <?php if($optionsDischarge == 0) echo "checked"; ?>><?php echo GetMessage('DISCHARGE_AGENT'); ?></label>
</b>
</td>
</tr>
</tr>
<tr class="heading">
<td colspan="2" class="option-other-heading"><b><?php echo GetMessage('CRM_API_VERSION'); ?></b></td>
</tr>
<tr>
<td colspan="2" class="option-head option-other-top option-other-bottom">
<select name="api_version" class="typeselect">
<?php for($v = 4; $v <= 5; $v++) {
<?php for($v = 4; $v <= 5; $v++) {
$ver = 'v' . $v; ?>
<option value="<?php echo $ver; ?>" <?php if ($ver == $version) echo 'selected'; ?>>
API V<?php echo $v; ?>
@ -1113,10 +1109,10 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</tr>
<tr class="heading">
<td colspan="2" class="option-other-heading"><b><?php echo GetMessage('CURRENCY'); ?></b></td>
</tr>
</tr>
<tr>
<td colspan="2" class="option-head option-other-top option-other-bottom">
<select name="currency" class="typeselect">
<select name="currency" class="typeselect">
<?php foreach ($currencyList as $currencyCode => $currencyName) : ?>
<option value="<?php echo $currencyCode; ?>" <?php if ($currencyCode == $currencyOption) echo 'selected'; ?>>
<?php echo $currencyName; ?>
@ -1132,12 +1128,12 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<label><input class="addr" type="checkbox" name="inventories-upload" value="Y" <?php if($optionInventotiesUpload === 'Y') echo "checked"; ?>><?php echo GetMessage('INVENTORIES_UPLOAD'); ?></label>
</b>
</td>
</tr>
</tr>
<tr class="inventories" <?php if($optionInventotiesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td colspan="2" class="option-head option-other-top option-other-bottom">
<b><label><?php echo GetMessage('INVENTORIES'); ?></label></b>
</td>
</tr>
</tr>
<?php foreach ($arResult['bitrixStoresExportList'] as $catalogExportStore): ?>
<tr class="inventories" <?php if($optionInventotiesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td width="50%" class="adm-detail-content-cell-l"><?php echo $catalogExportStore['TITLE'] ?></td>
@ -1157,28 +1153,28 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<label><?php echo GetMessage('SHOPS_INVENTORIES_UPLOAD'); ?></label>
</b>
</td>
</tr>
</tr>
<?php foreach ($arResult['sitesList'] as $sitesList): ?>
<tr class="inventories" align="center" <?php if($optionInventotiesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td colspan="2" class="option-other-center">
<label><input class="addr" type="checkbox" name="shops-exoprt-<?echo $sitesList['code'];?>" value="Y" <?php if(in_array($sitesList['code'], $optionShops)) echo "checked"; ?>> <?php echo $sitesList['name'].' ('.$sitesList['code'].')'; ?></label>
</td>
</tr>
<?php endforeach;?>
</tr>
<?php endforeach;?>
<tr class="inventories" <?php if($optionInventotiesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td colspan="2" class="option-head option-other-top option-other-bottom">
<b>
<label><?php echo GetMessage('IBLOCKS_UPLOAD'); ?></label>
</b>
</td>
</tr>
</tr>
<?php foreach ($arResult['bitrixIblocksExportList'] as $catalogExportIblock) :?>
<tr class="inventories" align="center" <?php if($optionInventotiesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td colspan="2" class="option-other-center">
<label><input class="addr" type="checkbox" name="iblocks-stores-<?echo $catalogExportIblock['ID'];?>" value="Y" <?php if(in_array($catalogExportIblock['ID'], $optionIblocksInventories)) echo "checked"; ?>> <?php echo '['. $catalogExportIblock['CODE']. '] ' . $catalogExportIblock['NAME'] . ' (' . $catalogExportIblock['LID'] . ')'; ?></label>
</td>
</tr>
<?php endforeach;?>
</tr>
<?php endforeach;?>
<?php endif;?>
<?php if ($optionPricesUpload === 'Y' || count($arResult['bitrixPricesExportList']) > 0) :?>
<tr class="heading prices-batton">
@ -1187,15 +1183,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<label><input class="addr" type="checkbox" name="prices-upload" value="Y" <?php if($optionPricesUpload === 'Y') echo "checked"; ?>><?php echo GetMessage('PRICES_UPLOAD'); ?></label>
</b>
</td>
</tr>
</tr>
<tr class="prices" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td colspan="2" class="option-head option-other-top option-other-bottom">
<b>
<label><?php echo GetMessage('PRICE_TYPES'); ?></label>
</b>
</td>
</tr>
<?php foreach ($arResult['bitrixPricesExportList'] as $catalogExportPrice) :?>
</tr>
<?php foreach ($arResult['bitrixPricesExportList'] as $catalogExportPrice) :?>
<tr class="prices" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td width="50%" class="adm-detail-content-cell-l"><?php echo $catalogExportPrice['NAME_LANG'] . ' (' . $catalogExportPrice['NAME'] . ')'; ?></td>
<td width="50%" class="adm-detail-content-cell-r">
@ -1214,13 +1210,13 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<label><?php echo GetMessage('SHOPS_PRICES_UPLOAD'); ?></label>
</b>
</td>
</tr>
</tr>
<?php foreach ($arResult['sitesList'] as $sitesList): ?>
<tr class="prices" align="center" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td colspan="2" class="option-other-center">
<label><input class="addr" type="checkbox" name="shops-price-<?echo $sitesList['code'];?>" value="Y" <?php if(in_array($sitesList['code'], $optionPriceShops)) echo "checked"; ?>> <?php echo $sitesList['name'].' ('.$sitesList['code'].')'; ?></label>
</td>
</tr>
</tr>
<?php endforeach;?>
<tr class="prices" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td colspan="2" class="option-head option-other-top option-other-bottom">
@ -1228,28 +1224,28 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<label><?php echo GetMessage('IBLOCKS_UPLOAD'); ?></label>
</b>
</td>
</tr>
</tr>
<?php foreach ($arResult['bitrixIblocksExportList'] as $catalogExportIblock) :?>
<tr class="prices" align="center" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td colspan="2" class="option-other-center">
<label><input class="addr" type="checkbox" name="iblocks-prices-<?echo $catalogExportIblock['ID'];?>" value="Y" <?php if(in_array($catalogExportIblock['ID'], $optionIblocksPrices)) echo "checked"; ?>> <?php echo '['. $catalogExportIblock['CODE']. '] ' . $catalogExportIblock['NAME'] . ' (' . $catalogExportIblock['LID'] . ')'; ?></label>
</td>
</tr>
<?php endforeach;?>
</tr>
<?php endforeach;?>
<?php endif;?>
<tr class="heading r-coll-button">
<td colspan="2" class="option-other-heading">
<b>
<label><input class="addr" type="checkbox" name="collector" value="Y" <?php if($optionCollector === 'Y') echo "checked"; ?>><?php echo GetMessage('DEMON_COLLECTOR'); ?></label>
</b>
</td>
</tr>
</tr>
<tr class="r-coll" <?php if($optionCollector !== 'Y') echo 'style="display: none;"'; ?>>
<td class="option-head" colspan="2">
<b><?php echo GetMessage('ICRM_SITES'); ?></b>
</td>
</tr>
</tr>
<?php foreach ($arResult['arSites'] as $sitesList): ?>
<tr class="r-coll" <?php if($optionCollector !== 'Y') echo 'style="display: none;"'; ?>>
<td class="adm-detail-content-cell-l" width="50%"><?php echo GetMessage('DEMON_KEY'); ?> <?php echo $sitesList['NAME']; ?> (<?php echo $sitesList['LID']; ?>)</td>
@ -1264,13 +1260,13 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<label><input class="addr" type="checkbox" name="ua-integration" value="Y" <?php if($optionUa === 'Y') echo "checked"; ?>><?php echo GetMessage('UNIVERSAL_ANALYTICS'); ?></label>
</b>
</td>
</tr>
</tr>
<?php foreach ($arResult['arSites'] as $sitesList): ?>
<tr class="r-ua" <?php if($optionUa !== 'Y') echo 'style="display: none;"'; ?>>
<td class="option-head" colspan="2">
<b><?php echo $sitesList['NAME']; ?> (<?php echo $sitesList['LID']; ?>)</b>
</td>
</tr>
</tr>
<tr class="r-ua" <?php if($optionUa !== 'Y') echo 'style="display: none;"'; ?>>
<td class="adm-detail-content-cell-l" width="50%"><?php echo GetMessage('ID_UA'); ?></td>
<td class="adm-detail-content-cell-r" width="50%">
@ -1289,7 +1285,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<input type="hidden" name="Update" value="Y" />
<input type="submit" title="<?php echo GetMessage('ICRM_OPTIONS_SUBMIT_TITLE'); ?>" value="<?php echo GetMessage('ICRM_OPTIONS_SUBMIT_VALUE'); ?>" name="btn-update" class="adm-btn-save" />
<?php $tabControl->End(); ?>
</form>
</form>
<?php } ?>
<?php //order upload?>
@ -1354,21 +1350,21 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
left: -2px;
top: -2px;
}
.order-upload-button{
padding: 1px 13px 2px;
height:28px;
}
.order-upload-button div{
float:right;
position:relative;
float:right;
position:relative;
visible: none;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$(document).ready(function() {
$('#percent').width($('.instal-progress-bar-outer').width());
$(window).resize(function(){ // strechin progress bar
@ -1396,7 +1392,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
BX.closeWait();
}
else{
orderUpload();
orderUpload();
}
$('#indicator').css('width', response.percent + '%');
$('#percent').html(response.percent + '%');
@ -1412,7 +1408,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
});
}
$('input[name="start"]').live('click', function() {
$('input[name="start"]').live('click', function() {
BX.showWait();
$('#indicator').css('width', 0);
$('#percent2').html('0%');