merge fix
This commit is contained in:
commit
ebbc5d2763
@ -12,6 +12,7 @@ class ICrmOrderActions
|
||||
protected static $CRM_PAYMENT = 'payment_arr'; //order payment Y/N
|
||||
protected static $CRM_ORDER_LAST_ID = 'order_last_id';
|
||||
protected static $CRM_ORDER_SITES = 'sites_ids';
|
||||
protected static $CRM_ORDER_PROPS = 'order_props';
|
||||
|
||||
/**
|
||||
* Mass order uploading, without repeating; always returns true, but writes error log
|
||||
@ -57,6 +58,7 @@ class ICrmOrderActions
|
||||
$optionsPayStatuses = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0)); // --statuses
|
||||
$optionsPayment = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT, 0));
|
||||
$optionsSites = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_SITES, 0));
|
||||
$optionsOrderProps = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_PROPS, 0));
|
||||
|
||||
$api = new IntaroCrm\RestApi($api_host, $api_key);
|
||||
|
||||
@ -66,7 +68,8 @@ class ICrmOrderActions
|
||||
'optionsPayTypes' => $optionsPayTypes,
|
||||
'optionsPayStatuses' => $optionsPayStatuses,
|
||||
'optionsPayment' => $optionsPayment,
|
||||
'optionSites' => $optionsSites
|
||||
'optionSites' => $optionsSites,
|
||||
'optionsOrderProps' => $optionsOrderProps
|
||||
);
|
||||
|
||||
//packmode
|
||||
@ -75,7 +78,9 @@ class ICrmOrderActions
|
||||
|
||||
while ($arOrder = $dbOrder->GetNext()) { // here orders by id asc
|
||||
|
||||
if(is_array($optionsSites) && !empty($optionsSites) && !in_array($arOrder['LID'], $optionsSites))
|
||||
if(is_array($optionsSites))
|
||||
if(!empty($optionsSites))
|
||||
if(!in_array($arOrder['LID'], $optionsSites))
|
||||
continue;
|
||||
|
||||
$result = self::orderCreate($arOrder, $api, $arParams);
|
||||
@ -543,24 +548,49 @@ class ICrmOrderActions
|
||||
$rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
|
||||
while ($ar = $rsOrderProps->Fetch()) {
|
||||
switch ($ar['CODE']) {
|
||||
case 'ZIP': $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']);
|
||||
case $arParams['optionsOrderProps']['index']: $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
case 'CITY': $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
case 'ADDRESS': $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']);
|
||||
case $arParams['optionsOrderProps']['text']: $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
case 'LOCATION': if(!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city']) {
|
||||
$resOrderDeliveryAddress['city'] = CSaleLocation::GetByID($ar['VALUE']);
|
||||
$resOrderDeliveryAddress['city'] = self::toJSON($resOrderDeliveryAddress['city']['CITY_NAME_LANG']);
|
||||
}
|
||||
break;
|
||||
case 'FIO': $contactNameArr = self::explodeFIO($ar['VALUE']);
|
||||
case $arParams['optionsOrderProps']['fio']: $contactNameArr = self::explodeFIO($ar['VALUE']);
|
||||
break;
|
||||
case 'PHONE': $resOrder['phone'] = $ar['VALUE'];
|
||||
case $arParams['optionsOrderProps']['phone']: $resOrder['phone'] = $ar['VALUE'];
|
||||
break;
|
||||
case 'EMAIL': $resOrder['email'] = $ar['VALUE'];
|
||||
case $arParams['optionsOrderProps']['email']: $resOrder['email'] = $ar['VALUE'];
|
||||
break;
|
||||
}
|
||||
|
||||
if (count($arParams['optionsOrderProps'] > 5)) {
|
||||
switch ($ar['CODE']) {
|
||||
/*case $arParams['optionsOrderProps']['country']: $resOrderDeliveryAddress['country'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
case $arParams['optionsOrderProps']['region']: $resOrderDeliveryAddress['region'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
case $arParams['optionsOrderProps']['city']: $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']);
|
||||
break; */
|
||||
case $arParams['optionsOrderProps']['street']: $resOrderDeliveryAddress['street'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
case $arParams['optionsOrderProps']['building']: $resOrderDeliveryAddress['building'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
case $arParams['optionsOrderProps']['flat']: $resOrderDeliveryAddress['flat'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
case $arParams['optionsOrderProps']['inercomcode']: $resOrderDeliveryAddress['intercomcode'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
case $arParams['optionsOrderProps']['floor']: $resOrderDeliveryAddress['floor'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
case $arParams['optionsOrderProps']['block']: $resOrderDeliveryAddress['block'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
case $arParams['optionsOrderProps']['house']: $resOrderDeliveryAddress['house'] = self::toJSON($ar['VALUE']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$items = array();
|
||||
@ -612,21 +642,11 @@ class ICrmOrderActions
|
||||
'items' => $items
|
||||
);
|
||||
|
||||
// parse fio
|
||||
if(count($contactNameArr) == 1) {
|
||||
$resOrder['firstName'] = $contactNameArr[0];
|
||||
} else {
|
||||
$resOrder['lastName'] = $contactNameArr['contactName'][0];
|
||||
$resOrder['firstName'] = $contactNameArr['contactName'][1];
|
||||
$resOrder['patronymic'] = $contactNameArr['contactName'][2];
|
||||
}
|
||||
|
||||
if(isset($arParams['optionsSites']) && is_array($arParams['optionsSites'])
|
||||
&& in_array($arFields['LID'], $arParams['optionsSites']))
|
||||
$resOrder['site'] = $arFields['LID'];
|
||||
|
||||
$resOrder = self::clearArr($resOrder);
|
||||
|
||||
// parse fio
|
||||
if(count($contactNameArr) == 1) {
|
||||
$resOrder['firstName'] = $contactNameArr[0];
|
||||
@ -693,13 +713,11 @@ class ICrmOrderActions
|
||||
return $APPLICATION->ConvertCharset($str, 'utf-8', SITE_CHARSET);
|
||||
}
|
||||
|
||||
|
||||
public static function explodeFIO($str) {
|
||||
if(!$str)
|
||||
return array();
|
||||
|
||||
$array = explode(" ", self::toJSON($str), 3);
|
||||
|
||||
$newArray = array();
|
||||
|
||||
foreach($array as $ar) {
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Module Install/Uninstall script
|
||||
* Module name: intaro.intarocrm
|
||||
* Class name: intaro_intarocrm
|
||||
*/
|
||||
|
||||
global $MESS;
|
||||
IncludeModuleLangFile(__FILE__);
|
||||
if (class_exists('intaro_intarocrm'))
|
||||
return;
|
||||
|
||||
class intaro_intarocrm extends CModule
|
||||
{
|
||||
class intaro_intarocrm extends CModule {
|
||||
|
||||
var $MODULE_ID = 'intaro.intarocrm';
|
||||
var $MODULE_VERSION;
|
||||
var $MODULE_VERSION_DATE;
|
||||
@ -22,7 +22,6 @@ class intaro_intarocrm extends CModule
|
||||
var $PARTNER_URI;
|
||||
var $INTARO_CRM_API;
|
||||
var $INTARO_CRM_EXPORT = 'intarocrm';
|
||||
|
||||
var $CRM_API_HOST_OPTION = 'api_host';
|
||||
var $CRM_API_KEY_OPTION = 'api_key';
|
||||
var $CRM_ORDER_TYPES_ARR = 'order_types_arr';
|
||||
@ -32,17 +31,15 @@ class intaro_intarocrm extends CModule
|
||||
var $CRM_PAYMENT = 'payment_arr'; //order payment Y/N
|
||||
var $CRM_ORDER_LAST_ID = 'order_last_id';
|
||||
var $CRM_ORDER_SITES = 'sites_ids';
|
||||
|
||||
|
||||
var $CRM_ORDER_PROPS = 'order_props';
|
||||
var $INSTALL_PATH;
|
||||
|
||||
function intaro_intarocrm()
|
||||
{
|
||||
function intaro_intarocrm() {
|
||||
$arModuleVersion = array();
|
||||
$path = str_replace("\\", "/", __FILE__);
|
||||
$path = substr($path, 0, strlen($path) - strlen("/index.php"));
|
||||
$this->INSTALL_PATH = $path;
|
||||
include($path."/version.php");
|
||||
include($path . "/version.php");
|
||||
$this->MODULE_VERSION = $arModuleVersion["VERSION"];
|
||||
$this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"];
|
||||
$this->MODULE_NAME = GetMessage('MODULE_NAME');
|
||||
@ -55,9 +52,7 @@ class intaro_intarocrm extends CModule
|
||||
* Functions DoInstall and DoUninstall are
|
||||
* All other functions are optional
|
||||
*/
|
||||
|
||||
function DoInstall()
|
||||
{
|
||||
function DoInstall() {
|
||||
global $APPLICATION, $step, $arResult;
|
||||
|
||||
if (!in_array('curl', get_loaded_extensions())) {
|
||||
@ -86,16 +81,88 @@ class intaro_intarocrm extends CModule
|
||||
|
||||
$step = intval($_REQUEST['step']);
|
||||
|
||||
$arResult['orderProps'] = array(
|
||||
array(
|
||||
'NAME' => GetMessage('FIO'),
|
||||
'ID' => 'fio'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('ZIP'),
|
||||
'ID' => 'index'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('PHONE'),
|
||||
'ID' => 'phone'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('EMAIL'),
|
||||
'ID' => 'email'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('ZIP'),
|
||||
'ID' => 'index'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('ADDRESS'),
|
||||
'ID' => 'text'
|
||||
),
|
||||
// address
|
||||
/* array(
|
||||
'NAME' => GetMessage('COUNTRY'),
|
||||
'ID' => 'country'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('REGION'),
|
||||
'ID' => 'region'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('CITY'),
|
||||
'ID' => 'city'
|
||||
), */
|
||||
array(
|
||||
'NAME' => GetMessage('ZIP'),
|
||||
'ID' => 'index'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('STREET'),
|
||||
'ID' => 'street'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('BUILDING'),
|
||||
'ID' => 'building'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('FLAT'),
|
||||
'ID' => 'flat'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('INTERCOMCODE'),
|
||||
'ID' => 'intercomcode'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('FLOOR'),
|
||||
'ID' => 'floor'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('BLOCK'),
|
||||
'ID' => 'block'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('HOUSE'),
|
||||
'ID' => 'house'
|
||||
)
|
||||
);
|
||||
|
||||
if ($step <= 1) {
|
||||
if(!CModule::IncludeModule("sale")) {
|
||||
if (!CModule::IncludeModule("sale")) {
|
||||
$arResult['errCode'] = 'ERR_SALE';
|
||||
}
|
||||
|
||||
if(!CModule::IncludeModule("iblock")) {
|
||||
if (!CModule::IncludeModule("iblock")) {
|
||||
$arResult['errCode'] = 'ERR_IBLOCK';
|
||||
}
|
||||
|
||||
if(!CModule::IncludeModule("catalog")) {
|
||||
if (!CModule::IncludeModule("catalog")) {
|
||||
$arResult['errCode'] = 'ERR_CATALOG';
|
||||
}
|
||||
|
||||
@ -105,20 +172,19 @@ class intaro_intarocrm extends CModule
|
||||
$arResult['arSites'][] = $ar;
|
||||
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step1.php'
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step1.php'
|
||||
);
|
||||
} else if ($step == 2) {
|
||||
|
||||
if(!CModule::IncludeModule("sale")) {
|
||||
if (!CModule::IncludeModule("sale")) {
|
||||
$arResult['errCode'] = 'ERR_SALE';
|
||||
}
|
||||
|
||||
if(!CModule::IncludeModule("iblock")) {
|
||||
if (!CModule::IncludeModule("iblock")) {
|
||||
$arResult['errCode'] = 'ERR_IBLOCK';
|
||||
}
|
||||
|
||||
if(!CModule::IncludeModule("catalog")) {
|
||||
if (!CModule::IncludeModule("catalog")) {
|
||||
$arResult['errCode'] = 'ERR_CATALOG';
|
||||
}
|
||||
|
||||
@ -135,8 +201,7 @@ class intaro_intarocrm extends CModule
|
||||
return;
|
||||
}
|
||||
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
|
||||
&& isset($_POST['ajax']) && ($_POST['ajax'] == 1)) {
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') && isset($_POST['ajax']) && ($_POST['ajax'] == 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);
|
||||
@ -156,19 +221,14 @@ class intaro_intarocrm extends CModule
|
||||
$arResult['paymentStatusesList'] = $this->INTARO_CRM_API->paymentStatusesList(); // --statuses
|
||||
$arResult['paymentList'] = $this->INTARO_CRM_API->orderStatusesList();
|
||||
$arResult['paymentGroupList'] = $this->INTARO_CRM_API->orderStatusGroupsList(); // -- statuses groups
|
||||
|
||||
//bitrix orderTypesList -- personTypes
|
||||
$dbOrderTypesList = CSalePersonType::GetList(
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"ACTIVE" => "Y",
|
||||
),
|
||||
false,
|
||||
false,
|
||||
array()
|
||||
), false, false, array()
|
||||
);
|
||||
|
||||
|
||||
@ -186,13 +246,9 @@ class intaro_intarocrm extends CModule
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"ACTIVE" => "Y",
|
||||
),
|
||||
false,
|
||||
false,
|
||||
array()
|
||||
), false, false, array()
|
||||
);
|
||||
|
||||
//form delivery types ids arr
|
||||
@ -209,8 +265,7 @@ class intaro_intarocrm extends CModule
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"ACTIVE" => "Y"
|
||||
)
|
||||
);
|
||||
@ -229,8 +284,7 @@ class intaro_intarocrm extends CModule
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"LID" => "ru", //ru
|
||||
"ACTIVE" => "Y"
|
||||
)
|
||||
@ -264,12 +318,12 @@ class intaro_intarocrm extends CModule
|
||||
// generate updated select inputs
|
||||
$input = array();
|
||||
|
||||
foreach($arResult['bitrixDeliveryTypesList'] as $bitrixDeliveryType) {
|
||||
foreach ($arResult['bitrixDeliveryTypesList'] as $bitrixDeliveryType) {
|
||||
$input['delivery-type-' . $bitrixDeliveryType['ID']] =
|
||||
'<select name="delivery-type-' . $bitrixDeliveryType['ID'] . '" class="typeselect">';
|
||||
$input['delivery-type-' . $bitrixDeliveryType['ID']] .= '<option value=""></option>';
|
||||
|
||||
foreach($arResult['deliveryTypesList'] as $deliveryType) {
|
||||
foreach ($arResult['deliveryTypesList'] as $deliveryType) {
|
||||
if ($deliveryTypesArr[$bitrixDeliveryType['ID']] == $deliveryType['code']) {
|
||||
$input['delivery-type-' . $bitrixDeliveryType['ID']] .=
|
||||
'<option value="' . $deliveryType['code'] . '" selected>';
|
||||
@ -286,12 +340,12 @@ class intaro_intarocrm extends CModule
|
||||
$input['delivery-type-' . $bitrixDeliveryType['ID']] .= '</select>';
|
||||
}
|
||||
|
||||
foreach($arResult['bitrixPaymentTypesList'] as $bitrixPaymentType) {
|
||||
foreach ($arResult['bitrixPaymentTypesList'] as $bitrixPaymentType) {
|
||||
$input['payment-type-' . $bitrixPaymentType['ID']] =
|
||||
'<select name="payment-type-' . $bitrixPaymentType['ID'] . '" class="typeselect">';
|
||||
$input['payment-type-' . $bitrixPaymentType['ID']] .= '<option value=""></option>';
|
||||
|
||||
foreach($arResult['paymentTypesList'] as $paymentType) {
|
||||
foreach ($arResult['paymentTypesList'] as $paymentType) {
|
||||
if ($paymentTypesArr[$bitrixPaymentType['ID']] == $paymentType['code']) {
|
||||
$input['payment-type-' . $bitrixPaymentType['ID']] .=
|
||||
'<option value="' . $paymentType['code'] . '" selected>';
|
||||
@ -308,18 +362,19 @@ class intaro_intarocrm extends CModule
|
||||
$input['payment-type-' . $bitrixPaymentType['ID']] .= '</select>';
|
||||
}
|
||||
|
||||
foreach($arResult['bitrixPaymentStatusesList'] as $bitrixPaymentStatus) {
|
||||
foreach ($arResult['bitrixPaymentStatusesList'] as $bitrixPaymentStatus) {
|
||||
$input['payment-status-' . $bitrixPaymentStatus['ID']] =
|
||||
'<select name="payment-status-' . $bitrixPaymentStatus['ID'] . '" class="typeselect">';
|
||||
$input['payment-status-' . $bitrixPaymentStatus['ID']] .= '<option value=""></option>';
|
||||
|
||||
foreach($arResult['paymentGroupList'] as $orderStatusGroup){
|
||||
if(empty($orderStatusGroup['statuses'])) continue;
|
||||
foreach ($arResult['paymentGroupList'] as $orderStatusGroup) {
|
||||
if (empty($orderStatusGroup['statuses']))
|
||||
continue;
|
||||
|
||||
$input['payment-status-' . $bitrixPaymentStatus['ID']].=
|
||||
'<optgroup label="' . $orderStatusGroup['name'] . '">';
|
||||
|
||||
foreach($orderStatusGroup['statuses'] as $payment) {
|
||||
foreach ($orderStatusGroup['statuses'] as $payment) {
|
||||
if ($paymentStatusesArr[$bitrixPaymentStatus['ID']] == $arResult['paymentList'][$payment]['code']) {
|
||||
$input['payment-status-' . $bitrixPaymentStatus['ID']] .=
|
||||
'<option value="' . $arResult['paymentList'][$payment]['code'] . '" selected>';
|
||||
@ -339,18 +394,18 @@ class intaro_intarocrm extends CModule
|
||||
$input['payment-status-' . $bitrixPaymentStatus['ID']] .= '</select>';
|
||||
}
|
||||
|
||||
foreach($arResult['bitrixPaymentList'] as $bitrixPayment) {
|
||||
foreach ($arResult['bitrixPaymentList'] as $bitrixPayment) {
|
||||
$input['payment-' . $bitrixPayment['ID']] =
|
||||
'<select name="payment-' . $bitrixPayment['ID'] . '" class="typeselect">';
|
||||
$input['payment-' . $bitrixPayment['ID']] .= '<option value=""></option>';
|
||||
|
||||
foreach($arResult['paymentStatusesList'] as $paymentStatus) {
|
||||
foreach ($arResult['paymentStatusesList'] as $paymentStatus) {
|
||||
if ($paymentArr[$bitrixPayment['ID']] == $paymentStatus['code']) {
|
||||
$input['payment-' . $bitrixPayment['ID']] .=
|
||||
'<option value="' . $paymentStatus['code'] . '" selected>';
|
||||
} else {
|
||||
$input['payment-' . $bitrixPayment['ID']] .=
|
||||
'<option value="' . $paymentStatus['code']. '">';
|
||||
'<option value="' . $paymentStatus['code'] . '">';
|
||||
}
|
||||
|
||||
$input['payment-' . $bitrixPayment['ID']] .=
|
||||
@ -361,18 +416,18 @@ class intaro_intarocrm extends CModule
|
||||
$input['payment-' . $bitrixPayment['ID']] .= '</select>';
|
||||
}
|
||||
|
||||
foreach($arResult['bitrixOrderTypesList'] as $bitrixOrderType) {
|
||||
foreach ($arResult['bitrixOrderTypesList'] as $bitrixOrderType) {
|
||||
$input['order-type-' . $bitrixOrderType['ID']] =
|
||||
'<select name="order-type-' . $bitrixOrderType['ID'] . '" class="typeselect">';
|
||||
$input['order-type-' . $bitrixOrderType['ID']] .= '<option value=""></option>';
|
||||
|
||||
foreach($arResult['orderTypesList'] as $orderType) {
|
||||
foreach ($arResult['orderTypesList'] as $orderType) {
|
||||
if ($orderTypesArr[$bitrixOrderType['ID']] == $orderType['code']) {
|
||||
$input['order-type-' . $bitrixOrderType['ID']] .=
|
||||
'<option value="' . $orderType['code'] . '" selected>';
|
||||
} else {
|
||||
$input['order-type-' . $bitrixOrderType['ID']] .=
|
||||
'<option value="' . $orderType['code']. '">';
|
||||
'<option value="' . $orderType['code'] . '">';
|
||||
}
|
||||
|
||||
$input['order-type-' . $bitrixOrderType['ID']] .=
|
||||
@ -384,7 +439,7 @@ class intaro_intarocrm extends CModule
|
||||
}
|
||||
|
||||
$APPLICATION->RestartBuffer();
|
||||
header('Content-Type: application/x-javascript; charset='.LANG_CHARSET);
|
||||
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
|
||||
die(json_encode(array("success" => true, "result" => $input)));
|
||||
}
|
||||
|
||||
@ -393,7 +448,7 @@ class intaro_intarocrm extends CModule
|
||||
|
||||
// empty == select all
|
||||
$orderSites = array();
|
||||
foreach($_POST[$this->CRM_ORDER_SITES] as $site) {
|
||||
foreach ($_POST[$this->CRM_ORDER_SITES] as $site) {
|
||||
$orderSites[] = htmlspecialchars(trim($site));
|
||||
}
|
||||
|
||||
@ -401,7 +456,7 @@ class intaro_intarocrm extends CModule
|
||||
$api_host = parse_url($api_host);
|
||||
$api_host = $api_host['scheme'] . '://' . $api_host['host'];
|
||||
|
||||
if(!$api_host || !$api_key) {
|
||||
if (!$api_host || !$api_key) {
|
||||
$arResult['errCode'] = 'ERR_FIELDS_API_HOST';
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
@ -415,7 +470,7 @@ class intaro_intarocrm extends CModule
|
||||
$this->INTARO_CRM_API->paymentStatusesList();
|
||||
|
||||
//check connection & apiKey valid
|
||||
if((int) $this->INTARO_CRM_API->getStatusCode() != 200) {
|
||||
if ((int) $this->INTARO_CRM_API->getStatusCode() != 200) {
|
||||
$arResult['errCode'] = 'ERR_' . $this->INTARO_CRM_API->getStatusCode();
|
||||
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
@ -437,19 +492,14 @@ class intaro_intarocrm extends CModule
|
||||
$arResult['paymentStatusesList'] = $this->INTARO_CRM_API->paymentStatusesList(); // --statuses
|
||||
$arResult['paymentList'] = $this->INTARO_CRM_API->orderStatusesList();
|
||||
$arResult['paymentGroupList'] = $this->INTARO_CRM_API->orderStatusGroupsList(); // -- statuses groups
|
||||
|
||||
//bitrix orderTypesList -- personTypes
|
||||
$dbOrderTypesList = CSalePersonType::GetList(
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"ACTIVE" => "Y",
|
||||
),
|
||||
false,
|
||||
false,
|
||||
array()
|
||||
), false, false, array()
|
||||
);
|
||||
|
||||
if ($arOrderTypesList = $dbOrderTypesList->Fetch()) {
|
||||
@ -463,13 +513,9 @@ class intaro_intarocrm extends CModule
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"ACTIVE" => "Y",
|
||||
),
|
||||
false,
|
||||
false,
|
||||
array()
|
||||
), false, false, array()
|
||||
);
|
||||
|
||||
if ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()) {
|
||||
@ -483,8 +529,7 @@ class intaro_intarocrm extends CModule
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"ACTIVE" => "Y"
|
||||
)
|
||||
);
|
||||
@ -500,8 +545,7 @@ class intaro_intarocrm extends CModule
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"LID" => "ru", //ru
|
||||
"ACTIVE" => "Y"
|
||||
)
|
||||
@ -522,35 +566,11 @@ class intaro_intarocrm extends CModule
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step2.php'
|
||||
);
|
||||
|
||||
} else if ($step == 3) {
|
||||
if(!CModule::IncludeModule("sale")) {
|
||||
if (!CModule::IncludeModule("sale")) {
|
||||
//handler
|
||||
}
|
||||
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
|
||||
&& isset($_POST['ajax']) && ($_POST['ajax'] == 1)) {
|
||||
ICrmOrderActions::uploadOrders(); // each 50
|
||||
|
||||
$lastUpOrderId = COption::GetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
|
||||
$countLeft = (int) CSaleOrder::GetList(array("ID" => "ASC"), array('>ID' => $lastUpOrderId), array());
|
||||
$countAll = (int) CSaleOrder::GetList(array("ID" => "ASC"), array(), array());
|
||||
|
||||
if(!isset($_POST['finish']))
|
||||
$finish = 0;
|
||||
else
|
||||
$finish = (int) $_POST['finish'];
|
||||
|
||||
$percent = round(100 - ($countLeft * 100 / $countAll), 1);
|
||||
|
||||
if(!$countLeft)
|
||||
$finish = 1;
|
||||
|
||||
$APPLICATION->RestartBuffer();
|
||||
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'),
|
||||
@ -568,20 +588,18 @@ class intaro_intarocrm extends CModule
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"ACTIVE" => "Y",
|
||||
),
|
||||
false,
|
||||
false,
|
||||
array()
|
||||
), false, false, array()
|
||||
);
|
||||
|
||||
//form order types ids arr
|
||||
$orderTypesArr = array();
|
||||
$arResult['bitrixOrderTypesList'] = array();
|
||||
if ($arOrderTypesList = $dbOrderTypesList->Fetch()) {
|
||||
do {
|
||||
$orderTypesArr[$arOrderTypesList['ID']] = htmlspecialchars(trim($_POST['order-type-' . $arOrderTypesList['ID']]));
|
||||
$arResult['bitrixOrderTypesList'][] = $arOrderTypesList;
|
||||
} while ($arOrderTypesList = $dbOrderTypesList->Fetch());
|
||||
}
|
||||
|
||||
@ -590,13 +608,9 @@ class intaro_intarocrm extends CModule
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"ACTIVE" => "Y",
|
||||
),
|
||||
false,
|
||||
false,
|
||||
array()
|
||||
), false, false, array()
|
||||
);
|
||||
|
||||
//form delivery types ids arr
|
||||
@ -641,7 +655,6 @@ class intaro_intarocrm extends CModule
|
||||
ICrmOrderActions::eventLog('install/index.php', 'IntaroCrm\RestApi::deliveryTypeEdit', $this->INTARO_CRM_API->getLastError());
|
||||
}
|
||||
}
|
||||
|
||||
} while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch());
|
||||
}
|
||||
}
|
||||
@ -651,8 +664,7 @@ class intaro_intarocrm extends CModule
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"ACTIVE" => "Y"
|
||||
)
|
||||
);
|
||||
@ -670,8 +682,7 @@ class intaro_intarocrm extends CModule
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
),
|
||||
array(
|
||||
), array(
|
||||
"LID" => "ru", //ru
|
||||
"ACTIVE" => "Y"
|
||||
)
|
||||
@ -691,6 +702,12 @@ class intaro_intarocrm extends CModule
|
||||
$paymentArr['Y'] = htmlspecialchars(trim($_POST['payment-Y']));
|
||||
$paymentArr['N'] = htmlspecialchars(trim($_POST['payment-N']));
|
||||
|
||||
//form orderProps
|
||||
$dbProp = CSaleOrderProps::GetList(array(), array());
|
||||
while ($arProp = $dbProp->GetNext()) {
|
||||
$arResult['arProp'][] = $arProp;
|
||||
}
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_TYPES_ARR, serialize($orderTypesArr));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_TYPES, serialize($paymentTypesArr));
|
||||
@ -703,32 +720,105 @@ class intaro_intarocrm extends CModule
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step3.php'
|
||||
);
|
||||
} else if ($step == 4) {
|
||||
if(!CModule::IncludeModule("iblock")) {
|
||||
$arResult['errCode'] = 'ERR_IBLOCK';
|
||||
if (!CModule::IncludeModule("sale")) {
|
||||
//handler
|
||||
}
|
||||
|
||||
if(!CModule::IncludeModule("catalog")) {
|
||||
$arResult['errCode'] = 'ERR_CATALOG';
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
|
||||
&& isset($_POST['ajax']) && ($_POST['ajax'] == 1)) {
|
||||
ICrmOrderActions::uploadOrders(); // each 50
|
||||
|
||||
$lastUpOrderId = COption::GetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
|
||||
$countLeft = (int) CSaleOrder::GetList(array("ID" => "ASC"), array('>ID' => $lastUpOrderId), array());
|
||||
$countAll = (int) CSaleOrder::GetList(array("ID" => "ASC"), array(), array());
|
||||
|
||||
if (!isset($_POST['finish']))
|
||||
$finish = 0;
|
||||
else
|
||||
$finish = (int) $_POST['finish'];
|
||||
|
||||
$percent = round(100 - ($countLeft * 100 / $countAll), 1);
|
||||
|
||||
if (!$countLeft)
|
||||
$finish = 1;
|
||||
|
||||
$APPLICATION->RestartBuffer();
|
||||
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'), $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step2.php'
|
||||
);
|
||||
}
|
||||
|
||||
//bitrix orderTypesList -- personTypes
|
||||
$dbOrderTypesList = CSalePersonType::GetList(
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
), array(
|
||||
"ACTIVE" => "Y",
|
||||
), false, false, array()
|
||||
);
|
||||
|
||||
//form order types ids arr
|
||||
$orderTypesArr = array();
|
||||
$orderTypesList = array();
|
||||
if ($arOrderTypesList = $dbOrderTypesList->Fetch()) {
|
||||
do {
|
||||
$orderTypesArr[$arOrderTypesList['ID']] = htmlspecialchars(trim($_POST['order-type-' . $arOrderTypesList['ID']]));
|
||||
$orderTypesList[] = $arOrderTypesList;
|
||||
} while ($arOrderTypesList = $dbOrderTypesList->Fetch());
|
||||
}
|
||||
|
||||
$orderPropsArr = array();
|
||||
foreach ($orderTypesList as $orderType) {
|
||||
$propsCount = 0;
|
||||
$_orderPropsArr = array();
|
||||
foreach ($arResult['orderProps'] as $orderProp) {
|
||||
if ((!(int) htmlspecialchars(trim($_POST['address-detail-' . $orderType['ID']]))) && $propsCount > 5)
|
||||
break;
|
||||
$_orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID'] . '-' . $orderType['ID']]));
|
||||
$propsCount++;
|
||||
}
|
||||
$orderPropsArr[$orderType['ID']] = $_orderPropsArr;
|
||||
}
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_PROPS, serialize($orderPropsArr));
|
||||
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step4.php'
|
||||
);
|
||||
|
||||
} else if ($step == 5) {
|
||||
|
||||
if(!CModule::IncludeModule("iblock")) {
|
||||
if (!CModule::IncludeModule("iblock")) {
|
||||
$arResult['errCode'] = 'ERR_IBLOCK';
|
||||
}
|
||||
|
||||
if(!CModule::IncludeModule("catalog")) {
|
||||
if (!CModule::IncludeModule("catalog")) {
|
||||
$arResult['errCode'] = 'ERR_CATALOG';
|
||||
}
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step5.php'
|
||||
);
|
||||
} else if ($step == 6) {
|
||||
|
||||
if (!CModule::IncludeModule("iblock")) {
|
||||
$arResult['errCode'] = 'ERR_IBLOCK';
|
||||
}
|
||||
|
||||
if (!CModule::IncludeModule("catalog")) {
|
||||
$arResult['errCode'] = 'ERR_CATALOG';
|
||||
}
|
||||
|
||||
if(isset($arResult['errCode']) && $arResult['errCode']) {
|
||||
if (isset($arResult['errCode']) && $arResult['errCode']) {
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step4.php'
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step5.php'
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -740,17 +830,17 @@ class intaro_intarocrm extends CModule
|
||||
);
|
||||
}
|
||||
|
||||
if(!isset($_POST['IBLOCK_EXPORT']))
|
||||
if (!isset($_POST['IBLOCK_EXPORT']))
|
||||
$arResult['errCode'] = 'ERR_FIELDS_IBLOCK';
|
||||
else
|
||||
$iblocks = $_POST['IBLOCK_EXPORT'];
|
||||
|
||||
if(!isset($_POST['IBLOCK_PROPERTY_ARTICLE']))
|
||||
if (!isset($_POST['IBLOCK_PROPERTY_ARTICLE']))
|
||||
$arResult['errCode'] = 'ERR_FIELDS_ARTICLE';
|
||||
else
|
||||
$articleProperties = $_POST['IBLOCK_PROPERTY_ARTICLE'];
|
||||
|
||||
if(!isset($_POST['SETUP_FILE_NAME']))
|
||||
if (!isset($_POST['SETUP_FILE_NAME']))
|
||||
$arResult['errCode'] = 'ERR_FIELDS_FILE';
|
||||
else
|
||||
$filename = $_POST['SETUP_FILE_NAME'];
|
||||
@ -759,12 +849,12 @@ class intaro_intarocrm extends CModule
|
||||
$arResult['errCode'] = 'ERR_ARTICLE_IBLOCK';
|
||||
|
||||
|
||||
if(!isset($_POST['TYPE_LOADING']))
|
||||
if (!isset($_POST['TYPE_LOADING']))
|
||||
$typeLoading = 0;
|
||||
else
|
||||
$typeLoading = $_POST['TYPE_LOADING'];
|
||||
|
||||
if(!isset($_POST['SETUP_PROFILE_NAME']) )
|
||||
if (!isset($_POST['SETUP_PROFILE_NAME']))
|
||||
$profileName = "";
|
||||
else
|
||||
$profileName = $_POST['SETUP_PROFILE_NAME'];
|
||||
@ -772,10 +862,10 @@ class intaro_intarocrm extends CModule
|
||||
if ($typeLoading != 'none' && $profileName == "")
|
||||
$arResult['errCode'] = 'ERR_FIELDS_PROFILE';
|
||||
|
||||
if($filename == "")
|
||||
if ($filename == "")
|
||||
$arResult['errCode'] = 'ERR_FIELDS_FILE';
|
||||
|
||||
if(isset($arResult['errCode']) && $arResult['errCode']) {
|
||||
if (isset($arResult['errCode']) && $arResult['errCode']) {
|
||||
|
||||
|
||||
$arOldValues = Array(
|
||||
@ -788,7 +878,7 @@ class intaro_intarocrm extends CModule
|
||||
$oldValues = $arOldValues;
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step4.php'
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step5.php'
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -804,7 +894,6 @@ class intaro_intarocrm extends CModule
|
||||
$loader->filename = $filename;
|
||||
$loader->application = $APPLICATION;
|
||||
$loader->Load();
|
||||
|
||||
}
|
||||
|
||||
if ($typeLoading == 'agent' || $typeLoading == 'cron') {
|
||||
@ -812,8 +901,8 @@ class intaro_intarocrm extends CModule
|
||||
$dbProfile = CCatalogExport::GetList(array(), array("FILE_NAME" => $this->INTARO_CRM_EXPORT));
|
||||
|
||||
while ($arProfile = $dbProfile->Fetch()) {
|
||||
if ($arProfile["DEFAULT_PROFILE"]!="Y") {
|
||||
CAgent::RemoveAgent("CCatalogExport::PreGenerateExport(".$arProfile['ID'].");", "catalog");
|
||||
if ($arProfile["DEFAULT_PROFILE"] != "Y") {
|
||||
CAgent::RemoveAgent("CCatalogExport::PreGenerateExport(" . $arProfile['ID'] . ");", "catalog");
|
||||
CCatalogExport::Delete($arProfile['ID']);
|
||||
}
|
||||
}
|
||||
@ -840,11 +929,7 @@ class intaro_intarocrm extends CModule
|
||||
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
|
||||
$dateAgent->add($intAgent);
|
||||
CAgent::AddAgent(
|
||||
"CCatalogExport::PreGenerateExport(" . $PROFILE_ID . ");",
|
||||
"catalog",
|
||||
"N",
|
||||
86400,
|
||||
$dateAgent->format('d.m.Y H:i:s'), // date of first check
|
||||
"CCatalogExport::PreGenerateExport(" . $PROFILE_ID . ");", "catalog", "N", 86400, $dateAgent->format('d.m.Y H:i:s'), // date of first check
|
||||
"Y", // агент активен
|
||||
$dateAgent->format('d.m.Y H:i:s'), // date of first start
|
||||
30
|
||||
@ -857,73 +942,65 @@ class intaro_intarocrm extends CModule
|
||||
$agent_period = 24;
|
||||
$agent_php_path = "/usr/local/php/bin/php";
|
||||
|
||||
if (!file_exists($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS."cron_frame.php"))
|
||||
{
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS);
|
||||
$tmp_file_size = filesize($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS_DEF."cron_frame.php");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS_DEF."cron_frame.php", "rb");
|
||||
if (!file_exists($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS . "cron_frame.php")) {
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS);
|
||||
$tmp_file_size = filesize($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS_DEF . "cron_frame.php");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS_DEF . "cron_frame.php", "rb");
|
||||
$tmp_data = fread($fp, $tmp_file_size);
|
||||
fclose($fp);
|
||||
|
||||
$tmp_data = str_replace("#DOCUMENT_ROOT#", $_SERVER["DOCUMENT_ROOT"], $tmp_data);
|
||||
$tmp_data = str_replace("#PHP_PATH#", $agent_php_path, $tmp_data);
|
||||
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS."cron_frame.php", "ab");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS . "cron_frame.php", "ab");
|
||||
fwrite($fp, $tmp_data);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
$cfg_data = "";
|
||||
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg"))
|
||||
{
|
||||
$cfg_file_size = filesize($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg", "rb");
|
||||
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg")) {
|
||||
$cfg_file_size = filesize($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", "rb");
|
||||
$cfg_data = fread($fp, $cfg_file_size);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS."logs/");
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS . "logs/");
|
||||
|
||||
if ($arProfile["IN_CRON"]=="Y")
|
||||
{
|
||||
if ($arProfile["IN_CRON"] == "Y") {
|
||||
// remove
|
||||
$cfg_data = preg_replace("#^.*?".preg_quote(CATALOG_PATH2EXPORTS)."cron_frame.php +".$PROFILE_ID." *>.*?$#im", "", $cfg_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$strTime = "0 */".$agent_period." * * * ";
|
||||
if (strlen($cfg_data)>0)
|
||||
$cfg_data = preg_replace("#^.*?" . preg_quote(CATALOG_PATH2EXPORTS) . "cron_frame.php +" . $PROFILE_ID . " *>.*?$#im", "", $cfg_data);
|
||||
} else {
|
||||
$strTime = "0 */" . $agent_period . " * * * ";
|
||||
if (strlen($cfg_data) > 0)
|
||||
$cfg_data .= "\n";
|
||||
|
||||
$cfg_data .= $strTime.$agent_php_path." -f ".$_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS."cron_frame.php ".$PROFILE_ID." >".$_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS."logs/".$PROFILE_ID.".txt\n";
|
||||
$cfg_data .= $strTime . $agent_php_path . " -f " . $_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS . "cron_frame.php " . $PROFILE_ID . " >" . $_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS . "logs/" . $PROFILE_ID . ".txt\n";
|
||||
}
|
||||
|
||||
CCatalogExport::Update($PROFILE_ID, array(
|
||||
"IN_CRON" => "Y"
|
||||
));
|
||||
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/");
|
||||
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/");
|
||||
$cfg_data = preg_replace("#[\r\n]{2,}#im", "\n", $cfg_data);
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg", "wb");
|
||||
$fp = fopen($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", "wb");
|
||||
fwrite($fp, $cfg_data);
|
||||
fclose($fp);
|
||||
|
||||
$arRetval = array();
|
||||
@exec("crontab ".$_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg", $arRetval, $return_var);
|
||||
|
||||
@exec("crontab " . $_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", $arRetval, $return_var);
|
||||
}
|
||||
}
|
||||
|
||||
//agents
|
||||
//agent
|
||||
|
||||
$dateAgent = new DateTime();
|
||||
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
|
||||
$dateAgent->add($intAgent);
|
||||
|
||||
CAgent::AddAgent(
|
||||
"ICrmOrderActions::uploadOrdersAgent();",
|
||||
$this->MODULE_ID,
|
||||
"N",
|
||||
600, // interval - 10 mins
|
||||
"ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID, "N", 600, // interval - 10 mins
|
||||
$dateAgent->format('d.m.Y H:i:s'), // date of first check
|
||||
"Y", // агент активен
|
||||
$dateAgent->format('d.m.Y H:i:s'), // date of first start
|
||||
@ -948,7 +1025,7 @@ class intaro_intarocrm extends CModule
|
||||
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step5.php'
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step6.php'
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -965,16 +1042,18 @@ class intaro_intarocrm extends CModule
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_LAST_ID);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_SITES);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_PROPS);
|
||||
|
||||
UnRegisterModuleDependences("sale", "OnSalePayOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSalePayOrder");
|
||||
UnRegisterModuleDependences("sale", "OnSaleCancelOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSaleCancelOrder");
|
||||
if(CModule::IncludeModule("catalog")) {
|
||||
if (CModule::IncludeModule("catalog")) {
|
||||
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/' . $this->INTARO_CRM_EXPORT . '_run.php')) {
|
||||
$dbProfile = CCatalogExport::GetList(array(), array("FILE_NAME" => $this->INTARO_CRM_EXPORT));
|
||||
|
||||
while ($arProfile = $dbProfile->Fetch()) {
|
||||
if ($arProfile["DEFAULT_PROFILE"]!="Y") {
|
||||
CAgent::RemoveAgent("CCatalogExport::PreGenerateExport(".$arProfile['ID'].");", "catalog");
|
||||
if ($arProfile["DEFAULT_PROFILE"] != "Y") {
|
||||
CAgent::RemoveAgent("CCatalogExport::PreGenerateExport(" . $arProfile['ID'] . ");", "catalog");
|
||||
CCatalogExport::Delete($arProfile['ID']);
|
||||
}
|
||||
}
|
||||
@ -986,17 +1065,13 @@ class intaro_intarocrm extends CModule
|
||||
UnRegisterModule($this->MODULE_ID);
|
||||
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_UNINSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/unstep1.php'
|
||||
GetMessage('MODULE_UNINSTALL_TITLE'), $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/unstep1.php'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function CopyFiles() {
|
||||
CopyDirFiles(
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/export/',
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/',
|
||||
true, true
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/export/', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/', true, true
|
||||
);
|
||||
}
|
||||
|
||||
@ -1011,7 +1086,6 @@ class intaro_intarocrm extends CModule
|
||||
// IBLOCK_PROPERTY_ARTICLE[0]=ARTICLE&
|
||||
// IBLOCK_PROPERTY_ARTICLE[1]=ARTNUMBER&
|
||||
// SETUP_FILE_NAME=%2Fbitrix%2Fcatalog_export%2Ftestintarocrm.xml
|
||||
|
||||
//$arProfileFields = explode(",", $SETUP_FIELDS_LIST);
|
||||
$strVars = "";
|
||||
foreach ($iblocks as $key => $val)
|
||||
@ -1023,4 +1097,5 @@ class intaro_intarocrm extends CModule
|
||||
|
||||
return $strVars;
|
||||
}
|
||||
|
||||
}
|
@ -2,168 +2,41 @@
|
||||
if (!check_bitrix_sessid())
|
||||
return;
|
||||
IncludeModuleLangFile(__FILE__);
|
||||
|
||||
$defaultOrderProps = array(
|
||||
1 => array(
|
||||
'fio' => 'FIO',
|
||||
'index' => 'ZIP',
|
||||
'text' => 'ADDRESS',
|
||||
'phone' => 'PHONE',
|
||||
'email' => 'EMAIL'
|
||||
),
|
||||
2 => array(
|
||||
'fio' => 'FIO',
|
||||
'index' => 'ZIP',
|
||||
'text' => 'ADDRESS',
|
||||
'phone' => 'PHONE',
|
||||
'email' => 'EMAIL'
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
.instal-load-block { /* */ }
|
||||
|
||||
.instal-load-label {
|
||||
color: #000;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.instal-progress-bar-alignment {
|
||||
height: 28px;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript" src="/bitrix/js/main/jquery/jquery-1.7.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var globStop = false;
|
||||
$('input.addr').change(function(){
|
||||
splitName = $(this).attr('name').split('-');
|
||||
orderType = splitName[2];
|
||||
|
||||
$('#percent').width($('.instal-progress-bar-outer').width());
|
||||
|
||||
$(window).resize(function(){ // strechin progress bar
|
||||
$('#percent').width($('.instal-progress-bar-outer').width());
|
||||
if(parseInt($(this).val()) === 1)
|
||||
$('tr.address-detail-' + orderType).show('slow');
|
||||
else if(parseInt($(this).val()) === 0)
|
||||
$('tr.address-detail-' + orderType).hide('slow');
|
||||
});
|
||||
|
||||
// orderUpload function
|
||||
function orderUpload(finish) {
|
||||
if(globStop)
|
||||
return false;
|
||||
|
||||
if(finish == 1) {
|
||||
$('#status').text('<?php echo GetMessage("MESS_3"); ?>');
|
||||
BX.closeWait();
|
||||
$('input[name="inst"]').css('opacity', '1').removeAttr('disabled');
|
||||
$('input[name="stop"]').css('opacity', '0.5').attr('disabled', 'disabled');
|
||||
$('input[name="stop"]').attr('value', '<?php echo GetMessage("START_1"); ?>');
|
||||
return true; // exit from function, end recursion
|
||||
}
|
||||
|
||||
var handlerUrl = $(this).parents('form').attr('action');
|
||||
var step = $('input[name="continue"]').val();
|
||||
var id = $('input[name="id"]').val();
|
||||
var install = $('input[name="install"]').val();
|
||||
var sessid = BX.bitrix_sessid();
|
||||
|
||||
var data = 'install=' + install +'&step=' + step + '&sessid=' + sessid +
|
||||
'&id=' + id + '&ajax=1&finish=' + finish;
|
||||
|
||||
// ajax request
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: handlerUrl,
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
$('#indicator').css('width', response.percent + '%');
|
||||
$('#percent').html(response.percent + '%');
|
||||
$('#percent2').html(response.percent + '%');
|
||||
|
||||
orderUpload(response.finish); // wait until next response
|
||||
|
||||
},
|
||||
error: function () {
|
||||
BX.closeWait();
|
||||
$('input[name="inst"]').css('opacity', '1').removeAttr('disabled');
|
||||
$('input[name="stop"]').attr('name', 'start');
|
||||
$('input[name="stop"]').attr('value', '<?php echo GetMessage("START_3"); ?>');
|
||||
$('#status').text('<?php echo GetMessage('MESS_4'); ?>');
|
||||
globStop = true;
|
||||
|
||||
alert('<?php echo GetMessage('MESS_5'); ?>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('input[name="start"]').live('click', function() {
|
||||
BX.showWait();
|
||||
|
||||
$(this).attr('name', 'stop');
|
||||
$(this).attr('value', '<?php echo GetMessage("START_2"); ?>');
|
||||
$('#status').text('<?php echo GetMessage('MESS_2'); ?>');
|
||||
|
||||
if(globStop)
|
||||
globStop = false;
|
||||
|
||||
// hide next step button
|
||||
$('input[name="inst"]').css('opacity', '0.5').attr('disabled', 'disabled');
|
||||
|
||||
orderUpload(0);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('input[name="stop"]').live('click', function() {
|
||||
BX.closeWait();
|
||||
|
||||
// show next step button
|
||||
$('input[name="inst"]').css('opacity', '1').removeAttr('disabled');
|
||||
|
||||
$(this).attr('name', 'start');
|
||||
$(this).attr('value', '<?php echo GetMessage("START_3"); ?>');
|
||||
$('#status').text('<?php echo GetMessage('MESS_4'); ?>');
|
||||
globStop = true;
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="adm-detail-content-item-block">
|
||||
<form action="<?php echo $APPLICATION->GetCurPage() ?>" method="POST">
|
||||
<?php echo bitrix_sessid_post(); ?>
|
||||
<input type="hidden" name="lang" value="<?php echo LANGUAGE_ID ?>">
|
||||
@ -171,33 +44,61 @@ IncludeModuleLangFile(__FILE__);
|
||||
<input type="hidden" name="install" value="Y">
|
||||
<input type="hidden" name="step" value="4">
|
||||
<input type="hidden" name="continue" value="3">
|
||||
<div class="adm-detail-content-item-block">
|
||||
|
||||
<table class="adm-detail-content-table edit-table" id="edit1_edit_table">
|
||||
<tbody>
|
||||
<tr class="heading">
|
||||
<td colspan="2"><b><?php echo GetMessage('STEP_NAME'); ?></b></td>
|
||||
</tr>
|
||||
<tr class="heading">
|
||||
<td colspan="2"><b><?php echo GetMessage('ORDER_PROPS'); ?></b></td>
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<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 $bitrixOrderType['NAME']; ?></b></td>
|
||||
</tr>
|
||||
|
||||
<?php $countProps = 0; foreach($arResult['orderProps'] as $orderProp): ?>
|
||||
<?php if($orderProp['ID'] == 'text'): ?>
|
||||
<tr class="heading">
|
||||
<td colspan="2">
|
||||
<b>
|
||||
<label><input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID'];; ?>" value="0" <?php if(count($defaultOrderProps[$bitrixOrderType['ID']]) < 6) 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(count($defaultOrderProps[$bitrixOrderType['ID']]) > 5) echo "checked"; ?>><?php echo GetMessage('ADDRESS_FULL'); ?></label>
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr <?php if ($countProps > 5) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 5) && (count($defaultOrderProps[$bitrixOrderType['ID']]) < 6)) 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'] as $arProp): ?>
|
||||
<option value="<?php echo $arProp['CODE']; ?>" <?php if ($defaultOrderProps[$bitrixOrderType['ID']][$orderProp['ID']] == $arProp['CODE']) echo 'selected'; ?>>
|
||||
<?php echo $arProp['NAME']; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $countProps++; endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="instal-load-block" id="result">
|
||||
<div class="instal-load-label" id="status"><?php echo GetMessage('MESS_1'); ?></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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div style="padding: 1px 13px 2px; height:28px;">
|
||||
<div align="right" style="float:right; width:50%; position:relative;">
|
||||
<input type="submit" name="inst" value="<?php echo GetMessage("MOD_NEXT_STEP"); ?>" class="adm-btn-save">
|
||||
</div>
|
||||
<div align="left" style="float:right; width:50%; position:relative; visible: none;">
|
||||
<input type="submit" name="start" value="<?php echo GetMessage("START_1"); ?>" class="adm-btn-save">
|
||||
</div>
|
||||
<input type="submit" name="start" value="<?php echo GetMessage("MOD_PREV_STEP"); ?>" class="adm-btn-save">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -1,263 +1,203 @@
|
||||
<?php
|
||||
|
||||
if(!check_bitrix_sessid()) return;
|
||||
if (!check_bitrix_sessid())
|
||||
return;
|
||||
IncludeModuleLangFile(__FILE__);
|
||||
__IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.intarocrm/lang/", "/icml_export_setup.php"));
|
||||
?>
|
||||
<h3><?=GetMessage("EXPORT_CATALOGS_INFO");?></h3>
|
||||
<?php
|
||||
if(isset($arResult['errCode']) && $arResult['errCode'])
|
||||
echo CAdminMessage::ShowMessage(GetMessage($arResult['errCode']));
|
||||
global $oldValues;
|
||||
if (!empty($oldValues)) {
|
||||
$IBLOCK_EXPORT = $oldValues['IBLOCK_EXPORT'];
|
||||
$IBLOCK_PROPERTY_ARTICLE = $oldValues['IBLOCK_PROPERTY_ARTICLE'];
|
||||
$SETUP_FILE_NAME = $oldValues['SETUP_FILE_NAME'];
|
||||
$SETUP_PROFILE_NAME = $oldValues['SETUP_PROFILE_NAME'];
|
||||
}
|
||||
?>
|
||||
<form method="post" action="<?php echo $APPLICATION->GetCurPage(); ?>" >
|
||||
<font class="text"><?=GetMessage("EXPORT_CATALOGS");?><br><br></font>
|
||||
<?
|
||||
if (!isset($IBLOCK_EXPORT) || !is_array($IBLOCK_EXPORT))
|
||||
{
|
||||
$IBLOCK_EXPORT = array();
|
||||
|
||||
<style type="text/css">
|
||||
.instal-load-block { /* */ }
|
||||
|
||||
.instal-load-label {
|
||||
color: #000;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
$boolAll = false;
|
||||
$intCountChecked = 0;
|
||||
$intCountAvailIBlock = 0;
|
||||
$arIBlockList = array();
|
||||
$db_res = CIBlock::GetList(Array("IBLOCK_TYPE"=>"ASC", "NAME"=>"ASC"),array('CHECK_PERMISSIONS' => 'Y','MIN_PERMISSION' => 'W'));
|
||||
while ($res = $db_res->Fetch())
|
||||
{
|
||||
if ($arCatalog = CCatalog::GetByIDExt($res["ID"]))
|
||||
{
|
||||
if($arCatalog['CATALOG_TYPE'] == "D" || $arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
|
||||
{
|
||||
$arSiteList = array();
|
||||
$rsSites = CIBlock::GetSite($res["ID"]);
|
||||
while ($arSite = $rsSites->Fetch())
|
||||
{
|
||||
$arSiteList[] = $arSite["SITE_ID"];
|
||||
}
|
||||
$db_properties = CIBlock::GetProperties($res['ID'], Array());
|
||||
|
||||
$properties = Array();
|
||||
while($prop = $db_properties->Fetch())
|
||||
$properties[] = $prop;
|
||||
|
||||
if (count($IBLOCK_EXPORT) != 0)
|
||||
$boolExport = (in_array($res['ID'], $IBLOCK_EXPORT));
|
||||
else
|
||||
$boolExport = true;
|
||||
|
||||
$arIBlockList[] = array(
|
||||
'ID' => $res['ID'],
|
||||
'NAME' => $res['NAME'],
|
||||
'IBLOCK_TYPE_ID' => $res['IBLOCK_TYPE_ID'],
|
||||
'IBLOCK_EXPORT' => $boolExport,
|
||||
'PROPERTIES' => $properties,
|
||||
'OLD_PROPERTY_SELECT' => $IBLOCK_PROPERTY_ARTICLE[$res['ID']] != "" ? $IBLOCK_PROPERTY_ARTICLE[$res['ID']] : null,
|
||||
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
||||
);
|
||||
|
||||
if ($boolExport)
|
||||
$intCountChecked++;
|
||||
$intCountAvailIBlock++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($IBLOCK_EXPORT) != 0) {
|
||||
if ($intCountChecked == $intCountAvailIBlock)
|
||||
$boolAll = true;
|
||||
} else {
|
||||
$intCountChecked = $intCountAvailIBlock;
|
||||
$boolAll = true;
|
||||
.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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<table class="adm-list-table" id="export_setup">
|
||||
<thead>
|
||||
<tr class="adm-list-table-header">
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner"><?echo GetMessage("CATALOG");?></div>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner">
|
||||
<?echo GetMessage("EXPORT2INTAROCML");?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner"><?echo GetMessage("PROPERTY");?></div>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="adm-list-table-row">
|
||||
<td class="adm-list-table-cell">
|
||||
<?echo GetMessage("ALL_CATALOG");?>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<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' : ''); ?>>
|
||||
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
foreach ($arIBlockList as $key => $arIBlock)
|
||||
{
|
||||
?>
|
||||
<tr class="adm-list-table-row">
|
||||
<td class="adm-list-table-cell" style="padding-left: 5em">
|
||||
<? echo htmlspecialcharsex("[".$arIBlock["IBLOCK_TYPE_ID"]."] ".$arIBlock["NAME"]." ".$arIBlock['SITE_LIST']); ?>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<font class="tablebodytext">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="IBLOCK_EXPORT[<?=$arIBlock["ID"]?>]"
|
||||
id="IBLOCK_EXPORT<?=$arIBlock["ID"]?>"
|
||||
value="<?=$arIBlock["ID"]?>"
|
||||
<? if ($arIBlock['IBLOCK_EXPORT']) echo " checked"; ?>
|
||||
onclick="checkOne(this,<? echo $intCountAvailIBlock; ?>);"
|
||||
>
|
||||
</font>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<select
|
||||
style="width: 200px;"
|
||||
id="IBLOCK_PROPERTY_ARTICLE<?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_ARTICLE[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export">
|
||||
<option value=""></option>
|
||||
<?
|
||||
foreach ($arIBlock['PROPERTIES'] as $prop)
|
||||
{
|
||||
?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($arIBlock['OLD_PROPERTY_SELECT'] == $prop["CODE"]){
|
||||
echo " selected";
|
||||
} else {
|
||||
if ($prop["CODE"] == "ARTICLE" ||
|
||||
$prop["CODE"] == "ART" ||
|
||||
$prop["CODE"] == "ARTNUMBER" )
|
||||
echo " selected";
|
||||
.instal-progress-bar-alignment {
|
||||
height: 28px;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<?
|
||||
.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;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
|
||||
.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;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="hidden" name="count_checked" id="count_checked" value="<? echo $intCountChecked; ?>">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</style>
|
||||
|
||||
<font class="text"><?=GetMessage("FILENAME");?><br><br></font>
|
||||
<input type="text" name="SETUP_FILE_NAME"
|
||||
value="<?=htmlspecialcharsbx(strlen($SETUP_FILE_NAME) > 0 ?
|
||||
$SETUP_FILE_NAME :
|
||||
(COption::GetOptionString(
|
||||
'catalog',
|
||||
'export_default_path',
|
||||
'/bitrix/catalog_export/'))
|
||||
.'intarocrm'/* .mt_rand(0, 999999) */.'.xml'
|
||||
); ?>" size="50">
|
||||
<script type="text/javascript" src="/bitrix/js/main/jquery/jquery-1.7.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var globStop = false;
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
$('#percent').width($('.instal-progress-bar-outer').width());
|
||||
|
||||
<font class="text"><?=GetMessage("LOAD_PERIOD");?><br><br></font>
|
||||
<input type="radio" name="TYPE_LOADING" value="none" onclick="checkProfile(this);"><?=GetMessage("NOT_LOADING");?><Br>
|
||||
<input type="radio" name="TYPE_LOADING" value="cron" onclick="checkProfile(this);"><?=GetMessage("CRON_LOADING");?><Br>
|
||||
<input type="radio" name="TYPE_LOADING" value="agent" checked onclick="checkProfile(this);"><?=GetMessage("AGENT_LOADING");?><Br>
|
||||
<br>
|
||||
<br>
|
||||
<font class="text"><?=GetMessage("LOAD_NOW");?> </font>
|
||||
<input id="load-now" type="checkbox" name="LOAD_NOW" value="now" checked >
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
$(window).resize(function(){ // strechin progress bar
|
||||
$('#percent').width($('.instal-progress-bar-outer').width());
|
||||
});
|
||||
|
||||
<div id="profile-field" >
|
||||
<font class="text"><?=GetMessage("PROFILE_NAME");?> </font>
|
||||
<input
|
||||
type="text"
|
||||
name="SETUP_PROFILE_NAME"
|
||||
value="<?= ($SETUP_PROFILE_NAME ? $SETUP_PROFILE_NAME: GetMessage("PROFILE_NAME_EXAMPLE"));?>"
|
||||
size="30">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
// orderUpload function
|
||||
function orderUpload(finish) {
|
||||
if(globStop)
|
||||
return false;
|
||||
|
||||
<script type="text/javascript" src="/bitrix/js/main/jquery/jquery-1.7.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function checkAll(obj,cnt)
|
||||
{
|
||||
var boolCheck = obj.checked;
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
BX('IBLOCK_EXPORT'+i).checked = boolCheck;
|
||||
if(finish == 1) {
|
||||
$('#status').text('<?php echo GetMessage("MESS_3"); ?>');
|
||||
BX.closeWait();
|
||||
$('input[name="inst"]').css('opacity', '1').removeAttr('disabled');
|
||||
$('input[name="stop"]').css('opacity', '0.5').attr('disabled', 'disabled');
|
||||
$('input[name="stop"]').attr('value', '<?php echo GetMessage("START_1"); ?>');
|
||||
return true; // exit from function, end recursion
|
||||
}
|
||||
BX('count_checked').value = (boolCheck ? cnt : 0);
|
||||
};
|
||||
function checkOne(obj,cnt)
|
||||
{
|
||||
var boolCheck = obj.checked;
|
||||
var intCurrent = parseInt(BX('count_checked').value);
|
||||
intCurrent += (boolCheck ? 1 : -1);
|
||||
BX('icml_export_all').checked = (intCurrent < cnt ? false : true);
|
||||
BX('count_checked').value = intCurrent;
|
||||
if (!boolCheck)
|
||||
BX(obj.id.replace('IBLOCK_EXPORT','IBLOCK_PROPERTY_ARTICLE')).value = 'none';
|
||||
};
|
||||
function checkProfile(obj)
|
||||
{
|
||||
if (obj.value !== 'none')
|
||||
$('#profile-field').show();
|
||||
else
|
||||
$('#profile-field').hide();
|
||||
};
|
||||
</script>
|
||||
|
||||
var handlerUrl = $(this).parents('form').attr('action');
|
||||
var step = $('input[name="continue"]').val();
|
||||
var id = $('input[name="id"]').val();
|
||||
var install = $('input[name="install"]').val();
|
||||
var sessid = BX.bitrix_sessid();
|
||||
|
||||
<?//Следующие переменные должны быть обязательно установлены?>
|
||||
<?=bitrix_sessid_post();?>
|
||||
var data = 'install=' + install +'&step=' + step + '&sessid=' + sessid +
|
||||
'&id=' + id + '&ajax=1&finish=' + finish;
|
||||
|
||||
<input type="hidden" name="lang" value="<?php echo LANG; ?>">
|
||||
// ajax request
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: handlerUrl,
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
$('#indicator').css('width', response.percent + '%');
|
||||
$('#percent').html(response.percent + '%');
|
||||
$('#percent2').html(response.percent + '%');
|
||||
|
||||
orderUpload(response.finish); // wait until next response
|
||||
|
||||
},
|
||||
error: function () {
|
||||
BX.closeWait();
|
||||
$('input[name="inst"]').css('opacity', '1').removeAttr('disabled');
|
||||
$('input[name="stop"]').attr('name', 'start');
|
||||
$('input[name="stop"]').attr('value', '<?php echo GetMessage("START_3"); ?>');
|
||||
$('#status').text('<?php echo GetMessage('MESS_4'); ?>');
|
||||
globStop = true;
|
||||
|
||||
alert('<?php echo GetMessage('MESS_5'); ?>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('input[name="start"]').live('click', function() {
|
||||
BX.showWait();
|
||||
|
||||
$(this).attr('name', 'stop');
|
||||
$(this).attr('value', '<?php echo GetMessage("START_2"); ?>');
|
||||
$('#status').text('<?php echo GetMessage('MESS_2'); ?>');
|
||||
|
||||
if(globStop)
|
||||
globStop = false;
|
||||
|
||||
// hide next step button
|
||||
$('input[name="inst"]').css('opacity', '0.5').attr('disabled', 'disabled');
|
||||
|
||||
orderUpload(0);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('input[name="stop"]').live('click', function() {
|
||||
BX.closeWait();
|
||||
|
||||
// show next step button
|
||||
$('input[name="inst"]').css('opacity', '1').removeAttr('disabled');
|
||||
|
||||
$(this).attr('name', 'start');
|
||||
$(this).attr('value', '<?php echo GetMessage("START_3"); ?>');
|
||||
$('#status').text('<?php echo GetMessage('MESS_4'); ?>');
|
||||
globStop = true;
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<form action="<?php echo $APPLICATION->GetCurPage() ?>" method="POST">
|
||||
<?php echo bitrix_sessid_post(); ?>
|
||||
<input type="hidden" name="lang" value="<?php echo LANGUAGE_ID ?>">
|
||||
<input type="hidden" name="id" value="intaro.intarocrm">
|
||||
<input type="hidden" name="install" value="Y">
|
||||
<input type="hidden" name="step" value="5">
|
||||
<input type="hidden" name="continue" value="4">
|
||||
<div class="adm-detail-content-item-block">
|
||||
<table class="adm-detail-content-table edit-table" id="edit1_edit_table">
|
||||
<tbody>
|
||||
<tr class="heading">
|
||||
<td colspan="2"><b><?php echo GetMessage('STEP_NAME'); ?></b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="instal-load-block" id="result">
|
||||
<div class="instal-load-label" id="status"><?php echo GetMessage('MESS_1'); ?></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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div style="padding: 1px 13px 2px; height:28px;">
|
||||
<div align="right" style="float:right; width:50%; position:relative;">
|
||||
<input type="submit" name="inst" value="<?php echo GetMessage("MOD_NEXT_STEP"); ?>" class="adm-btn-save">
|
||||
</div>
|
||||
<div align="left" style="float:right; width:50%; position:relative;">
|
||||
<input type="submit" name="back" value="<?php echo GetMessage("MOD_PREV_STEP"); ?>" class="adm-btn-save">
|
||||
<div align="left" style="float:right; width:50%; position:relative; visible: none;">
|
||||
<input type="submit" name="start" value="<?php echo GetMessage("START_1"); ?>" class="adm-btn-save">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
@ -1,11 +1,263 @@
|
||||
<?php
|
||||
if(!check_bitrix_sessid()) return;
|
||||
echo CAdminMessage::ShowNote(GetMessage("MOD_INST_OK"));
|
||||
echo GetMessage("INTAROCRM_INFO"); ?>
|
||||
|
||||
<form action="<?php echo $APPLICATION->GetCurPage(); ?>">
|
||||
if(!check_bitrix_sessid()) return;
|
||||
IncludeModuleLangFile(__FILE__);
|
||||
__IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.intarocrm/lang/", "/icml_export_setup.php"));
|
||||
?>
|
||||
<h3><?=GetMessage("EXPORT_CATALOGS_INFO");?></h3>
|
||||
<?php
|
||||
if(isset($arResult['errCode']) && $arResult['errCode'])
|
||||
echo CAdminMessage::ShowMessage(GetMessage($arResult['errCode']));
|
||||
global $oldValues;
|
||||
if (!empty($oldValues)) {
|
||||
$IBLOCK_EXPORT = $oldValues['IBLOCK_EXPORT'];
|
||||
$IBLOCK_PROPERTY_ARTICLE = $oldValues['IBLOCK_PROPERTY_ARTICLE'];
|
||||
$SETUP_FILE_NAME = $oldValues['SETUP_FILE_NAME'];
|
||||
$SETUP_PROFILE_NAME = $oldValues['SETUP_PROFILE_NAME'];
|
||||
}
|
||||
?>
|
||||
<form method="post" action="<?php echo $APPLICATION->GetCurPage(); ?>" >
|
||||
<font class="text"><?=GetMessage("EXPORT_CATALOGS");?><br><br></font>
|
||||
<?
|
||||
if (!isset($IBLOCK_EXPORT) || !is_array($IBLOCK_EXPORT))
|
||||
{
|
||||
$IBLOCK_EXPORT = array();
|
||||
}
|
||||
|
||||
$boolAll = false;
|
||||
$intCountChecked = 0;
|
||||
$intCountAvailIBlock = 0;
|
||||
$arIBlockList = array();
|
||||
$db_res = CIBlock::GetList(Array("IBLOCK_TYPE"=>"ASC", "NAME"=>"ASC"),array('CHECK_PERMISSIONS' => 'Y','MIN_PERMISSION' => 'W'));
|
||||
while ($res = $db_res->Fetch())
|
||||
{
|
||||
if ($arCatalog = CCatalog::GetByIDExt($res["ID"]))
|
||||
{
|
||||
if($arCatalog['CATALOG_TYPE'] == "D" || $arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
|
||||
{
|
||||
$arSiteList = array();
|
||||
$rsSites = CIBlock::GetSite($res["ID"]);
|
||||
while ($arSite = $rsSites->Fetch())
|
||||
{
|
||||
$arSiteList[] = $arSite["SITE_ID"];
|
||||
}
|
||||
$db_properties = CIBlock::GetProperties($res['ID'], Array());
|
||||
|
||||
$properties = Array();
|
||||
while($prop = $db_properties->Fetch())
|
||||
$properties[] = $prop;
|
||||
|
||||
if (count($IBLOCK_EXPORT) != 0)
|
||||
$boolExport = (in_array($res['ID'], $IBLOCK_EXPORT));
|
||||
else
|
||||
$boolExport = true;
|
||||
|
||||
$arIBlockList[] = array(
|
||||
'ID' => $res['ID'],
|
||||
'NAME' => $res['NAME'],
|
||||
'IBLOCK_TYPE_ID' => $res['IBLOCK_TYPE_ID'],
|
||||
'IBLOCK_EXPORT' => $boolExport,
|
||||
'PROPERTIES' => $properties,
|
||||
'OLD_PROPERTY_SELECT' => $IBLOCK_PROPERTY_ARTICLE[$res['ID']] != "" ? $IBLOCK_PROPERTY_ARTICLE[$res['ID']] : null,
|
||||
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
||||
);
|
||||
|
||||
if ($boolExport)
|
||||
$intCountChecked++;
|
||||
$intCountAvailIBlock++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($IBLOCK_EXPORT) != 0) {
|
||||
if ($intCountChecked == $intCountAvailIBlock)
|
||||
$boolAll = true;
|
||||
} else {
|
||||
$intCountChecked = $intCountAvailIBlock;
|
||||
$boolAll = true;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<table class="adm-list-table" id="export_setup">
|
||||
<thead>
|
||||
<tr class="adm-list-table-header">
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner"><?echo GetMessage("CATALOG");?></div>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner">
|
||||
<?echo GetMessage("EXPORT2INTAROCML");?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner"><?echo GetMessage("PROPERTY");?></div>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="adm-list-table-row">
|
||||
<td class="adm-list-table-cell">
|
||||
<?echo GetMessage("ALL_CATALOG");?>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<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' : ''); ?>>
|
||||
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
foreach ($arIBlockList as $key => $arIBlock)
|
||||
{
|
||||
?>
|
||||
<tr class="adm-list-table-row">
|
||||
<td class="adm-list-table-cell" style="padding-left: 5em">
|
||||
<? echo htmlspecialcharsex("[".$arIBlock["IBLOCK_TYPE_ID"]."] ".$arIBlock["NAME"]." ".$arIBlock['SITE_LIST']); ?>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<font class="tablebodytext">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="IBLOCK_EXPORT[<?=$arIBlock["ID"]?>]"
|
||||
id="IBLOCK_EXPORT<?=$arIBlock["ID"]?>"
|
||||
value="<?=$arIBlock["ID"]?>"
|
||||
<? if ($arIBlock['IBLOCK_EXPORT']) echo " checked"; ?>
|
||||
onclick="checkOne(this,<? echo $intCountAvailIBlock; ?>);"
|
||||
>
|
||||
</font>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<select
|
||||
style="width: 200px;"
|
||||
id="IBLOCK_PROPERTY_ARTICLE<?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_ARTICLE[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export">
|
||||
<option value=""></option>
|
||||
<?
|
||||
foreach ($arIBlock['PROPERTIES'] as $prop)
|
||||
{
|
||||
?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($arIBlock['OLD_PROPERTY_SELECT'] == $prop["CODE"]){
|
||||
echo " selected";
|
||||
} else {
|
||||
if ($prop["CODE"] == "ARTICLE" ||
|
||||
$prop["CODE"] == "ART" ||
|
||||
$prop["CODE"] == "ARTNUMBER" )
|
||||
echo " selected";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="hidden" name="count_checked" id="count_checked" value="<? echo $intCountChecked; ?>">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<font class="text"><?=GetMessage("FILENAME");?><br><br></font>
|
||||
<input type="text" name="SETUP_FILE_NAME"
|
||||
value="<?=htmlspecialcharsbx(strlen($SETUP_FILE_NAME) > 0 ?
|
||||
$SETUP_FILE_NAME :
|
||||
(COption::GetOptionString(
|
||||
'catalog',
|
||||
'export_default_path',
|
||||
'/bitrix/catalog_export/'))
|
||||
.'intarocrm'/* .mt_rand(0, 999999) */.'.xml'
|
||||
); ?>" size="50">
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<font class="text"><?=GetMessage("LOAD_PERIOD");?><br><br></font>
|
||||
<input type="radio" name="TYPE_LOADING" value="none" onclick="checkProfile(this);"><?=GetMessage("NOT_LOADING");?><Br>
|
||||
<input type="radio" name="TYPE_LOADING" value="cron" onclick="checkProfile(this);"><?=GetMessage("CRON_LOADING");?><Br>
|
||||
<input type="radio" name="TYPE_LOADING" value="agent" checked onclick="checkProfile(this);"><?=GetMessage("AGENT_LOADING");?><Br>
|
||||
<br>
|
||||
<br>
|
||||
<font class="text"><?=GetMessage("LOAD_NOW");?> </font>
|
||||
<input id="load-now" type="checkbox" name="LOAD_NOW" value="now" checked >
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div id="profile-field" >
|
||||
<font class="text"><?=GetMessage("PROFILE_NAME");?> </font>
|
||||
<input
|
||||
type="text"
|
||||
name="SETUP_PROFILE_NAME"
|
||||
value="<?= ($SETUP_PROFILE_NAME ? $SETUP_PROFILE_NAME: GetMessage("PROFILE_NAME_EXAMPLE"));?>"
|
||||
size="30">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/bitrix/js/main/jquery/jquery-1.7.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function checkAll(obj,cnt)
|
||||
{
|
||||
var boolCheck = obj.checked;
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
BX('IBLOCK_EXPORT'+i).checked = boolCheck;
|
||||
}
|
||||
BX('count_checked').value = (boolCheck ? cnt : 0);
|
||||
};
|
||||
function checkOne(obj,cnt)
|
||||
{
|
||||
var boolCheck = obj.checked;
|
||||
var intCurrent = parseInt(BX('count_checked').value);
|
||||
intCurrent += (boolCheck ? 1 : -1);
|
||||
BX('icml_export_all').checked = (intCurrent < cnt ? false : true);
|
||||
BX('count_checked').value = intCurrent;
|
||||
if (!boolCheck)
|
||||
BX(obj.id.replace('IBLOCK_EXPORT','IBLOCK_PROPERTY_ARTICLE')).value = 'none';
|
||||
};
|
||||
function checkProfile(obj)
|
||||
{
|
||||
if (obj.value !== 'none')
|
||||
$('#profile-field').show();
|
||||
else
|
||||
$('#profile-field').hide();
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<?//Следующие переменные должны быть обязательно установлены?>
|
||||
<?=bitrix_sessid_post();?>
|
||||
|
||||
<input type="hidden" name="lang" value="<?php echo LANG; ?>">
|
||||
<input type="hidden" name="id" value="intaro.intarocrm">
|
||||
<input type="hidden" name="install" value="Y">
|
||||
<input type="submit" name="" value="<?php echo GetMessage("MOD_BACK"); ?>">
|
||||
<form>
|
||||
<input type="hidden" name="step" value="6">
|
||||
<input type="hidden" name="continue" value="5">
|
||||
<div style="padding: 1px 13px 2px; height:28px;">
|
||||
<div align="right" style="float:right; width:50%; position:relative;">
|
||||
<input type="submit" name="inst" value="<?php echo GetMessage("MOD_NEXT_STEP"); ?>" class="adm-btn-save">
|
||||
</div>
|
||||
<div align="left" style="float:right; width:50%; position:relative;">
|
||||
<input type="submit" name="back" value="<?php echo GetMessage("MOD_PREV_STEP"); ?>" class="adm-btn-save">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
11
intaro.intarocrm/install/step6.php
Normal file
11
intaro.intarocrm/install/step6.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
if(!check_bitrix_sessid()) return;
|
||||
echo CAdminMessage::ShowNote(GetMessage("MOD_INST_OK"));
|
||||
echo GetMessage("INTAROCRM_INFO"); ?>
|
||||
|
||||
<form action="<?php echo $APPLICATION->GetCurPage(); ?>">
|
||||
<input type="hidden" name="lang" value="<?php echo LANG; ?>">
|
||||
<input type="hidden" name="id" value="intaro.intarocrm">
|
||||
<input type="hidden" name="install" value="Y">
|
||||
<input type="submit" name="" value="<?php echo GetMessage("MOD_BACK"); ?>">
|
||||
<form>
|
@ -13,3 +13,22 @@ $MESS ['ERR_CATALOG'] = 'Отсутствует модуль catalog! Дальн
|
||||
$MESS ['INTAROCRM_CURL_ERR'] = 'Для работы модуля интеграции с IntaroCRM требуется PHP-расширение CURL.';
|
||||
$MESS ['ERR_ARTICLE_IBLOCK'] = 'Не установлены артикулы';
|
||||
$MESS ['DATE_TIMEZONE_ERR'] = 'Не указана временная зона в настройках php.';
|
||||
|
||||
$MESS ['ORDER_PROPS'] = 'Настройки соответствия полей заказа IntaroCRM свойствам заказа 1С-Битрикс';
|
||||
$MESS ['FIO'] = 'ф.И.О.';
|
||||
$MESS ['ZIP'] = 'Индекс';
|
||||
$MESS ['ADDRESS'] = 'Адрес (строкой)';
|
||||
$MESS ['PHONE'] = 'Телефон';
|
||||
$MESS ['EMAIL'] = 'E-mail';
|
||||
$MESS ['COUNTRY'] = 'Страна';
|
||||
$MESS ['REGION'] = 'Область / Край';
|
||||
$MESS ['CITY'] = 'Город';
|
||||
$MESS ['STREET'] = 'Улица';
|
||||
$MESS ['BUILDING'] = 'Строение';
|
||||
$MESS ['FLAT'] = 'Квартира';
|
||||
$MESS ['INTERCOMCODE'] = 'Домофон';
|
||||
$MESS ['FLOOR'] = 'Этаж';
|
||||
$MESS ['BLOCK'] = 'Подъезд';
|
||||
$MESS ['HOUSE'] = 'Строение / корпус';
|
||||
$MESS ['ADDRESS_SHORT'] = 'Краткий адрес';
|
||||
$MESS ['ADDRESS_FULL'] = 'Детальный адрес';
|
@ -10,3 +10,24 @@ $MESS ['START_1'] = 'Начать выгрузку';
|
||||
$MESS ['START_2'] = 'Приостановить выгрузку';
|
||||
$MESS ['START_3'] = 'Возобновить выгрузку';
|
||||
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
|
||||
$MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг';
|
||||
$MESS ['INFO_2'] = ' Задайте соответствие между полями заказа 1C-Битрикс и IntaroCRM.';
|
||||
|
||||
$MESS ['ORDER_PROPS'] = 'Настройки соответствия полей заказа IntaroCRM свойствам заказа 1С-Битрикс';
|
||||
$MESS ['FIO'] = 'Ф.И.О.';
|
||||
$MESS ['ZIP'] = 'Индекс';
|
||||
$MESS ['ADDRESS'] = 'Адрес (строкой)';
|
||||
$MESS ['PHONE'] = 'Телефон';
|
||||
$MESS ['EMAIL'] = 'E-mail';
|
||||
$MESS ['COUNTRY'] = 'Страна';
|
||||
$MESS ['REGION'] = 'Область / Край';
|
||||
$MESS ['CITY'] = 'Город';
|
||||
$MESS ['STREET'] = 'Улица';
|
||||
$MESS ['BUILDING'] = 'Строение';
|
||||
$MESS ['FLAT'] = 'Квартира';
|
||||
$MESS ['INTERCOMCODE'] = 'Домофон';
|
||||
$MESS ['FLOOR'] = 'Этаж';
|
||||
$MESS ['BLOCK'] = 'Подъезд';
|
||||
$MESS ['HOUSE'] = 'Строение / корпус';
|
||||
$MESS ['ADDRESS_SHORT'] = 'Краткий адрес';
|
||||
$MESS ['ADDRESS_FULL'] = 'Детальный адрес';
|
32
intaro.intarocrm/lang/ru/install/step4.php
Executable file → Normal file
32
intaro.intarocrm/lang/ru/install/step4.php
Executable file → Normal file
@ -1,24 +1,12 @@
|
||||
<?php
|
||||
$MESS ['STEP_NAME'] = 'Шаг 4';
|
||||
$MESS ['MOD_NEXT_STEP'] = 'Завершить установку';
|
||||
$MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг';
|
||||
$MESS ['DELIVERY_TYPES_LIST'] = 'Способы доставки';
|
||||
$MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты';
|
||||
$MESS ['PAYMENT_STATUS_LIST'] = 'Статусы';
|
||||
$MESS ['ORDER_TYPES_LIST'] = 'Типы заказа';
|
||||
$MESS ['PAYMENT_LIST'] = 'Оплата';
|
||||
$MESS ['PAYMENT_Y'] = 'Оплачен';
|
||||
$MESS ['PAYMENT_N'] = 'Не оплачен';
|
||||
$MESS ['CANCELED'] = 'Флаг «Отменен»';
|
||||
$MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками IntaroCRM.';
|
||||
$MESS ['LOAD_PERIOD'] = 'Выгружать каталог периодически';
|
||||
$MESS ['NOT_LOADING'] = 'Нет';
|
||||
$MESS ['CRON_LOADING'] = 'С помощью CRON каждые 24 часа';
|
||||
$MESS ['AGENT_LOADING'] = 'Агентом каждые 24 часа (по умолчанию)';
|
||||
$MESS ['LOAD_NOW'] = 'Выгрузить сейчас';
|
||||
$MESS ['PROFILE_NAME'] = 'Имя профиля:';
|
||||
$MESS ['PROFILE_NAME_EXAMPLE'] = 'Выгрузка каталога IntaroCRM';
|
||||
$MESS ['ERR_FIELDS_PROFILE'] = 'Неверно заполнено поле имени профиля';
|
||||
$MESS ['ERR_FIELDS_IBLOCK'] = 'Не выбрано ни одного информационного блока';
|
||||
$MESS ['ERR_FIELDS_ARTICLE'] = 'Не выбраны артикулы';
|
||||
$MESS ['ERR_FIELDS_FILE'] = 'Не указано имя файла';
|
||||
$MESS ['MESS_1'] = 'На данном шаге вы можете выгрузить ранее оформленные заказы в IntaroCRM. Для запуска выгрузки нажмите кнопку «Начать выгрузку».';
|
||||
$MESS ['MESS_2'] = 'Экспорт...';
|
||||
$MESS ['MESS_3'] = 'Экспорт заказов успешно завершён.';
|
||||
$MESS ['MESS_4'] = 'Экспорт заказов приостановлен.';
|
||||
$MESS ['MESS_5'] = 'Произошла ошибка сервера, обратитесь в Интаро Софт.';
|
||||
$MESS ['STOP'] = 'Приостановить выгрузку';
|
||||
$MESS ['START_1'] = 'Начать выгрузку';
|
||||
$MESS ['START_2'] = 'Приостановить выгрузку';
|
||||
$MESS ['START_3'] = 'Возобновить выгрузку';
|
||||
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
|
@ -1,18 +1,24 @@
|
||||
<?php
|
||||
$MESS ['INTAROCRM_INFO'] = '
|
||||
<h2>Дальнейшие действия<h2>
|
||||
<p>
|
||||
Если вы произвели выгрузку заказов на шаге 3, то эти заказы уже доступны в вашей CRM и
|
||||
через некоторое время по этим заказам будет подготовлены аналитические отчеты в Панели KPI.
|
||||
</p>
|
||||
<p>
|
||||
Новые заказы будут отправляться агентом <span style="font-family: Courier New;">ICrmOrderActions::uploadOrdersAgent();</span>
|
||||
в IntaroCRM каждые 10 минут (интервал можно изменить в разделе <a href="/bitrix/admin/agent_list.php">Агенты</a>).
|
||||
</p>
|
||||
<p>
|
||||
Если вы выбрали опцию «Выгрузить каталог сейчас» на шаге 4, то ваш каталог уже загружается в IntaroCRM.
|
||||
Загрузка длится, как правило, не более 10 минут. Если вы не выбирали эту опцию, то генерацию файла с каталогом
|
||||
можно произвести экспортом «IntaroCRM» в разделе Магазин > Настройки > <a href="/bitrix/admin/cat_export_setup.php">Экспорт данных</a>.
|
||||
IntaroCRM проверяет и загружает данный файл с каталогом каждые 3 часа.
|
||||
</p>
|
||||
';
|
||||
$MESS ['STEP_NAME'] = 'Шаг 5';
|
||||
$MESS ['MOD_NEXT_STEP'] = 'Завершить установку';
|
||||
$MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг';
|
||||
$MESS ['DELIVERY_TYPES_LIST'] = 'Способы доставки';
|
||||
$MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты';
|
||||
$MESS ['PAYMENT_STATUS_LIST'] = 'Статусы';
|
||||
$MESS ['ORDER_TYPES_LIST'] = 'Типы заказа';
|
||||
$MESS ['PAYMENT_LIST'] = 'Оплата';
|
||||
$MESS ['PAYMENT_Y'] = 'Оплачен';
|
||||
$MESS ['PAYMENT_N'] = 'Не оплачен';
|
||||
$MESS ['CANCELED'] = 'Флаг «Отменен»';
|
||||
$MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками IntaroCRM.';
|
||||
$MESS ['LOAD_PERIOD'] = 'Выгружать каталог периодически';
|
||||
$MESS ['NOT_LOADING'] = 'Нет';
|
||||
$MESS ['CRON_LOADING'] = 'С помощью CRON каждые 24 часа';
|
||||
$MESS ['AGENT_LOADING'] = 'Агентом каждые 24 часа (по умолчанию)';
|
||||
$MESS ['LOAD_NOW'] = 'Выгрузить сейчас';
|
||||
$MESS ['PROFILE_NAME'] = 'Имя профиля:';
|
||||
$MESS ['PROFILE_NAME_EXAMPLE'] = 'Выгрузка каталога IntaroCRM';
|
||||
$MESS ['ERR_FIELDS_PROFILE'] = 'Неверно заполнено поле имени профиля';
|
||||
$MESS ['ERR_FIELDS_IBLOCK'] = 'Не выбрано ни одного информационного блока';
|
||||
$MESS ['ERR_FIELDS_ARTICLE'] = 'Не выбраны артикулы';
|
||||
$MESS ['ERR_FIELDS_FILE'] = 'Не указано имя файла';
|
18
intaro.intarocrm/lang/ru/install/step6.php
Executable file
18
intaro.intarocrm/lang/ru/install/step6.php
Executable file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$MESS ['INTAROCRM_INFO'] = '
|
||||
<h2>Дальнейшие действия<h2>
|
||||
<p>
|
||||
Если вы произвели выгрузку заказов на шаге 3, то эти заказы уже доступны в вашей CRM и
|
||||
через некоторое время по этим заказам будет подготовлены аналитические отчеты в Панели KPI.
|
||||
</p>
|
||||
<p>
|
||||
Новые заказы будут отправляться агентом <span style="font-family: Courier New;">ICrmOrderActions::uploadOrdersAgent();</span>
|
||||
в IntaroCRM каждые 10 минут (интервал можно изменить в разделе <a href="/bitrix/admin/agent_list.php">Агенты</a>).
|
||||
</p>
|
||||
<p>
|
||||
Если вы выбрали опцию «Выгрузить каталог сейчас» на шаге 4, то ваш каталог уже загружается в IntaroCRM.
|
||||
Загрузка длится, как правило, не более 10 минут. Если вы не выбирали эту опцию, то генерацию файла с каталогом
|
||||
можно произвести экспортом «IntaroCRM» в разделе Магазин > Настройки > <a href="/bitrix/admin/cat_export_setup.php">Экспорт данных</a>.
|
||||
IntaroCRM проверяет и загружает данный файл с каталогом каждые 3 часа.
|
||||
</p>
|
||||
';
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
$MESS ['ICRM_OPTIONS_GENERAL_TAB'] = 'Общие настройки';
|
||||
$MESS ['ICRM_OPTIONS_IMPORT_TAB'] = 'Настройки импората';
|
||||
$MESS ['ICRM_OPTIONS_IMPORT_TAB'] = 'Настройки импорта';
|
||||
$MESS ['ICRM_OPTIONS_ORDER_PROPS_TAB'] = 'Cоответствия полей свойств заказа';
|
||||
$MESS ['ICRM_CONN_SETTINGS'] = 'Настройка соединения';
|
||||
$MESS ['ICRM_API_HOST'] = 'Адрес Intaro CRM:';
|
||||
$MESS ['ICRM_API_KEY'] = 'Ключ авторизации:';
|
||||
@ -29,3 +30,24 @@ $MESS ['ICRM_OPTIONS_ORDER_DISCHARGE_TAB'] = 'Режим выгрузки зак
|
||||
$MESS ['ORDER_DISCH'] = 'Режим выгрузки заказов';
|
||||
$MESS ['DISCHARGE_AGENT'] = 'Выгрузка заказов с помощью агента';
|
||||
$MESS ['DISCHARGE_EVENTS'] = 'Выгрузка заказов по событию';
|
||||
|
||||
$MESS ['INFO_2'] = ' Задайте соответствие между полями заказа 1C-Битрикс и IntaroCRM.';
|
||||
|
||||
$MESS ['ORDER_PROPS'] = 'Настройки соответствия полей заказа IntaroCRM свойствам заказа 1С-Битрикс';
|
||||
$MESS ['FIO'] = 'Ф.И.О.';
|
||||
$MESS ['ZIP'] = 'Индекс';
|
||||
$MESS ['ADDRESS'] = 'Адрес (строкой)';
|
||||
$MESS ['PHONE'] = 'Телефон';
|
||||
$MESS ['EMAIL'] = 'E-mail';
|
||||
$MESS ['COUNTRY'] = 'Страна';
|
||||
$MESS ['REGION'] = 'Область / Край';
|
||||
$MESS ['CITY'] = 'Город';
|
||||
$MESS ['STREET'] = 'Улица';
|
||||
$MESS ['BUILDING'] = 'Строение';
|
||||
$MESS ['FLAT'] = 'Квартира';
|
||||
$MESS ['INTERCOMCODE'] = 'Домофон';
|
||||
$MESS ['FLOOR'] = 'Этаж';
|
||||
$MESS ['BLOCK'] = 'Подъезд';
|
||||
$MESS ['HOUSE'] = 'Строение / корпус';
|
||||
$MESS ['ADDRESS_SHORT'] = 'Краткий адрес';
|
||||
$MESS ['ADDRESS_FULL'] = 'Детальный адрес';
|
@ -13,6 +13,7 @@ $CRM_PAYMENT = 'payment_arr'; //order payment Y/N
|
||||
$CRM_ORDER_LAST_ID = 'order_last_id';
|
||||
$CRM_ORDER_SITES = 'sites_ids';
|
||||
$CRM_ORDER_DISCHARGE = 'order_discharge';
|
||||
$CRM_ORDER_PROPS = 'order_props';
|
||||
|
||||
if(!CModule::IncludeModule('intaro.intarocrm')
|
||||
|| !CModule::IncludeModule('sale'))
|
||||
@ -26,6 +27,78 @@ if($_GET['ok'] && $_GET['ok'] == 'Y') echo CAdminMessage::ShowNote(GetMessage('I
|
||||
|
||||
$arResult = array();
|
||||
|
||||
$arResult['orderProps'] = array(
|
||||
array(
|
||||
'NAME' => GetMessage('FIO'),
|
||||
'ID' => 'fio'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('ZIP'),
|
||||
'ID' => 'index'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('PHONE'),
|
||||
'ID' => 'phone'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('EMAIL'),
|
||||
'ID' => 'email'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('ZIP'),
|
||||
'ID' => 'index'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('ADDRESS'),
|
||||
'ID' => 'text'
|
||||
),
|
||||
// address
|
||||
/* array(
|
||||
'NAME' => GetMessage('COUNTRY'),
|
||||
'ID' => 'country'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('REGION'),
|
||||
'ID' => 'region'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('CITY'),
|
||||
'ID' => 'city'
|
||||
),*/
|
||||
array(
|
||||
'NAME' => GetMessage('ZIP'),
|
||||
'ID' => 'index'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('STREET'),
|
||||
'ID' => 'street'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('BUILDING'),
|
||||
'ID' => 'building'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('FLAT'),
|
||||
'ID' => 'flat'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('INTERCOMCODE'),
|
||||
'ID' => 'intercomcode'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('FLOOR'),
|
||||
'ID' => 'floor'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('BLOCK'),
|
||||
'ID' => 'block'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('HOUSE'),
|
||||
'ID' => 'house'
|
||||
)
|
||||
);
|
||||
|
||||
//update connection settings
|
||||
if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
$api_host = htmlspecialchars(trim($_POST['api_host']));
|
||||
@ -68,9 +141,11 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
|
||||
//form order types ids arr
|
||||
$orderTypesArr = array();
|
||||
$orderTypesList = array();
|
||||
if ($arOrderTypesList = $dbOrderTypesList->Fetch()) {
|
||||
do {
|
||||
$orderTypesArr[$arOrderTypesList['ID']] = $_POST['order-type-' . $arOrderTypesList['ID']];
|
||||
$orderTypesList[] = $arOrderTypesList;
|
||||
} while ($arOrderTypesList = $dbOrderTypesList->Fetch());
|
||||
}
|
||||
|
||||
@ -140,6 +215,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
$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
|
||||
@ -168,6 +244,18 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
// event dependencies
|
||||
RegisterModuleDependences("sale", "OnOrderNewSendEmail", $mid, "ICrmOrderEvent", "onSendOrderMail");
|
||||
RegisterModuleDependences("sale", "OnOrderUpdate", $mid, "ICrmOrderEvent", "onUpdateOrder");
|
||||
|
||||
$orderPropsArr = array();
|
||||
foreach ($orderTypesList as $orderType) {
|
||||
$propsCount = 0;
|
||||
$_orderPropsArr = array();
|
||||
foreach ($arResult['orderProps'] as $orderProp) {
|
||||
if ((!(int) htmlspecialchars(trim($_POST['address-detail-' . $orderType['ID']]))) && $propsCount > 5)
|
||||
break;
|
||||
$_orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID'] . '-' . $orderType['ID']]));
|
||||
$propsCount++;
|
||||
}
|
||||
$orderPropsArr[$orderType['ID']] = $_orderPropsArr;
|
||||
}
|
||||
|
||||
COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr));
|
||||
@ -177,6 +265,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
COption::SetOptionString($mid, $CRM_PAYMENT, serialize($paymentArr));
|
||||
COption::SetOptionString($mid, $CRM_ORDER_SITES, serialize($orderSites));
|
||||
COption::SetOptionString($mid, $CRM_ORDER_DISCHARGE, $orderDischarge);
|
||||
COption::SetOptionString($mid, $CRM_ORDER_PROPS, serialize($orderPropsArr));
|
||||
|
||||
$uri .= '&ok=Y';
|
||||
LocalRedirect($uri);
|
||||
@ -288,6 +377,11 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
$arResult['bitrixPaymentList'][1]['NAME'] = GetMessage('PAYMENT_N');
|
||||
$arResult['bitrixPaymentList'][1]['ID'] = 'N';
|
||||
|
||||
$dbProp = CSaleOrderProps::GetList(array(), array());
|
||||
while ($arProp = $dbProp->GetNext()) {
|
||||
$arResult['arProp'][] = $arProp;
|
||||
}
|
||||
|
||||
//saved cat params
|
||||
$optionsOrderTypes = unserialize(COption::GetOptionString($mid, $CRM_ORDER_TYPES_ARR, 0));
|
||||
$optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0));
|
||||
@ -296,6 +390,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
$optionsPayment = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT, 0));
|
||||
$optionsSites = unserialize(COption::GetOptionString($mid, $CRM_ORDER_SITES, 0));
|
||||
$optionsDischarge = COption::GetOptionString($mid, $CRM_ORDER_DISCHARGE, 0);
|
||||
$optionsOrderProps = unserialize(COption::GetOptionString($mid, $CRM_ORDER_PROPS, 0));
|
||||
|
||||
$aTabs = array(
|
||||
array(
|
||||
@ -311,15 +406,36 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
"TITLE" => GetMessage('ICRM_OPTIONS_CATALOG_CAPTION')
|
||||
),
|
||||
array(
|
||||
"DIV" => "edit4",
|
||||
"DIV" => "edit3",
|
||||
"TAB" => GetMessage('ICRM_OPTIONS_ORDER_DISCHARGE_TAB'),
|
||||
"ICON" => '',
|
||||
"TITLE" => GetMessage('ICRM_OPTIONS_ORDER_DISCHARGE_CAPTION')
|
||||
),
|
||||
array(
|
||||
"DIV" => "edit4",
|
||||
"TAB" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_TAB'),
|
||||
"ICON" => '',
|
||||
"TITLE" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_CAPTION')
|
||||
)
|
||||
);
|
||||
$tabControl = new CAdminTabControl("tabControl", $aTabs);
|
||||
$tabControl->Begin();
|
||||
?>
|
||||
<?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');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<form method="POST" action="<?php echo $uri; ?>" id="FORMACTION">
|
||||
<?php
|
||||
echo bitrix_sessid_post();
|
||||
@ -337,6 +453,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
<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>
|
||||
<<<<<<< HEAD
|
||||
<!--<tr>
|
||||
<td width="50%" class="adm-detail-content-cell-l"><?php echo GetMessage('ICRM_SITES'); ?></td>
|
||||
<td width="50%" class="adm-detail-content-cell-r">
|
||||
@ -347,6 +464,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
</select>
|
||||
</td>
|
||||
</tr>-->
|
||||
=======
|
||||
>>>>>>> 22b82eff3f805aaef606018b1c6f63202aca7ad3
|
||||
<?php $tabControl->BeginNextTab(); ?>
|
||||
<input type="hidden" name="tab" value="catalog">
|
||||
<tr align="center">
|
||||
@ -459,6 +578,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
<?php $tabControl->BeginNextTab(); ?>
|
||||
<input type="hidden" name="tab" value="catalog">
|
||||
<tr class="heading">
|
||||
<<<<<<< HEAD
|
||||
<td colspan="2"><b><?php echo GetMessage('ORDER_DISCH'); ?></b></td>
|
||||
</tr>
|
||||
<tr class="heading">
|
||||
@ -469,6 +589,47 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
=======
|
||||
<td colspan="2"><b><?php echo GetMessage('ORDER_PROPS'); ?></b></td>
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<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 $bitrixOrderType['NAME']; ?></b></td>
|
||||
</tr>
|
||||
|
||||
<?php $countProps = 0; foreach($arResult['orderProps'] as $orderProp): ?>
|
||||
<?php if($orderProp['ID'] == 'text'): ?>
|
||||
<tr class="heading">
|
||||
<td colspan="2">
|
||||
<b>
|
||||
<label><input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID'];; ?>" value="0" <?php if(count($optionsOrderProps[$bitrixOrderType['ID']]) < 6) 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(count($optionsOrderProps[$bitrixOrderType['ID']]) > 5) echo "checked"; ?>><?php echo GetMessage('ADDRESS_FULL'); ?></label>
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr <?php if ($countProps > 5) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 5) && (count($optionsOrderProps[$bitrixOrderType['ID']]) < 6)) 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'] 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; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php $tabControl->BeginNextTab(); ?>
|
||||
>>>>>>> 22b82eff3f805aaef606018b1c6f63202aca7ad3
|
||||
<?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" />
|
||||
|
Loading…
Reference in New Issue
Block a user