2018-10-04 16:28:14 +03:00
|
|
|
|
<?php
|
2013-07-05 18:19:42 +04:00
|
|
|
|
IncludeModuleLangFile(__FILE__);
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$mid = 'intaro.retailcrm';
|
2013-07-05 18:19:42 +04:00
|
|
|
|
$uri = $APPLICATION->GetCurPage() . '?mid=' . htmlspecialchars($mid) . '&lang=' . LANGUAGE_ID;
|
|
|
|
|
|
2013-07-08 15:08:14 +04:00
|
|
|
|
$CRM_API_HOST_OPTION = 'api_host';
|
|
|
|
|
$CRM_API_KEY_OPTION = 'api_key';
|
|
|
|
|
$CRM_ORDER_TYPES_ARR = 'order_types_arr';
|
|
|
|
|
$CRM_DELIVERY_TYPES_ARR = 'deliv_types_arr';
|
2014-01-23 17:50:58 +04:00
|
|
|
|
$CRM_DELIVERY_SERVICES_ARR = 'deliv_services_arr';
|
2013-07-08 15:08:14 +04:00
|
|
|
|
$CRM_PAYMENT_TYPES = 'pay_types_arr';
|
|
|
|
|
$CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
|
|
|
|
|
$CRM_PAYMENT = 'payment_arr'; //order payment Y/N
|
2013-07-09 19:03:56 +04:00
|
|
|
|
$CRM_ORDER_LAST_ID = 'order_last_id';
|
2013-09-02 15:48:12 +04:00
|
|
|
|
$CRM_ORDER_SITES = 'sites_ids';
|
2013-09-10 17:15:41 +04:00
|
|
|
|
$CRM_ORDER_DISCHARGE = 'order_discharge';
|
2013-09-03 18:00:12 +04:00
|
|
|
|
$CRM_ORDER_PROPS = 'order_props';
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$CRM_LEGAL_DETAILS = 'legal_details';
|
|
|
|
|
$CRM_CUSTOM_FIELDS = 'custom_fields';
|
|
|
|
|
$CRM_CONTRAGENT_TYPE = 'contragent_type';
|
|
|
|
|
$CRM_SITES_LIST= 'sites_list';
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$CRM_ORDER_NUMBERS = 'order_numbers';
|
|
|
|
|
$CRM_CANSEL_ORDER = 'cansel_order';
|
2013-07-08 15:08:14 +04:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$CRM_INVENTORIES_UPLOAD = 'inventories_upload';
|
|
|
|
|
$CRM_STORES = 'stores';
|
|
|
|
|
$CRM_SHOPS = 'shops';
|
|
|
|
|
$CRM_IBLOCKS_INVENTORIES = 'iblocks_inventories';
|
|
|
|
|
|
|
|
|
|
$CRM_PRICES_UPLOAD = 'prices_upload';
|
|
|
|
|
$CRM_PRICES = 'prices';
|
|
|
|
|
$CRM_PRICE_SHOPS = 'price_shops';
|
|
|
|
|
$CRM_IBLOCKS_PRICES = 'iblock_prices';
|
|
|
|
|
|
|
|
|
|
$CRM_COLLECTOR = 'collector';
|
|
|
|
|
$CRM_COLL_KEY = 'coll_key';
|
|
|
|
|
|
|
|
|
|
$CRM_UA = 'ua';
|
|
|
|
|
$CRM_UA_KEYS = 'ua_keys';
|
|
|
|
|
|
2020-04-24 13:18:18 +03:00
|
|
|
|
$CRM_DISCOUNT_ROUND = 'discount_round';
|
|
|
|
|
|
|
|
|
|
$CRM_CC = 'cc';
|
|
|
|
|
$CRM_CORP_SHOPS = 'shops-corporate';
|
|
|
|
|
$CRM_CORP_NAME = 'nickName-corporate';
|
|
|
|
|
$CRM_CORP_ADRES = 'adres-corporate';
|
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$CRM_API_VERSION = 'api_version';
|
|
|
|
|
|
2017-12-04 17:44:30 +03:00
|
|
|
|
$CRM_CURRENCY = 'currency';
|
|
|
|
|
$CRM_ADDRESS_OPTIONS = 'address_options';
|
2018-05-23 12:19:59 +03:00
|
|
|
|
$CRM_DIMENSIONS = 'order_dimensions';
|
2018-11-02 16:51:13 +03:00
|
|
|
|
$PROTOCOL = 'protocol';
|
2017-12-04 17:44:30 +03:00
|
|
|
|
|
2020-04-08 17:27:05 +03:00
|
|
|
|
$CRM_PURCHASE_PRICE_NULL = 'purchasePrice_null';
|
2020-02-18 10:54:42 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
if(!CModule::IncludeModule('intaro.retailcrm') || !CModule::IncludeModule('sale') || !CModule::IncludeModule('iblock') || !CModule::IncludeModule('catalog'))
|
2013-07-24 14:44:48 +04:00
|
|
|
|
return;
|
2013-07-05 18:19:42 +04:00
|
|
|
|
|
|
|
|
|
$_GET['errc'] = htmlspecialchars(trim($_GET['errc']));
|
|
|
|
|
$_GET['ok'] = htmlspecialchars(trim($_GET['ok']));
|
|
|
|
|
|
|
|
|
|
if($_GET['errc']) echo CAdminMessage::ShowMessage(GetMessage($_GET['errc']));
|
|
|
|
|
if($_GET['ok'] && $_GET['ok'] == 'Y') echo CAdminMessage::ShowNote(GetMessage('ICRM_OPTIONS_OK'));
|
|
|
|
|
|
|
|
|
|
$arResult = array();
|
|
|
|
|
|
2016-09-15 16:42:10 +03:00
|
|
|
|
if (file_exists($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/intaro.retailcrm/classes/general/config/options.xml')) {
|
2018-10-04 16:28:14 +03:00
|
|
|
|
$options = simplexml_load_file($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/intaro.retailcrm/classes/general/config/options.xml');
|
|
|
|
|
|
2016-10-04 17:57:39 +03:00
|
|
|
|
foreach($options->contragents->contragent as $contragent) {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$type["NAME"] = $APPLICATION->ConvertCharset((string)$contragent, 'utf-8', SITE_CHARSET);
|
|
|
|
|
$type["ID"] = (string)$contragent["id"];
|
|
|
|
|
$arResult['contragentType'][] = $type;
|
|
|
|
|
unset ($type);
|
|
|
|
|
}
|
2016-10-04 17:57:39 +03:00
|
|
|
|
foreach($options->fields->field as $field) {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$type["NAME"] = $APPLICATION->ConvertCharset((string)$field, 'utf-8', SITE_CHARSET);
|
|
|
|
|
$type["ID"] = (string)$field["id"];
|
|
|
|
|
|
|
|
|
|
if ($field["group"] == 'custom') {
|
|
|
|
|
$arResult['customFields'][] = $type;
|
2016-10-04 17:57:39 +03:00
|
|
|
|
} elseif (!$field["group"]) {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$arResult['orderProps'][] = $type;
|
2016-10-04 17:57:39 +03:00
|
|
|
|
} else {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$groups = explode(",", (string)$field["group"]);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
foreach ($groups as $group) {
|
|
|
|
|
$type["GROUP"][] = trim($group);
|
2015-03-03 16:37:34 +03:00
|
|
|
|
}
|
|
|
|
|
$arResult['legalDetails'][] = $type;
|
|
|
|
|
}
|
|
|
|
|
unset($type);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-07-05 18:19:42 +04:00
|
|
|
|
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$arResult['arSites'] = RCrmActions::SitesList();
|
2014-01-29 18:42:52 +04:00
|
|
|
|
//ajax update deliveryServices
|
|
|
|
|
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') && isset($_POST['ajax']) && ($_POST['ajax'] == 1)) {
|
|
|
|
|
$api_host = COption::GetOptionString($mid, $CRM_API_HOST_OPTION, 0);
|
|
|
|
|
$api_key = COption::GetOptionString($mid, $CRM_API_KEY_OPTION, 0);
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$api = new RetailCrm\ApiClient($api_host, $api_key);
|
2014-01-29 18:42:52 +04:00
|
|
|
|
|
2014-03-22 14:52:17 +04:00
|
|
|
|
try {
|
|
|
|
|
$api->paymentStatusesList();
|
2015-03-03 16:37:34 +03:00
|
|
|
|
} catch (\RetailCrm\Exception\CurlException $e) {
|
2016-09-15 16:42:10 +03:00
|
|
|
|
RCrmActions::eventLog(
|
|
|
|
|
'intaro.retailcrm/options.php', 'RetailCrm\ApiClient::paymentStatusesList::CurlException',
|
2014-03-22 14:52:17 +04:00
|
|
|
|
$e->getCode() . ': ' . $e->getMessage()
|
|
|
|
|
);
|
2014-01-30 12:17:58 +04:00
|
|
|
|
|
2014-01-29 18:42:52 +04:00
|
|
|
|
$APPLICATION->RestartBuffer();
|
|
|
|
|
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
|
2014-03-22 14:52:17 +04:00
|
|
|
|
die(json_encode(array('success' => false, 'errMsg' => $e->getCode())));
|
2014-01-29 18:42:52 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0));
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$arDeliveryServiceAll = \Bitrix\Sale\Delivery\Services\Manager::getActiveList();
|
|
|
|
|
|
2016-10-04 17:57:39 +03:00
|
|
|
|
foreach ($optionsDelivTypes as $key => $deliveryType) {
|
|
|
|
|
foreach ($arDeliveryServiceAll as $deliveryService) {
|
|
|
|
|
if ($deliveryService['PARENT_ID'] != 0 && $deliveryService['PARENT_ID'] == $key) {
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$srv = explode(':', $deliveryService['CODE']);
|
2016-10-04 17:57:39 +03:00
|
|
|
|
if (count($srv) == 2) {
|
2016-09-15 16:42:10 +03:00
|
|
|
|
try {
|
|
|
|
|
$api->deliveryServicesEdit(RCrmActions::clearArr(array(
|
|
|
|
|
'code' => $srv[1],
|
|
|
|
|
'name' => RCrmActions::toJSON($deliveryService['NAME']),
|
|
|
|
|
'deliveryType' => $deliveryType
|
|
|
|
|
)));
|
|
|
|
|
} catch (\RetailCrm\Exception\CurlException $e) {
|
|
|
|
|
RCrmActions::eventLog(
|
|
|
|
|
'intaro.retailcrm/options.php', 'RetailCrm\ApiClient::deliveryServiceEdit::CurlException',
|
|
|
|
|
$e->getCode() . ': ' . $e->getMessage()
|
|
|
|
|
);
|
|
|
|
|
}
|
2014-01-29 18:42:52 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-09-15 16:42:10 +03:00
|
|
|
|
}
|
2014-01-29 18:42:52 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$APPLICATION->RestartBuffer();
|
|
|
|
|
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
|
|
|
|
|
die(json_encode(array('success' => true)));
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-03 16:37:34 +03:00
|
|
|
|
//upload orders after install module
|
2016-10-04 17:57:39 +03:00
|
|
|
|
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') && isset($_POST['ajax']) && $_POST['ajax'] == 2) {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$step = $_POST['step'];
|
|
|
|
|
$orders = $_POST['orders'];
|
|
|
|
|
$countStep = 50; // 50 orders on step
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2016-10-04 17:57:39 +03:00
|
|
|
|
if ($orders) {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$ordersArr = explode(',', $orders);
|
|
|
|
|
$orders = array();
|
2016-10-04 17:57:39 +03:00
|
|
|
|
foreach ($ordersArr as $_ordersArr) {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$ordersList = explode('-', trim($_ordersArr));
|
2016-10-04 17:57:39 +03:00
|
|
|
|
if (count($ordersList) > 1) {
|
|
|
|
|
for ($i = (int)trim($ordersList[0]); $i <= (int)trim($ordersList[count($ordersList) - 1]); $i++) {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$orders[] = $i;
|
|
|
|
|
}
|
|
|
|
|
} else{
|
|
|
|
|
$orders[] = (int)$ordersList[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$splitedOrders = array_chunk($orders, $countStep);
|
|
|
|
|
$stepOrders = $splitedOrders[$step];
|
|
|
|
|
|
2016-09-15 16:42:10 +03:00
|
|
|
|
RetailCrmOrder::uploadOrders($countStep, false, $stepOrders);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$percent = round((($step * $countStep + count($stepOrders)) * 100 / count($orders)), 1);
|
|
|
|
|
$step++;
|
|
|
|
|
|
2016-10-04 17:57:39 +03:00
|
|
|
|
if (!$splitedOrders[$step]) {
|
|
|
|
|
$step = 'end';
|
2015-03-03 16:37:34 +03:00
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$res = array("step" => $step, "percent" => $percent, 'stepOrders' => $stepOrders);
|
2016-10-04 17:57:39 +03:00
|
|
|
|
} else {
|
2018-10-04 16:28:14 +03:00
|
|
|
|
$orders = array();
|
2015-03-03 16:37:34 +03:00
|
|
|
|
for($i = 1; $i <= $countStep; $i++){
|
|
|
|
|
$orders[] = $i + $step * $countStep;
|
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2016-09-15 16:42:10 +03:00
|
|
|
|
RetailCrmOrder::uploadOrders($countStep, false, $orders);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$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);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2016-10-04 17:57:39 +03:00
|
|
|
|
if ($countLeft == 0) {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$step = 'end';
|
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$res = array("step" => $step, "percent" => $percent, 'stepOrders' => $orders);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$APPLICATION->RestartBuffer();
|
|
|
|
|
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
|
|
|
|
|
die(json_encode($res));
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-05 18:19:42 +04:00
|
|
|
|
//update connection settings
|
2013-07-24 14:44:48 +04:00
|
|
|
|
if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
2013-07-05 18:19:42 +04:00
|
|
|
|
$api_host = htmlspecialchars(trim($_POST['api_host']));
|
|
|
|
|
$api_key = htmlspecialchars(trim($_POST['api_key']));
|
2015-03-03 16:37:34 +03:00
|
|
|
|
|
|
|
|
|
//bitrix site list
|
2018-10-04 16:28:14 +03:00
|
|
|
|
$siteListArr = array();
|
2015-03-03 16:37:34 +03:00
|
|
|
|
foreach ($arResult['arSites'] as $arSites) {
|
2017-10-26 16:30:50 +03:00
|
|
|
|
if (count($arResult['arSites']) > 1) {
|
|
|
|
|
if ($_POST['sites-id-' . $arSites['LID']]) {
|
|
|
|
|
$siteListArr[$arSites['LID']] = htmlspecialchars(trim($_POST['sites-id-' . $arSites['LID']]));
|
|
|
|
|
} else {
|
|
|
|
|
$siteListArr[$arSites['LID']] = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-03 16:37:34 +03:00
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2016-10-04 17:57:39 +03:00
|
|
|
|
if ($api_host && $api_key) {
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$api = new RetailCrm\ApiClient($api_host, $api_key);
|
2014-03-22 14:52:17 +04:00
|
|
|
|
try {
|
|
|
|
|
$api->paymentStatusesList();
|
2015-03-03 16:37:34 +03:00
|
|
|
|
} catch (\RetailCrm\Exception\CurlException $e) {
|
2016-09-15 16:42:10 +03:00
|
|
|
|
RCrmActions::eventLog(
|
|
|
|
|
'intaro.retailcrm/options.php', 'RetailCrm\ApiClient::paymentStatusesList::CurlException',
|
2014-03-22 14:52:17 +04:00
|
|
|
|
$e->getCode() . ': ' . $e->getMessage()
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$uri .= '&errc=ERR_' . $e->getCode();
|
|
|
|
|
LocalRedirect($uri);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
COption::SetOptionString($mid, 'api_host', $api_host);
|
|
|
|
|
COption::SetOptionString($mid, 'api_key', $api_key);
|
2013-07-05 18:19:42 +04:00
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2013-07-05 21:15:23 +04:00
|
|
|
|
//form order types ids arr
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$orderTypesList = RCrmActions::OrderTypesList($arResult['arSites']);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2013-07-08 15:08:14 +04:00
|
|
|
|
$orderTypesArr = array();
|
2016-10-04 17:57:39 +03:00
|
|
|
|
foreach ($orderTypesList as $orderType) {
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$orderTypesArr[$orderType['ID']] = htmlspecialchars(trim($_POST['order-type-' . $orderType['ID']]));
|
2013-07-05 21:15:23 +04:00
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2013-07-08 15:08:14 +04:00
|
|
|
|
//form delivery types ids arr
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$arResult['bitrixDeliveryTypesList'] = RCrmActions::DeliveryList();
|
2014-01-23 17:50:58 +04:00
|
|
|
|
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$deliveryTypesArr = array();
|
2016-10-04 17:57:39 +03:00
|
|
|
|
foreach ($arResult['bitrixDeliveryTypesList'] as $delivery) {
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$deliveryTypesArr[$delivery['ID']] = htmlspecialchars(trim($_POST['delivery-type-' . $delivery['ID']]));
|
2014-01-23 17:50:58 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-08 15:08:14 +04:00
|
|
|
|
//form payment types ids arr
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$arResult['bitrixPaymentTypesList'] = RCrmActions::PaymentList();
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$paymentTypesArr = array();
|
2016-10-04 17:57:39 +03:00
|
|
|
|
foreach ($arResult['bitrixPaymentTypesList'] as $payment) {
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$paymentTypesArr[$payment['ID']] = htmlspecialchars(trim($_POST['payment-type-' . $payment['ID']]));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-08 15:08:14 +04:00
|
|
|
|
//form payment statuses ids arr
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$arResult['bitrixStatusesList'] = RCrmActions::StatusesList();
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$paymentStatusesArr = array();
|
|
|
|
|
$canselOrderArr = array();
|
|
|
|
|
//$paymentStatusesArr['YY'] = htmlspecialchars(trim($_POST['payment-status-YY']));
|
2016-10-04 17:57:39 +03:00
|
|
|
|
foreach ($arResult['bitrixStatusesList'] as $status) {
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$paymentStatusesArr[$status['ID']] = htmlspecialchars(trim($_POST['payment-status-' . $status['ID']]));
|
2016-10-04 17:57:39 +03:00
|
|
|
|
if (trim($_POST['order-cansel-' . $status['ID']]) == 'Y') {
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$canselOrderArr[] = $status['ID'];
|
|
|
|
|
}
|
2013-07-08 15:08:14 +04:00
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2013-07-08 15:08:14 +04:00
|
|
|
|
//form payment ids arr
|
|
|
|
|
$paymentArr = array();
|
|
|
|
|
$paymentArr['Y'] = htmlspecialchars(trim($_POST['payment-Y']));
|
|
|
|
|
$paymentArr['N'] = htmlspecialchars(trim($_POST['payment-N']));
|
2013-09-12 17:16:54 +04:00
|
|
|
|
|
2013-09-10 17:15:41 +04:00
|
|
|
|
$previousDischarge = COption::GetOptionString($mid, $CRM_ORDER_DISCHARGE, 0);
|
|
|
|
|
//order discharge mode
|
|
|
|
|
// 0 - agent
|
|
|
|
|
// 1 - event
|
|
|
|
|
$orderDischarge = 0;
|
2018-10-04 16:28:14 +03:00
|
|
|
|
$orderDischarge = (int) htmlspecialchars(trim($_POST['order-discharge']));
|
2013-09-10 17:15:41 +04:00
|
|
|
|
if (($orderDischarge != $previousDischarge) && ($orderDischarge == 0)) {
|
|
|
|
|
// remove depenedencies
|
2018-10-31 16:25:53 +03:00
|
|
|
|
UnRegisterModuleDependences("sale", \Bitrix\sale\EventActions::EVENT_ON_ORDER_SAVED, $mid, "RetailCrmEvent", "orderSave");
|
2016-10-31 17:56:11 +03:00
|
|
|
|
UnRegisterModuleDependences("sale", "OnOrderUpdate", $mid, "RetailCrmEvent", "onUpdateOrder");
|
2018-05-23 12:19:59 +03:00
|
|
|
|
UnRegisterModuleDependences("sale", "OnSaleOrderDeleted", $mid, "RetailCrmEvent", "orderDelete");
|
2016-10-04 17:57:39 +03:00
|
|
|
|
} elseif (($orderDischarge != $previousDischarge) && ($orderDischarge == 1)) {
|
2013-09-10 17:15:41 +04:00
|
|
|
|
// event dependencies
|
2018-10-31 16:25:53 +03:00
|
|
|
|
RegisterModuleDependences("sale", \Bitrix\sale\EventActions::EVENT_ON_ORDER_SAVED, $mid, "RetailCrmEvent", "orderSave");
|
2016-10-31 17:56:11 +03:00
|
|
|
|
RegisterModuleDependences("sale", "OnOrderUpdate", $mid, "RetailCrmEvent", "onUpdateOrder");
|
2018-05-23 12:19:59 +03:00
|
|
|
|
RegisterModuleDependences("sale", "OnSaleOrderDeleted", $mid, "RetailCrmEvent", "orderDelete");
|
2013-09-17 15:17:39 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$orderPropsArr = array();
|
|
|
|
|
foreach ($orderTypesList as $orderType) {
|
|
|
|
|
$propsCount = 0;
|
|
|
|
|
$_orderPropsArr = array();
|
|
|
|
|
foreach ($arResult['orderProps'] as $orderProp) {
|
2017-12-04 17:44:30 +03:00
|
|
|
|
if (isset($_POST['address-detail-' . $orderType['ID']])) {
|
|
|
|
|
$addressDatailOptions[$orderType['ID']] = $_POST['address-detail-' . $orderType['ID']];
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-04 17:57:39 +03:00
|
|
|
|
if ((!(int) htmlspecialchars(trim($_POST['address-detail-' . $orderType['ID']]))) && $propsCount > 4) {
|
2013-09-17 15:17:39 +04:00
|
|
|
|
break;
|
2015-03-03 16:37:34 +03:00
|
|
|
|
}
|
2013-09-17 15:17:39 +04:00
|
|
|
|
$_orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID'] . '-' . $orderType['ID']]));
|
|
|
|
|
$propsCount++;
|
2013-09-05 13:38:58 +04:00
|
|
|
|
}
|
2013-09-17 15:17:39 +04:00
|
|
|
|
$orderPropsArr[$orderType['ID']] = $_orderPropsArr;
|
2013-09-10 17:15:41 +04:00
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2015-03-03 16:37:34 +03:00
|
|
|
|
//legal details props
|
|
|
|
|
$legalDetailsArr = array();
|
|
|
|
|
foreach ($orderTypesList as $orderType) {
|
|
|
|
|
$_legalDetailsArr = array();
|
|
|
|
|
foreach ($arResult['legalDetails'] as $legalDetails) {
|
|
|
|
|
$_legalDetailsArr[$legalDetails['ID']] = htmlspecialchars(trim($_POST['legal-detail-' . $legalDetails['ID'] . '-' . $orderType['ID']]));
|
|
|
|
|
}
|
|
|
|
|
$legalDetailsArr[$orderType['ID']] = $_legalDetailsArr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$customFieldsArr = array();
|
|
|
|
|
foreach ($orderTypesList as $orderType) {
|
|
|
|
|
$_customFieldsArr = array();
|
|
|
|
|
foreach ($arResult['customFields'] as $custom) {
|
|
|
|
|
$_customFieldsArr[$custom['ID']] = htmlspecialchars(trim($_POST['custom-fields-' . $custom['ID'] . '-' . $orderType['ID']]));
|
|
|
|
|
}
|
|
|
|
|
$customFieldsArr[$orderType['ID']] = $_customFieldsArr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//contragents type list
|
|
|
|
|
$contragentTypeArr = array();
|
|
|
|
|
foreach ($orderTypesList as $orderType) {
|
|
|
|
|
$contragentTypeArr[$orderType['ID']] = htmlspecialchars(trim($_POST['contragent-type-' . $orderType['ID']]));
|
|
|
|
|
}
|
2016-09-15 16:42:10 +03:00
|
|
|
|
//order numbers
|
|
|
|
|
$orderNumbers = htmlspecialchars(trim($_POST['order-numbers'])) ? htmlspecialchars(trim($_POST['order-numbers'])) : 'N';
|
2018-05-23 12:19:59 +03:00
|
|
|
|
|
|
|
|
|
$orderDimensions = htmlspecialchars(trim($_POST[$CRM_DIMENSIONS])) ? htmlspecialchars(trim($_POST[$CRM_DIMENSIONS])) : 'N';
|
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
//stores
|
|
|
|
|
$bitrixStoresArr = array();
|
|
|
|
|
$bitrixShopsArr = array();
|
|
|
|
|
$bitrixIblocksInventories = array();
|
|
|
|
|
if(htmlspecialchars(trim($_POST['inventories-upload'])) == 'Y'){
|
|
|
|
|
$inventoriesUpload = 'Y';
|
|
|
|
|
$dateAgent = new DateTime();
|
|
|
|
|
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
|
|
|
|
|
$dateAgent->add($intAgent);
|
|
|
|
|
|
|
|
|
|
CAgent::AddAgent(
|
2020-05-04 14:56:20 +03:00
|
|
|
|
"RetailCrmInventories::inventoriesUpload();", $mid, "N", 3600, // interval - 1 hour
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$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
|
|
|
|
|
);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$arResult['bitrixStoresExportList'] = RCrmActions::StoresExportList();
|
|
|
|
|
foreach($arResult['bitrixStoresExportList'] as $bitrixStores){
|
|
|
|
|
$bitrixStoresArr[$bitrixStores['ID']] = htmlspecialchars(trim($_POST['stores-export-' . $bitrixStores['ID']]));
|
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
function maskInv($var){
|
|
|
|
|
return preg_match("/^shops-exoprt/", $var);
|
|
|
|
|
}
|
|
|
|
|
$bitrixShopsArr = str_replace('shops-exoprt-', '', array_filter(array_keys($_POST), 'maskInv'));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
|
|
|
|
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
|
2017-09-04 11:36:04 +03:00
|
|
|
|
foreach($arResult['bitrixIblocksExportList'] as $bitrixIblocks){
|
|
|
|
|
if(htmlspecialchars(trim($_POST['iblocks-stores-' . $bitrixIblocks['ID']])) === 'Y'){
|
|
|
|
|
$bitrixIblocksInventories[] = $bitrixIblocks['ID'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$inventoriesUpload = 'N';
|
|
|
|
|
CAgent::RemoveAgent("RetailCrmInventories::inventoriesUpload();", $mid);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
}
|
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
//prices
|
|
|
|
|
$bitrixPricesArr = array();
|
|
|
|
|
$bitrixIblocksPrices = array();
|
|
|
|
|
$bitrixPriceShopsArr = array();
|
|
|
|
|
if(htmlspecialchars(trim($_POST['prices-upload'])) == 'Y'){
|
|
|
|
|
$pricesUpload = 'Y';
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$dateAgent = new DateTime();
|
|
|
|
|
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
|
|
|
|
|
$dateAgent->add($intAgent);
|
|
|
|
|
|
|
|
|
|
CAgent::AddAgent(
|
2020-05-04 14:56:20 +03:00
|
|
|
|
"RetailCrmPrices::pricesUpload();", $mid, "N", 86400, // interval - 24 hours
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$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
|
|
|
|
|
);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$arResult['bitrixPricesExportList'] = RCrmActions::PricesExportList();
|
|
|
|
|
foreach($arResult['bitrixPricesExportList'] as $bitrixPrices){
|
|
|
|
|
$bitrixPricesArr[$bitrixPrices['ID']] = htmlspecialchars(trim($_POST['price-type-export-' . $bitrixPrices['ID']]));
|
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
function maskPrice($var){
|
|
|
|
|
return preg_match("/^shops-price/", $var);
|
|
|
|
|
}
|
|
|
|
|
$bitrixPriceShopsArr = str_replace('shops-price-', '', array_filter(array_keys($_POST), 'maskPrice'));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
|
|
|
|
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
|
2017-09-04 11:36:04 +03:00
|
|
|
|
foreach($arResult['bitrixIblocksExportList'] as $bitrixIblocks){
|
|
|
|
|
if(htmlspecialchars(trim($_POST['iblocks-prices-' . $bitrixIblocks['ID']])) === 'Y'){
|
|
|
|
|
$bitrixIblocksPrices[] = $bitrixIblocks['ID'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$pricesUpload = 'N';
|
|
|
|
|
CAgent::RemoveAgent("RetailCrmPrices::pricesUpload();", $mid);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
}
|
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
//demon
|
|
|
|
|
$collectorKeys = array();
|
|
|
|
|
if (htmlspecialchars(trim($_POST['collector'])) == 'Y') {
|
|
|
|
|
$collector = 'Y';
|
|
|
|
|
foreach ($arResult['arSites'] as $site) {
|
|
|
|
|
$collectorKeys[$site['LID']] = trim($_POST['collector-id-' . $site['LID']]);
|
|
|
|
|
}
|
|
|
|
|
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmCollector", "add");
|
|
|
|
|
} else {
|
|
|
|
|
$collector = 'N';
|
|
|
|
|
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmCollector", "add");
|
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
//UA
|
|
|
|
|
$uaKeys = array();
|
|
|
|
|
if (htmlspecialchars(trim($_POST['ua-integration'])) == 'Y') {
|
|
|
|
|
$ua = 'Y';
|
|
|
|
|
foreach ($arResult['arSites'] as $site) {
|
|
|
|
|
$uaKeys[$site['LID']]['ID'] = trim($_POST['ua-id-' . $site['LID']]);
|
|
|
|
|
$uaKeys[$site['LID']]['INDEX'] = trim($_POST['ua-index-' . $site['LID']]);
|
|
|
|
|
}
|
|
|
|
|
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmUa", "add");
|
|
|
|
|
} else {
|
|
|
|
|
$ua = 'N';
|
|
|
|
|
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmUa", "add");
|
2018-10-04 16:28:14 +03:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
//discount_round
|
|
|
|
|
if (htmlspecialchars(trim($_POST['discount_round'])) == 'Y') {
|
|
|
|
|
$discount_round = 'Y';
|
|
|
|
|
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmDc", "add");
|
2020-04-24 13:18:18 +03:00
|
|
|
|
} else {
|
2020-02-18 10:54:42 +03:00
|
|
|
|
$discount_round = 'N';
|
|
|
|
|
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmDc", "add");
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-24 13:18:18 +03:00
|
|
|
|
//corporate-cliente
|
|
|
|
|
if (htmlspecialchars(trim($_POST['corp-client'])) == 'Y') {
|
|
|
|
|
$cc = 'Y';
|
|
|
|
|
$bitrixCorpName = htmlspecialchars(trim($_POST['nickName-corporate']));
|
|
|
|
|
$bitrixCorpAdres = htmlspecialchars(trim($_POST['adres-corporate']));
|
|
|
|
|
function maskCorp($var) {
|
|
|
|
|
return preg_match("/^shops-corporate/", $var);
|
|
|
|
|
}
|
|
|
|
|
$bitrixCorpShopsArr = str_replace('shops-corporate-', '', array_filter(array_keys($_POST), 'maskCorp'));
|
|
|
|
|
|
|
|
|
|
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmCc", "add");
|
|
|
|
|
} else {
|
|
|
|
|
$cc = 'N';
|
|
|
|
|
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmCc", "add");
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-08 17:27:05 +03:00
|
|
|
|
//purchasePrice_null
|
|
|
|
|
if (htmlspecialchars(trim($_POST['purchasePrice_null'])) == 'Y') {
|
|
|
|
|
$purchasePrice_null = 'Y';
|
|
|
|
|
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmPricePrchase", "add");
|
|
|
|
|
} else {
|
|
|
|
|
$purchasePrice_null = 'N';
|
|
|
|
|
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmPricePrchase", "add");
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
//version
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$version = COption::GetOptionString($mid, $CRM_API_VERSION);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
|
|
|
|
if (htmlspecialchars(trim($_POST['api_version'])) != $version) {
|
2017-09-04 11:36:04 +03:00
|
|
|
|
if (htmlspecialchars(trim($_POST['api_version'])) == 'v4') {
|
|
|
|
|
$version = 'v4';
|
|
|
|
|
} elseif (htmlspecialchars(trim($_POST['api_version'])) == 'v5') {
|
|
|
|
|
$version = 'v5';
|
|
|
|
|
} else {
|
|
|
|
|
LocalRedirect($uri);
|
|
|
|
|
echo CAdminMessage::ShowMessage(GetMessage('API_NOT_FOUND'));
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-04 14:56:20 +03:00
|
|
|
|
//api request with $version
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$crmUrl = htmlspecialchars(trim($_POST['api_host']));
|
|
|
|
|
$apiKey = htmlspecialchars(trim($_POST['api_key']));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
if ('/' !== $crmUrl[strlen($crmUrl) - 1]) {
|
|
|
|
|
$crmUrl .= '/';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$crmUrl = $crmUrl . 'api/' . $version;
|
|
|
|
|
|
|
|
|
|
$client = new RetailCrm\Http\Client($crmUrl, array('apiKey' => $apiKey));
|
|
|
|
|
$result = $client->makeRequest(
|
|
|
|
|
'/reference/payment-statuses',
|
|
|
|
|
'GET'
|
|
|
|
|
);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
if ($result->getStatusCode() == 200) {
|
2018-10-04 16:28:14 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_API_VERSION, $version);
|
2017-09-04 11:36:04 +03:00
|
|
|
|
} else {
|
|
|
|
|
LocalRedirect($uri);
|
|
|
|
|
echo CAdminMessage::ShowMessage(GetMessage('API_NOT_WORK'));
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-12-04 17:44:30 +03:00
|
|
|
|
|
2018-05-23 12:19:59 +03:00
|
|
|
|
if ($_POST[$CRM_CURRENCY]) {
|
2017-12-04 17:44:30 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_CURRENCY, $_POST['currency']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
COption::SetOptionString($mid, $CRM_ADDRESS_OPTIONS, serialize($addressDatailOptions));
|
2017-10-26 16:30:50 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_SITES_LIST, serialize($siteListArr));
|
2016-09-15 16:42:10 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize(RCrmActions::clearArr($orderTypesArr)));
|
|
|
|
|
COption::SetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, serialize(RCrmActions::clearArr($deliveryTypesArr)));
|
|
|
|
|
COption::SetOptionString($mid, $CRM_PAYMENT_TYPES, serialize(RCrmActions::clearArr($paymentTypesArr)));
|
|
|
|
|
COption::SetOptionString($mid, $CRM_PAYMENT_STATUSES, serialize(RCrmActions::clearArr($paymentStatusesArr)));
|
|
|
|
|
COption::SetOptionString($mid, $CRM_PAYMENT, serialize(RCrmActions::clearArr($paymentArr)));
|
2014-07-14 11:05:27 +04:00
|
|
|
|
COption::SetOptionString($mid, $CRM_ORDER_DISCHARGE, $orderDischarge);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_ORDER_PROPS, serialize(RCrmActions::clearArr($orderPropsArr)));
|
|
|
|
|
COption::SetOptionString($mid, $CRM_CONTRAGENT_TYPE, serialize(RCrmActions::clearArr($contragentTypeArr)));
|
2016-09-15 16:42:10 +03:00
|
|
|
|
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)));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
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)));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
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)));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_IBLOCKS_PRICES, serialize(RCrmActions::clearArr($bitrixIblocksPrices)));
|
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_COLLECTOR, $collector);
|
|
|
|
|
COption::SetOptionString($mid, $CRM_COLL_KEY, serialize(RCrmActions::clearArr($collectorKeys)));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_UA, $ua);
|
|
|
|
|
COption::SetOptionString($mid, $CRM_UA_KEYS, serialize(RCrmActions::clearArr($uaKeys)));
|
2018-05-23 12:19:59 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_DIMENSIONS, $orderDimensions);
|
2013-07-08 15:08:14 +04:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_DISCOUNT_ROUND, $discount_round);
|
2020-04-08 17:27:05 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_PURCHASE_PRICE_NULL, $purchasePrice_null);
|
2020-02-18 10:54:42 +03:00
|
|
|
|
|
2020-04-24 13:18:18 +03:00
|
|
|
|
COption::SetOptionString($mid, $CRM_CC, $cc);
|
|
|
|
|
COption::SetOptionString($mid, $CRM_CORP_SHOPS, serialize(RCrmActions::clearArr($bitrixCorpShopsArr)));
|
|
|
|
|
COption::SetOptionString($mid, $CRM_CORP_NAME, serialize(RCrmActions::clearArr($bitrixCorpName)));
|
|
|
|
|
COption::SetOptionString($mid, $CRM_CORP_ADRES, serialize(RCrmActions::clearArr($bitrixCorpAdres)));
|
|
|
|
|
|
2018-12-14 14:15:17 +03:00
|
|
|
|
$request = \Bitrix\Main\Application::getInstance()->getContext()->getRequest();
|
|
|
|
|
|
2018-11-02 16:51:13 +03:00
|
|
|
|
if ($request->isHttps() === true) {
|
|
|
|
|
COption::SetOptionString($mid, $PROTOCOL, 'https://');
|
|
|
|
|
} else {
|
|
|
|
|
COption::SetOptionString($mid, $PROTOCOL, 'http://');
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-08 15:08:14 +04:00
|
|
|
|
$uri .= '&ok=Y';
|
|
|
|
|
LocalRedirect($uri);
|
2013-07-05 18:19:42 +04:00
|
|
|
|
} else {
|
2013-07-09 19:03:56 +04:00
|
|
|
|
$api_host = COption::GetOptionString($mid, $CRM_API_HOST_OPTION, 0);
|
|
|
|
|
$api_key = COption::GetOptionString($mid, $CRM_API_KEY_OPTION, 0);
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$api = new RetailCrm\ApiClient($api_host, $api_key);
|
2013-07-05 18:19:42 +04:00
|
|
|
|
|
|
|
|
|
//prepare crm lists
|
2014-03-22 14:52:17 +04:00
|
|
|
|
try {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$arResult['orderTypesList'] = $api->orderTypesList()->orderTypes;
|
|
|
|
|
$arResult['deliveryTypesList'] = $api->deliveryTypesList()->deliveryTypes;
|
|
|
|
|
$arResult['deliveryServicesList'] = $api->deliveryServicesList()->deliveryServices;
|
|
|
|
|
$arResult['paymentTypesList'] = $api->paymentTypesList()->paymentTypes;
|
|
|
|
|
$arResult['paymentStatusesList'] = $api->paymentStatusesList()->paymentStatuses; // --statuses
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$arResult['paymentList'] = $api->statusesList()->statuses;
|
|
|
|
|
$arResult['paymentGroupList'] = $api->statusGroupsList()->statusGroups; // -- statuses groups
|
2015-11-09 17:46:32 +03:00
|
|
|
|
$arResult['sitesList'] = $APPLICATION->ConvertCharsetArray($api->sitesList()->sites, 'utf-8', SITE_CHARSET);
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$arResult['inventoriesList'] = $APPLICATION->ConvertCharsetArray($api->storesList()->stores, 'utf-8', SITE_CHARSET);
|
|
|
|
|
$arResult['priceTypeList'] = $APPLICATION->ConvertCharsetArray($api->pricesTypes()->priceTypes, 'utf-8', SITE_CHARSET);
|
2015-03-03 16:37:34 +03:00
|
|
|
|
} catch (\RetailCrm\Exception\CurlException $e) {
|
2016-09-15 16:42:10 +03:00
|
|
|
|
RCrmActions::eventLog(
|
|
|
|
|
'intaro.retailcrm/options.php', 'RetailCrm\ApiClient::*List::CurlException',
|
2014-03-22 14:52:17 +04:00
|
|
|
|
$e->getCode() . ': ' . $e->getMessage()
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
echo CAdminMessage::ShowMessage(GetMessage('ERR_' . $e->getCode()));
|
2016-09-15 16:42:10 +03:00
|
|
|
|
} catch (InvalidArgumentException $e) {
|
2015-11-09 17:46:32 +03:00
|
|
|
|
$badKey = true;
|
|
|
|
|
echo CAdminMessage::ShowMessage(GetMessage('ERR_403'));
|
2017-12-04 17:44:30 +03:00
|
|
|
|
} catch (\RetailCrm\Exception\InvalidJsonException $e) {
|
|
|
|
|
$badJson = true;
|
|
|
|
|
echo CAdminMessage::ShowMessage(GetMessage('ERR_JSON'));
|
2015-11-09 17:46:32 +03:00
|
|
|
|
}
|
2017-12-04 17:44:30 +03:00
|
|
|
|
|
2016-10-31 17:56:11 +03:00
|
|
|
|
$delivTypes = array();
|
|
|
|
|
foreach ($arResult['deliveryTypesList'] as $delivType) {
|
|
|
|
|
if ($delivType['active'] === true) {
|
|
|
|
|
$delivTypes[$delivType['code']] = $delivType;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$arResult['deliveryTypesList'] = $delivTypes;
|
2013-07-05 18:19:42 +04:00
|
|
|
|
|
2013-07-05 21:15:23 +04:00
|
|
|
|
//bitrix orderTypesList -- personTypes
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$arResult['bitrixOrderTypesList'] = RCrmActions::OrderTypesList($arResult['arSites']);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2013-07-05 18:19:42 +04:00
|
|
|
|
//bitrix deliveryTypesList
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$arResult['bitrixDeliveryTypesList'] = RCrmActions::DeliveryList();
|
2014-01-23 17:50:58 +04:00
|
|
|
|
|
2013-07-05 18:19:42 +04:00
|
|
|
|
//bitrix paymentTypesList
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$arResult['bitrixPaymentTypesList'] = RCrmActions::PaymentList();
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2016-09-15 16:42:10 +03:00
|
|
|
|
//bitrix statusesList
|
|
|
|
|
$arResult['bitrixPaymentStatusesList'] = RCrmActions::StatusesList();
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2013-07-08 15:08:14 +04:00
|
|
|
|
//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';
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2016-09-15 16:42:10 +03:00
|
|
|
|
//bitrix orderPropsList
|
|
|
|
|
$arResult['arProp'] = RCrmActions::OrderPropsList();
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
|
|
|
|
|
$arResult['bitrixStoresExportList'] = RCrmActions::StoresExportList();
|
|
|
|
|
$arResult['bitrixPricesExportList'] = RCrmActions::PricesExportList();
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2013-07-05 18:19:42 +04:00
|
|
|
|
//saved cat params
|
2013-07-08 15:08:14 +04:00
|
|
|
|
$optionsOrderTypes = unserialize(COption::GetOptionString($mid, $CRM_ORDER_TYPES_ARR, 0));
|
|
|
|
|
$optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0));
|
|
|
|
|
$optionsPayTypes = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_TYPES, 0));
|
|
|
|
|
$optionsPayStatuses = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_STATUSES, 0)); // --statuses
|
|
|
|
|
$optionsPayment = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT, 0));
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$optionsSitesList = unserialize(COption::GetOptionString($mid, $CRM_SITES_LIST, 0));
|
2013-09-10 17:15:41 +04:00
|
|
|
|
$optionsDischarge = COption::GetOptionString($mid, $CRM_ORDER_DISCHARGE, 0);
|
2018-10-04 16:28:14 +03:00
|
|
|
|
$optionsOrderProps = unserialize(COption::GetOptionString($mid, $CRM_ORDER_PROPS, 0));
|
|
|
|
|
$optionsContragentType = unserialize(COption::GetOptionString($mid, $CRM_CONTRAGENT_TYPE, 0));
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$optionsLegalDetails = unserialize(COption::GetOptionString($mid, $CRM_LEGAL_DETAILS, 0));
|
|
|
|
|
$optionsCustomFields = unserialize(COption::GetOptionString($mid, $CRM_CUSTOM_FIELDS, 0));
|
2016-09-15 16:42:10 +03:00
|
|
|
|
$optionsOrderNumbers = COption::GetOptionString($mid, $CRM_ORDER_NUMBERS, 0);
|
|
|
|
|
$canselOrderArr = unserialize(COption::GetOptionString($mid, $CRM_CANSEL_ORDER, 0));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$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));
|
2020-04-24 13:18:18 +03:00
|
|
|
|
$optionShopsCorporate = unserialize(COption::GetOptionString($mid, $CRM_SHOPS, 0));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$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));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$optionCollector = COption::GetOptionString($mid, $CRM_COLLECTOR, 0);
|
|
|
|
|
$optionCollectorKeys = unserialize(COption::GetOptionString($mid, $CRM_COLL_KEY));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$optionUa = COption::GetOptionString($mid, $CRM_UA, 0);
|
|
|
|
|
$optionUaKeys = unserialize(COption::GetOptionString($mid, $CRM_UA_KEYS));
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
$optionDiscRound = COption::GetOptionString($mid, $CRM_DISCOUNT_ROUND, 0);
|
2020-04-08 17:27:05 +03:00
|
|
|
|
$optionPricePrchaseNull = COption::GetOptionString($mid, $CRM_PURCHASE_PRICE_NULL, 0);
|
2020-02-18 10:54:42 +03:00
|
|
|
|
|
2020-04-24 13:18:18 +03:00
|
|
|
|
//corporate-cliente
|
|
|
|
|
$optionCorpClient = COption::GetOptionString($mid, $CRM_CC, 0);
|
|
|
|
|
$optionCorpShops = unserialize(COption::GetOptionString($mid, $CRM_CORP_SHOPS, 0));
|
|
|
|
|
$optionsCorpComName = unserialize(COption::GetOptionString($mid, $CRM_CORP_NAME, 0));
|
|
|
|
|
$optionsCorpAdres = unserialize(COption::GetOptionString($mid, $CRM_CORP_ADRES, 0));
|
|
|
|
|
|
2017-09-04 11:36:04 +03:00
|
|
|
|
$version = COption::GetOptionString($mid, $CRM_API_VERSION, 0);
|
2014-02-13 16:25:26 +04:00
|
|
|
|
|
2017-12-04 17:44:30 +03:00
|
|
|
|
//currency
|
|
|
|
|
$baseCurrency = \Bitrix\Currency\CurrencyManager::getBaseCurrency();
|
|
|
|
|
$currencyOption = COption::GetOptionString($mid, $CRM_CURRENCY, 0) ? COption::GetOptionString($mid, $CRM_CURRENCY, 0) : $baseCurrency;
|
|
|
|
|
$currencyList = \Bitrix\Currency\CurrencyManager::getCurrencyList();
|
|
|
|
|
|
2018-05-23 12:19:59 +03:00
|
|
|
|
$optionsOrderDimensions = COption::GetOptionString($mid, $CRM_DIMENSIONS, 'N');
|
2017-12-04 17:44:30 +03:00
|
|
|
|
$addressOptions = unserialize(COption::GetOptionString($mid, $CRM_ADDRESS_OPTIONS, 0));
|
|
|
|
|
|
2013-07-05 18:19:42 +04:00
|
|
|
|
$aTabs = array(
|
|
|
|
|
array(
|
|
|
|
|
"DIV" => "edit1",
|
|
|
|
|
"TAB" => GetMessage('ICRM_OPTIONS_GENERAL_TAB'),
|
|
|
|
|
"ICON" => "",
|
|
|
|
|
"TITLE" => GetMessage('ICRM_OPTIONS_GENERAL_CAPTION')
|
|
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
"DIV" => "edit2",
|
|
|
|
|
"TAB" => GetMessage('ICRM_OPTIONS_CATALOG_TAB'),
|
|
|
|
|
"ICON" => '',
|
2013-07-09 19:03:56 +04:00
|
|
|
|
"TITLE" => GetMessage('ICRM_OPTIONS_CATALOG_CAPTION')
|
2013-07-05 18:19:42 +04:00
|
|
|
|
),
|
2013-09-10 17:15:41 +04:00
|
|
|
|
array(
|
2013-09-03 18:00:12 +04:00
|
|
|
|
"DIV" => "edit3",
|
2013-09-12 19:00:46 +04:00
|
|
|
|
"TAB" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_TAB'),
|
2013-09-10 17:15:41 +04:00
|
|
|
|
"ICON" => '',
|
2013-09-12 19:00:46 +04:00
|
|
|
|
"TITLE" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_CAPTION')
|
2013-09-12 17:16:54 +04:00
|
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
"DIV" => "edit4",
|
2016-09-15 16:42:10 +03:00
|
|
|
|
"TAB" => GetMessage('OTHER_OPTIONS'),
|
2013-09-03 18:00:12 +04:00
|
|
|
|
"ICON" => '',
|
2013-09-12 19:00:46 +04:00
|
|
|
|
"TITLE" => GetMessage('ICRM_OPTIONS_ORDER_DISCHARGE_CAPTION')
|
2013-09-10 17:15:41 +04:00
|
|
|
|
)
|
2013-07-05 18:19:42 +04:00
|
|
|
|
);
|
|
|
|
|
$tabControl = new CAdminTabControl("tabControl", $aTabs);
|
|
|
|
|
$tabControl->Begin();
|
2020-02-18 10:54:42 +03:00
|
|
|
|
?>
|
|
|
|
|
<?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() {
|
|
|
|
|
$('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)
|
|
|
|
|
$('tr.address-detail-' + orderType).hide('slow');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('tr.contragent-type select').change(function(){
|
|
|
|
|
splitName = $(this).attr('name').split('-');
|
|
|
|
|
contragentType = $(this).val();
|
|
|
|
|
orderType = splitName[2];
|
2015-03-03 16:37:34 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
$('tr.legal-detail-' + orderType).hide();
|
|
|
|
|
$('.legal-detail-title-' + orderType).hide();
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
$('tr.legal-detail-' + orderType).each(function(){
|
|
|
|
|
if($(this).hasClass(contragentType)){
|
|
|
|
|
$(this).show();
|
|
|
|
|
$('.legal-detail-title-' + orderType).show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2015-03-03 16:37:34 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
$('.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');
|
2015-03-03 16:37:34 +03:00
|
|
|
|
}
|
2020-02-18 10:54:42 +03:00
|
|
|
|
|
|
|
|
|
return true;
|
2013-09-03 18:00:12 +04:00
|
|
|
|
});
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
$('.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');
|
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
return true;
|
|
|
|
|
});
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
$('.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');
|
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
return true;
|
|
|
|
|
});
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-07-14 13:47:26 +03:00
|
|
|
|
$('.r-dc-button label').change(function() {
|
|
|
|
|
if ($(this).find('input').is(':checked') === true) {
|
2020-04-24 13:18:18 +03:00
|
|
|
|
$('tr.r-dc').show('slow');
|
2020-07-14 13:47:26 +03:00
|
|
|
|
} else if ($(this).find('input').is(':checked') === false) {
|
2020-04-24 13:18:18 +03:00
|
|
|
|
$('tr.r-dc').hide('slow');
|
2020-02-18 10:54:42 +03:00
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
return true;
|
|
|
|
|
});
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-04-24 13:18:18 +03:00
|
|
|
|
$('.r-cc-button label').change(function(){
|
2020-07-14 13:47:26 +03:00
|
|
|
|
if($(this).find('input').is(':checked') === true) {
|
2020-04-24 13:18:18 +03:00
|
|
|
|
$('tr.r-cc').show('slow');
|
2020-02-18 10:54:42 +03:00
|
|
|
|
} else if($(this).find('input').is(':checked') === false){
|
2020-04-24 13:18:18 +03:00
|
|
|
|
$('tr.r-cc').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');
|
2020-02-18 10:54:42 +03:00
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
return true;
|
|
|
|
|
});
|
2020-04-08 17:27:05 +03:00
|
|
|
|
|
|
|
|
|
$('.r-purchaseprice-button label').change(function() {
|
|
|
|
|
if($(this).find('input').is(':checked') === true) {
|
|
|
|
|
$('tr.r-purchaseprice').show('slow');
|
|
|
|
|
} else if($(this).find('input').is(':checked') === false) {
|
|
|
|
|
$('tr.r-purchaseprice').hide('slow');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
|
2014-01-30 12:17:58 +04:00
|
|
|
|
});
|
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
$('input[name="update-delivery-services"]').live('click', function() {
|
|
|
|
|
BX.showWait();
|
|
|
|
|
var updButton = this;
|
|
|
|
|
// hide next step button
|
|
|
|
|
$(updButton).css('opacity', '0.5').attr('disabled', 'disabled');
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
var handlerUrl = $(this).parents('form').attr('action');
|
|
|
|
|
var data = 'ajax=1';
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
url: handlerUrl,
|
|
|
|
|
data: data,
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
success: function(response) {
|
|
|
|
|
BX.closeWait();
|
|
|
|
|
$(updButton).css('opacity', '1').removeAttr('disabled');
|
|
|
|
|
|
|
|
|
|
if(!response.success)
|
|
|
|
|
alert('<?php echo GetMessage('MESS_1'); ?>');
|
|
|
|
|
},
|
|
|
|
|
error: function () {
|
|
|
|
|
BX.closeWait();
|
|
|
|
|
$(updButton).css('opacity', '1').removeAttr('disabled');
|
|
|
|
|
|
|
|
|
|
alert('<?php echo GetMessage('MESS_2'); ?>');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
.option-other-bottom {
|
|
|
|
|
border-bottom: 0px !important;
|
|
|
|
|
}
|
|
|
|
|
.option-other-top{
|
|
|
|
|
border-top: 1px solid #f5f9f9 !important;
|
|
|
|
|
}
|
|
|
|
|
.option-other-center{
|
|
|
|
|
border-top: 5px solid #f5f9f9 !important;
|
|
|
|
|
border-bottom: 5px solid #f5f9f9 !important;
|
|
|
|
|
}
|
|
|
|
|
.option-other-heading{
|
|
|
|
|
border-top: 25px solid #f5f9f9 !important;
|
|
|
|
|
border-bottom: 0px solid #f5f9f9 !important;
|
|
|
|
|
}
|
|
|
|
|
.option-other-empty{
|
|
|
|
|
border-bottom: 15px solid #f5f9f9 !important;
|
|
|
|
|
}
|
|
|
|
|
.option-head{
|
|
|
|
|
text-align: center;
|
|
|
|
|
padding: 10px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #4b6267;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
<form method="POST" action="<?php echo $uri; ?>" id="FORMACTION">
|
|
|
|
|
<?php
|
|
|
|
|
echo bitrix_sessid_post();
|
|
|
|
|
$tabControl->BeginNextTab();
|
|
|
|
|
?>
|
|
|
|
|
<input type="hidden" name="tab" value="catalog">
|
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2"><b><?php echo GetMessage('ICRM_CONN_SETTINGS'); ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-l"><?php echo GetMessage('ICRM_API_HOST'); ?></td>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-r"><input type="text" id="api_host" name="api_host" value="<?php echo $api_host; ?>"></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-l"><?php echo GetMessage('ICRM_API_KEY'); ?></td>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-r"><input type="text" id="api_key" name="api_key" value="<?php echo $api_key; ?>"></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php if(count($arResult['arSites'])>1):?>
|
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2" style="background-color: transparent;">
|
|
|
|
|
<b>
|
|
|
|
|
<?php echo GetMessage('ICRM_SITES'); ?>
|
|
|
|
|
</b>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php foreach ($arResult['arSites'] as $site): ?>
|
2016-09-15 16:42:10 +03:00
|
|
|
|
<tr>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<td width="50%" class="adm-detail-content-cell-l"><?php echo $site['NAME'] . ' (' . $site['LID'] . ')'; ?></td>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-r">
|
|
|
|
|
<select class="typeselect" name="sites-id-<?php echo $site['LID']?>">
|
|
|
|
|
<option value=""></option>
|
|
|
|
|
<?php foreach ($arResult['sitesList'] as $sitesList): ?>
|
|
|
|
|
<option value="<?php echo $sitesList['code'] ?>" <?php if($sitesList['code'] == $optionsSitesList[$site['LID']]) echo 'selected="selected"'; ?>><?php echo $sitesList['name']?></option>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
2016-09-15 16:42:10 +03:00
|
|
|
|
</tr>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
<?php endif;?>
|
|
|
|
|
<?php if(!$badKey && !$badJson):?>
|
|
|
|
|
<?php $tabControl->BeginNextTab(); ?>
|
|
|
|
|
<input type="hidden" name="tab" value="catalog">
|
|
|
|
|
<tr class="option-head">
|
|
|
|
|
<td colspan="2"><b><?php echo GetMessage('INFO_1'); ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2"><b><?php echo GetMessage('DELIVERY_TYPES_LIST'); ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php foreach($arResult['bitrixDeliveryTypesList'] as $bitrixDeliveryType): ?>
|
2016-09-15 16:42:10 +03:00
|
|
|
|
<tr>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixDeliveryType['ID']; ?>">
|
|
|
|
|
<?php echo $bitrixDeliveryType['NAME']; ?>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-r">
|
|
|
|
|
<select name="delivery-type-<?php echo $bitrixDeliveryType['ID']; ?>" class="typeselect">
|
2016-09-15 16:42:10 +03:00
|
|
|
|
<option value=""></option>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<?php foreach($arResult['deliveryTypesList'] as $deliveryType): ?>
|
|
|
|
|
<?php if($deliveryType['active'] == true){?>
|
|
|
|
|
<option value="<?php echo $deliveryType['code']; ?>" <?php if ($optionsDelivTypes[$bitrixDeliveryType['ID']] == $deliveryType['code']) echo 'selected'; ?>>
|
|
|
|
|
<?php echo $APPLICATION->ConvertCharset($deliveryType['name'], 'utf-8', SITE_CHARSET); ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?php }?>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2">
|
|
|
|
|
<input type="submit" name="update-delivery-services" value="<?php echo GetMessage('UPDATE_DELIVERY_SERVICES'); ?>" class="adm-btn-save">
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2"><b><?php echo GetMessage('PAYMENT_TYPES_LIST'); ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php foreach($arResult['bitrixPaymentTypesList'] as $bitrixPaymentType): ?>
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixPaymentType['ID']; ?>">
|
|
|
|
|
<?php echo $bitrixPaymentType['NAME']; ?>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-r">
|
|
|
|
|
<select name="payment-type-<?php echo $bitrixPaymentType['ID']; ?>" class="typeselect">
|
|
|
|
|
<option value="" selected=""></option>
|
|
|
|
|
<?php foreach($arResult['paymentTypesList'] as $paymentType): ?>
|
|
|
|
|
<option value="<?php echo $paymentType['code']; ?>" <?php if ($optionsPayTypes[$bitrixPaymentType['ID']] == $paymentType['code']) echo 'selected'; ?>>
|
|
|
|
|
<?php echo $APPLICATION->ConvertCharset($paymentType['name'], 'utf-8', SITE_CHARSET); ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?php endforeach; ?>
|
2016-09-15 16:42:10 +03:00
|
|
|
|
</select>
|
|
|
|
|
</td>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
</tr>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2"><b><?php echo GetMessage('PAYMENT_STATUS_LIST'); ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="50%"></td>
|
|
|
|
|
<td width="50%">
|
|
|
|
|
<table width="100%">
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="50%"></td>
|
|
|
|
|
<td width="50%"><?php echo GetMessage('CANCELED'); ?></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php foreach($arResult['bitrixPaymentStatusesList'] as $bitrixPaymentStatus): ?>
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixPaymentStatus['ID']; ?>">
|
|
|
|
|
<?php echo $bitrixPaymentStatus['NAME']; ?>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-r">
|
|
|
|
|
<table width="100%">
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="70%">
|
|
|
|
|
<select name="payment-status-<?php echo $bitrixPaymentStatus['ID']; ?>" class="typeselect">
|
|
|
|
|
<option value=""></option>
|
|
|
|
|
<?php foreach($arResult['paymentGroupList'] as $orderStatusGroup): if(!empty($orderStatusGroup['statuses'])) : ?>
|
|
|
|
|
<optgroup label="<?php echo $APPLICATION->ConvertCharset($orderStatusGroup['name'], 'utf-8', SITE_CHARSET); ?>">
|
|
|
|
|
<?php foreach($orderStatusGroup['statuses'] as $payment): ?>
|
|
|
|
|
<?php if(isset($arResult['paymentList'][$payment])): ?>
|
|
|
|
|
<option value="<?php echo $arResult['paymentList'][$payment]['code']; ?>" <?php if ($optionsPayStatuses[$bitrixPaymentStatus['ID']] == $arResult['paymentList'][$payment]['code']) echo 'selected'; ?>>
|
|
|
|
|
<?php echo $APPLICATION->ConvertCharset($arResult['paymentList'][$payment]['name'], 'utf-8', SITE_CHARSET); ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</optgroup>
|
|
|
|
|
<?php endif; endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="30%">
|
|
|
|
|
<input name="order-cansel-<?php echo $bitrixPaymentStatus['ID']; ?>" <?php if(in_array($bitrixPaymentStatus['ID'], $canselOrderArr)) echo "checked";?> value="Y" type="checkbox" />
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
2016-09-15 16:42:10 +03:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2"><b><?php echo GetMessage('PAYMENT_LIST'); ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php foreach($arResult['bitrixPaymentList'] as $bitrixPayment): ?>
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixPayment['ID']; ?>">
|
|
|
|
|
<?php echo $bitrixPayment['NAME']; ?>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-r">
|
|
|
|
|
<select name="payment-<?php echo $bitrixPayment['ID']; ?>" class="typeselect">
|
|
|
|
|
<option value=""></option>
|
|
|
|
|
<?php foreach($arResult['paymentStatusesList'] as $paymentStatus): ?>
|
|
|
|
|
<option value="<?php echo $paymentStatus['code']; ?>" <?php if ($optionsPayment[$bitrixPayment['ID']] == $paymentStatus['code']) echo 'selected'; ?>>
|
|
|
|
|
<?php echo $APPLICATION->ConvertCharset($paymentStatus['name'], 'utf-8', SITE_CHARSET); ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2"><b><?php echo GetMessage('ORDER_TYPES_LIST'); ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php if($isCustomOrderType): ?>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="2" style="text-align: center!important; padding-bottom:10px;"><b style="color:#c24141;"><?php echo GetMessage('ORDER_TYPES_LIST_CUSTOM'); ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<?php foreach($arResult['bitrixOrderTypesList'] as $bitrixOrderType): ?>
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixOrderType['ID']; ?>">
|
|
|
|
|
<?php echo $bitrixOrderType['NAME']; ?>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-r">
|
|
|
|
|
<select name="order-type-<?php echo $bitrixOrderType['ID']; ?>" class="typeselect">
|
|
|
|
|
<option value=""></option>
|
|
|
|
|
<?php foreach($arResult['orderTypesList'] as $orderType): ?>
|
|
|
|
|
<option value="<?php echo $orderType['code']; ?>" <?php if ($optionsOrderTypes[$bitrixOrderType['ID']] == $orderType['code']) echo 'selected'; ?>>
|
|
|
|
|
<?php echo $APPLICATION->ConvertCharset($orderType['name'], 'utf-8', SITE_CHARSET); ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
<?php $tabControl->BeginNextTab(); ?>
|
|
|
|
|
<input type="hidden" name="tab" value="catalog">
|
|
|
|
|
<tr class="option-head">
|
|
|
|
|
<td colspan="2"><b><?php echo GetMessage('INFO_2'); ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php foreach($arResult['bitrixOrderTypesList'] as $bitrixOrderType): ?>
|
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2"><b><?php echo GetMessage('ORDER_TYPE_INFO') . ' ' . $bitrixOrderType['NAME']; ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr class="contragent-type">
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-l">
|
|
|
|
|
<?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">
|
|
|
|
|
<?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"]; ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php $countProps = 1; foreach($arResult['orderProps'] as $orderProp): ?>
|
|
|
|
|
<?php if($orderProp['ID'] == 'text'): ?>
|
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2" style="background-color: transparent;">
|
|
|
|
|
<b>
|
|
|
|
|
<label><input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID']; ?>" value="0" <?php if($addressOptions[$bitrixOrderType['ID']] == 0) echo "checked"; ?>><?php echo GetMessage('ADDRESS_SHORT'); ?></label>
|
|
|
|
|
<label><input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID']; ?>" value="1" <?php if($addressOptions[$bitrixOrderType['ID']] == 1) echo "checked"; ?>><?php echo GetMessage('ADDRESS_FULL'); ?></label>
|
|
|
|
|
</b>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<tr <?php if ($countProps > 4) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 4) && ($addressOptions[$bitrixOrderType['ID']] == 0)) echo 'style="display:none;"';?>>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $orderProp['ID']; ?>">
|
|
|
|
|
<?php echo $orderProp['NAME']; ?>
|
|
|
|
|
</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>
|
|
|
|
|
<?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']; ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php $countProps++; endforeach; ?>
|
|
|
|
|
<?if (isset($arResult['customFields']) && count($arResult['customFields']) > 0):?>
|
|
|
|
|
<tr class="heading custom-detail-title">
|
|
|
|
|
<td colspan="2" style="background-color: transparent;">
|
|
|
|
|
<b>
|
|
|
|
|
<?=GetMessage("ORDER_CUSTOM"); ?>
|
|
|
|
|
</b>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?foreach($arResult['customFields'] as $customFields):?>
|
|
|
|
|
<tr class="custom-detail-<?=$customFields['ID'];?>">
|
|
|
|
|
<td width="50%" class="" name="">
|
|
|
|
|
<?=$customFields['NAME']; ?>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="50%" class="">
|
|
|
|
|
<select name="custom-fields-<?=$customFields['ID'] . '-' . $bitrixOrderType['ID']; ?>" class="typeselect">
|
|
|
|
|
<option value=""></option>
|
|
|
|
|
<?foreach ($arResult['arProp'][$bitrixOrderType['ID']] as $arProp):?>
|
|
|
|
|
<option value="<?=$arProp['CODE']?>" <?php if ($optionsCustomFields[$bitrixOrderType['ID']][$customFields['ID']] == $arProp['CODE']) echo 'selected'; ?>>
|
|
|
|
|
<?=$arProp['NAME']; ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?endforeach;?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?endforeach;?>
|
|
|
|
|
<?endif;?>
|
|
|
|
|
<tr class="heading legal-detail-title-<?php echo $bitrixOrderType['ID'];?>" <?php if(count($optionsLegalDetails[$bitrixOrderType['ID']])<1) echo 'style="display:none"'; ?>>
|
|
|
|
|
<td colspan="2" style="background-color: transparent;">
|
|
|
|
|
<b>
|
|
|
|
|
<?php echo GetMessage('LEGAL_DETAIL'); ?>
|
|
|
|
|
</b>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php foreach($arResult['legalDetails'] as $legalDetails): ?>
|
|
|
|
|
<tr class="legal-detail-<?php echo $bitrixOrderType['ID'];?> <?php foreach($legalDetails['GROUP'] as $gr) echo $gr . ' ';?>" <?php if(!in_array($optionsContragentType[$bitrixOrderType['ID']], $legalDetails['GROUP'])) echo 'style="display:none"'; ?>>
|
|
|
|
|
<td width="50%" class="" name="<?php ?>">
|
|
|
|
|
<?php echo $legalDetails['NAME']; ?>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="50%" class="">
|
|
|
|
|
<select name="legal-detail-<?php echo $legalDetails['ID'] . '-' . $bitrixOrderType['ID']; ?>" class="typeselect">
|
|
|
|
|
<option value=""></option>
|
|
|
|
|
<?php foreach ($arResult['arProp'][$bitrixOrderType['ID']] as $arProp): ?>
|
|
|
|
|
<option value="<?php echo $arProp['CODE']; ?>" <?php if ($optionsLegalDetails[$bitrixOrderType['ID']][$legalDetails['ID']] == $arProp['CODE']) echo 'selected'; ?>>
|
|
|
|
|
<?php echo $arProp['NAME']; ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
2013-09-03 18:00:12 +04:00
|
|
|
|
<?php endforeach; ?>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<?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>
|
|
|
|
|
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
|
|
|
|
<b>
|
|
|
|
|
<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>
|
|
|
|
|
<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>
|
|
|
|
|
<label><input class="addr" type="radio" name="order-discharge" value="1" <?php if($optionsDischarge == 1) echo "checked"; ?>><?php echo GetMessage('DISCHARGE_EVENTS'); ?></label>
|
|
|
|
|
<label><input class="addr" type="radio" name="order-discharge" value="0" <?php if($optionsDischarge == 0) echo "checked"; ?>><?php echo GetMessage('DISCHARGE_AGENT'); ?></label>
|
|
|
|
|
</b>
|
2015-03-03 16:37:34 +03:00
|
|
|
|
</td>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
</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++) {
|
|
|
|
|
$ver = 'v' . $v; ?>
|
|
|
|
|
<option value="<?php echo $ver; ?>" <?php if ($ver == $version) echo 'selected'; ?>>
|
|
|
|
|
API V<?php echo $v; ?>
|
2015-03-03 16:37:34 +03:00
|
|
|
|
</option>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<?php } ?>
|
2015-03-03 16:37:34 +03:00
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2" class="option-other-heading"><b><?php echo GetMessage('CURRENCY'); ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
|
|
|
|
<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; ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php if ($optionInventotiesUpload === 'Y' || count($arResult['bitrixStoresExportList']) > 0) :?>
|
|
|
|
|
<tr class="heading inventories-batton">
|
|
|
|
|
<td colspan="2" class="option-other-heading">
|
|
|
|
|
<b>
|
|
|
|
|
<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 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>
|
|
|
|
|
<?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>
|
|
|
|
|
<td width="50%" class="adm-detail-content-cell-r">
|
|
|
|
|
<select class="typeselect" name="stores-export-<?php echo $catalogExportStore['ID']?>">
|
|
|
|
|
<option value=""></option>
|
|
|
|
|
<?php foreach ($arResult['inventoriesList'] as $inventoriesList): ?>
|
|
|
|
|
<option value="<?php echo $inventoriesList['code'] ?>" <?php if($optionStores[$catalogExportStore['ID']] == $inventoriesList['code']) echo 'selected="selected"'; ?>><?php echo $inventoriesList['name']?></option>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
2017-09-04 11:36:04 +03:00
|
|
|
|
<?php endforeach; ?>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<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('SHOPS_INVENTORIES_UPLOAD'); ?></label>
|
|
|
|
|
</b>
|
|
|
|
|
</td>
|
|
|
|
|
</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 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>
|
|
|
|
|
<?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;?>
|
|
|
|
|
<?php endif;?>
|
|
|
|
|
<?php if ($optionPricesUpload === 'Y' || count($arResult['bitrixPricesExportList']) > 0) :?>
|
|
|
|
|
<tr class="heading prices-batton">
|
|
|
|
|
<td colspan="2" class="option-other-heading">
|
|
|
|
|
<b>
|
|
|
|
|
<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 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 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">
|
|
|
|
|
<select class="typeselect" name="price-type-export-<?php echo $catalogExportPrice['ID'];?>">
|
|
|
|
|
<option value=""></option>
|
|
|
|
|
<?php foreach ($arResult['priceTypeList'] as $priceTypeList): ?>
|
|
|
|
|
<option value="<?php echo $priceTypeList['code'] ?>" <?php if($optionPrices[$catalogExportPrice['ID']] == $priceTypeList['code']) echo 'selected="selected"'; ?>><?php echo $priceTypeList['name']?></option>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</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">
|
|
|
|
|
<b>
|
|
|
|
|
<label><?php echo GetMessage('SHOPS_PRICES_UPLOAD'); ?></label>
|
|
|
|
|
</b>
|
|
|
|
|
</td>
|
|
|
|
|
</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>
|
|
|
|
|
<?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">
|
|
|
|
|
<b>
|
|
|
|
|
<label><?php echo GetMessage('IBLOCKS_UPLOAD'); ?></label>
|
|
|
|
|
</b>
|
|
|
|
|
</td>
|
|
|
|
|
</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;?>
|
|
|
|
|
<?php endif;?>
|
|
|
|
|
|
2020-04-24 13:18:18 +03:00
|
|
|
|
<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 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>
|
|
|
|
|
<?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>
|
|
|
|
|
<td class="adm-detail-content-cell-r" width="50%">
|
|
|
|
|
<input name="collector-id-<?echo $sitesList['LID'];?>" value="<?php echo $optionCollectorKeys[$sitesList['LID']]; ?>" type="text">
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php endforeach;?>
|
|
|
|
|
<tr class="heading r-ua-button">
|
|
|
|
|
<td colspan="2" class="option-other-heading">
|
|
|
|
|
<b>
|
|
|
|
|
<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>
|
|
|
|
|
<?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 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%">
|
|
|
|
|
<input name="ua-id-<?echo $sitesList['LID'];?>" value="<?php echo $optionUaKeys[$sitesList['LID']]['ID']; ?>" type="text">
|
|
|
|
|
</td>
|
|
|
|
|
</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('INDEX_UA'); ?></td>
|
|
|
|
|
<td class="adm-detail-content-cell-r" width="50%">
|
|
|
|
|
<input name="ua-index-<?echo $sitesList['LID'];?>" value="<?php echo $optionUaKeys[$sitesList['LID']]['INDEX']; ?>" type="text">
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php endforeach;?>
|
|
|
|
|
|
|
|
|
|
<tr class="heading r-dc-button">
|
|
|
|
|
<td colspan="2" class="option-other-heading">
|
|
|
|
|
<b>
|
2020-07-14 13:47:26 +03:00
|
|
|
|
<label><input class="addr" type="checkbox" name="discount_round" value="Y" <?php if($optionDiscRound === 'Y') echo "checked"; ?>><?php echo "Округление цены товара при сборе одинаковых товарных позиций" ?></label>
|
2020-04-24 13:18:18 +03:00
|
|
|
|
</b>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr class="r-dc" <?php if($optionDiscRound !== 'Y') echo 'style="display: none;"'; ?>>
|
|
|
|
|
<td class="option-head" colspan="2">
|
2020-07-14 13:47:26 +03:00
|
|
|
|
<b><?php echo "При включенной опции округление будет происходить в меньшую сторону" ?></b>
|
2020-04-24 13:18:18 +03:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr class="heading r-cc-button">
|
|
|
|
|
<td colspan="2" class="option-other-heading">
|
|
|
|
|
<b>
|
|
|
|
|
<label><input class="addr" type="checkbox" name="corp-client" value="Y" <?php if($optionCorpClient === 'Y') echo "checked"; ?>><?php echo GetMessage('CORP_CLIENTE'); ?></label>
|
|
|
|
|
</b>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr class="r-cc" <?php if($optionCorpClient !== 'Y') echo 'style="display: none;"'; ?>>
|
|
|
|
|
<td width="50%" class="" name="<?php ?>">
|
|
|
|
|
<?php echo GetMessage('CORP_NAME');?>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="50%" class="">
|
|
|
|
|
<select name="nickName-corporate" class="typeselect">
|
|
|
|
|
<option value=""></option>
|
|
|
|
|
<?php foreach ($arResult['arProp'][$bitrixOrderType['ID']] as $arProp): ?>
|
|
|
|
|
<option value="<?php echo $arProp['CODE']; ?>" <?php if ($optionsCorpComName == $arProp['CODE']) echo 'selected'; ?>>
|
|
|
|
|
<?php echo $arProp['NAME']; ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr class="r-cc" <?php if($optionCorpClient !== 'Y') echo 'style="display: none;"'; ?>>
|
|
|
|
|
<td width="50%" class="" name="<?php ?>">
|
|
|
|
|
<?php echo GetMessage('CORP_ADRESS');?>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="50%" class="">
|
|
|
|
|
<select name="adres-corporate" class="typeselect">
|
|
|
|
|
<option value=""></option>
|
|
|
|
|
<?php foreach ($arResult['arProp'][$bitrixOrderType['ID']] as $arProp): ?>
|
|
|
|
|
<option value="<?php echo $arProp['CODE']; ?>" <?php if ($optionsCorpAdres == $arProp['CODE']) echo 'selected'; ?>>
|
|
|
|
|
<?php echo $arProp['NAME']; ?>
|
|
|
|
|
</option>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</select>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
2020-04-28 14:16:12 +03:00
|
|
|
|
<tr class="r-cc" <?php if($optionCorpClient !== 'Y') echo 'style="display: none;"'; ?>>
|
|
|
|
|
<td colspan="2" class="option-head option-other-top option-other-bottom">
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<b>
|
2020-04-28 14:16:12 +03:00
|
|
|
|
<label><?php echo GetMessage('CORP_LABEL');?></label>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
</b>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
2020-04-28 14:16:12 +03:00
|
|
|
|
<tr class="r-cc" <?php if($optionCorpClient !== 'Y') echo 'style="display: none;"'; ?>>
|
|
|
|
|
<td width="50%" class="" name="<?php ?>" align="center">
|
|
|
|
|
<?php foreach ($arResult['sitesList'] as $sitesList): ?>
|
|
|
|
|
<td colspan="2" class="option-other-center">
|
|
|
|
|
<label><input class="addr" type="checkbox" name="shops-corporate-<?echo $sitesList['code'];?>" value="Y" <?php if(in_array($sitesList['code'], $optionCorpShops)) echo "checked"; ?>> <?php echo $sitesList['name'].' ('.$sitesList['code'].')'; ?></label>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
</td>
|
2020-04-28 14:16:12 +03:00
|
|
|
|
<?php endforeach;?>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php endif;?>
|
|
|
|
|
<?php $tabControl->Buttons(); ?>
|
|
|
|
|
<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>
|
2015-03-03 16:37:34 +03:00
|
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
|
|
<?php //order upload?>
|
|
|
|
|
<?php if($_GET['upl'] == 1){?>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<style type="text/css">
|
|
|
|
|
.instal-load-label {
|
|
|
|
|
color: #000;
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
}
|
2015-03-03 16:37:34 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
.instal-progress-bar-outer {
|
|
|
|
|
height: 32px;
|
|
|
|
|
border:1px solid;
|
|
|
|
|
border-color:#9ba6a8 #b1bbbe #bbc5c9 #b1bbbe;
|
|
|
|
|
-webkit-box-shadow: 1px 1px 0 #fff, inset 0 2px 2px #c0cbce;
|
|
|
|
|
box-shadow: 1px 1px 0 #fff, inset 0 2px 2px #c0cbce;
|
|
|
|
|
background-color:#cdd8da;
|
|
|
|
|
background-image:-webkit-linear-gradient(top, #cdd8da, #c3ced1);
|
|
|
|
|
background-image:-moz-linear-gradient(top, #cdd8da, #c3ced1);
|
|
|
|
|
background-image:-ms-linear-gradient(top, #cdd8da, #c3ced1);
|
|
|
|
|
background-image:-o-linear-gradient(top, #cdd8da, #c3ced1);
|
|
|
|
|
background-image:linear-gradient(top, #ced9db, #c3ced1);
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: #6a808e;
|
|
|
|
|
text-shadow: 0 1px rgba(255,255,255,0.85);
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
line-height: 35px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
2015-03-03 16:37:34 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
.instal-progress-bar-alignment {
|
|
|
|
|
height: 28px;
|
|
|
|
|
margin: 0;
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
2015-03-03 16:37:34 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
.instal-progress-bar-inner {
|
|
|
|
|
height: 28px;
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
border-top: solid 1px #52b9df;
|
|
|
|
|
background-color:#2396ce;
|
|
|
|
|
background-image:-webkit-linear-gradient(top, #27a8d7, #2396ce, #1c79c0);
|
|
|
|
|
background-image:-moz-linear-gradient(top, #27a8d7, #2396ce, #1c79c0);
|
|
|
|
|
background-image:-ms-linear-gradient(top, #27a8d7, #2396ce, #1c79c0);
|
|
|
|
|
background-image:-o-linear-gradient(top, #27a8d7, #2396ce, #1c79c0);
|
|
|
|
|
background-image:linear-gradient(top, #27a8d7, #2396ce, #1c79c0);
|
|
|
|
|
position: absolute;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
top: 1px;
|
|
|
|
|
left:0;
|
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
.instal-progress-bar-inner-text {
|
|
|
|
|
color: #fff;
|
|
|
|
|
text-shadow: 0 1px rgba(0,0,0,0.2);
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
text-align: center;
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: -2px;
|
|
|
|
|
top: -2px;
|
|
|
|
|
}
|
2018-10-04 16:28:14 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
.order-upload-button{
|
|
|
|
|
padding: 1px 13px 2px;
|
|
|
|
|
height:28px;
|
|
|
|
|
}
|
2015-03-03 16:37:34 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
.order-upload-button div{
|
|
|
|
|
float:right;
|
|
|
|
|
position:relative;
|
|
|
|
|
visible: none;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2015-03-03 16:37:34 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(document).ready(function() {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
$('#percent').width($('.instal-progress-bar-outer').width());
|
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
$(window).resize(function(){ // strechin progress bar
|
|
|
|
|
$('#percent').width($('.instal-progress-bar-outer').width());
|
|
|
|
|
});
|
2015-03-03 16:37:34 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
// orderUpload function
|
|
|
|
|
function orderUpload() {
|
|
|
|
|
|
|
|
|
|
var handlerUrl = $('#upload-orders').attr('action');
|
|
|
|
|
var step = $('input[name="step"]').val();
|
|
|
|
|
var orders = $('input[name="orders"]').val();
|
|
|
|
|
var data = 'orders=' + orders + '&step=' + step + '&ajax=2';
|
|
|
|
|
|
|
|
|
|
// ajax request
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
url: handlerUrl,
|
|
|
|
|
data: data,
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
success: function(response) {
|
|
|
|
|
$('input[name="step"]').val(response.step);
|
|
|
|
|
if(response.step == 'end'){
|
|
|
|
|
$('input[name="step"]').val(0);
|
|
|
|
|
BX.closeWait();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
orderUpload();
|
|
|
|
|
}
|
|
|
|
|
$('#indicator').css('width', response.percent + '%');
|
|
|
|
|
$('#percent').html(response.percent + '%');
|
|
|
|
|
$('#percent2').html(response.percent + '%');
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
error: function () {
|
2015-03-03 16:37:34 +03:00
|
|
|
|
BX.closeWait();
|
2020-02-18 10:54:42 +03:00
|
|
|
|
$('#status').text('<?php echo GetMessage('MESS_4'); ?>');
|
|
|
|
|
|
|
|
|
|
alert('<?php echo GetMessage('MESS_5'); ?>');
|
2015-03-03 16:37:34 +03:00
|
|
|
|
}
|
2020-02-18 10:54:42 +03:00
|
|
|
|
});
|
|
|
|
|
}
|
2015-03-03 16:37:34 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
$('input[name="start"]').live('click', function() {
|
|
|
|
|
BX.showWait();
|
|
|
|
|
$('#indicator').css('width', 0);
|
|
|
|
|
$('#percent2').html('0%');
|
|
|
|
|
orderUpload();
|
2015-03-03 16:37:34 +03:00
|
|
|
|
|
2020-02-18 10:54:42 +03:00
|
|
|
|
return false;
|
2015-03-03 16:37:34 +03:00
|
|
|
|
});
|
|
|
|
|
});
|
2020-02-18 10:54:42 +03:00
|
|
|
|
</script>
|
|
|
|
|
<br>
|
|
|
|
|
<form id="upload-orders" action="<?php echo $uri; ?>" method="POST">
|
|
|
|
|
<input type="hidden" name="step" value="0">
|
|
|
|
|
<div class="adm-detail-content-item-block">
|
|
|
|
|
<table class="adm-detail-content-table edit-table" id="edit1_edit_table">
|
|
|
|
|
<tbody>
|
2015-03-03 16:37:34 +03:00
|
|
|
|
<tr class="heading">
|
|
|
|
|
<td colspan="2"><b><?php echo GetMessage('ORDER_UPLOAD'); ?></b></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
2016-10-06 17:34:35 +03:00
|
|
|
|
<td class="adm-detail-content-cell-r"><?php echo GetMessage('ORDER_NUMBER'); ?> <input id="order-nombers" style="width:86%" type="text" value="" name="orders"></td>
|
2015-03-03 16:37:34 +03:00
|
|
|
|
</tr>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
<div class="instal-load-block" id="result">
|
|
|
|
|
<div class="instal-load-label" id="status"><?php echo GetMessage('ORDER_UPLOAD_INFO'); ?></div>
|
|
|
|
|
|
|
|
|
|
<div class="instal-progress-bar-outer">
|
|
|
|
|
<div class="instal-progress-bar-alignment" style="width: 100%;">
|
|
|
|
|
<div class="instal-progress-bar-inner" id="indicator" style="width: 0%;">
|
|
|
|
|
<div class="instal-progress-bar-inner-text" style="width: 100%;" id="percent">0%</div>
|
|
|
|
|
</div>
|
|
|
|
|
<span id="percent2">0%</span>
|
2015-03-03 16:37:34 +03:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
<br />
|
|
|
|
|
<div class="order-upload-button">
|
|
|
|
|
<div align="left">
|
|
|
|
|
<input type="submit" name="start" value="<?php echo GetMessage('ORDER_UPL_START'); ?>" class="adm-btn-save">
|
|
|
|
|
</div>
|
2015-03-03 16:37:34 +03:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-02-18 10:54:42 +03:00
|
|
|
|
</form>
|
2015-03-03 16:37:34 +03:00
|
|
|
|
<?php }?>
|