1
0
mirror of synced 2024-11-22 13:26:10 +03:00

+step in installer

This commit is contained in:
Grisha Pomadchin 2013-09-05 12:11:29 +04:00
parent edcadcd052
commit 6f97c22b54
11 changed files with 1127 additions and 906 deletions

View File

@ -1,17 +1,17 @@
<?php <?php
/** /**
* Module Install/Uninstall script * Module Install/Uninstall script
* Module name: intaro.intarocrm * Module name: intaro.intarocrm
* Class name: intaro_intarocrm * Class name: intaro_intarocrm
*/ */
global $MESS; global $MESS;
IncludeModuleLangFile(__FILE__); IncludeModuleLangFile(__FILE__);
if (class_exists('intaro_intarocrm')) if (class_exists('intaro_intarocrm'))
return; return;
class intaro_intarocrm extends CModule class intaro_intarocrm extends CModule {
{
var $MODULE_ID = 'intaro.intarocrm'; var $MODULE_ID = 'intaro.intarocrm';
var $MODULE_VERSION; var $MODULE_VERSION;
var $MODULE_VERSION_DATE; var $MODULE_VERSION_DATE;
@ -22,7 +22,6 @@ class intaro_intarocrm extends CModule
var $PARTNER_URI; var $PARTNER_URI;
var $INTARO_CRM_API; var $INTARO_CRM_API;
var $INTARO_CRM_EXPORT = 'intarocrm'; var $INTARO_CRM_EXPORT = 'intarocrm';
var $CRM_API_HOST_OPTION = 'api_host'; var $CRM_API_HOST_OPTION = 'api_host';
var $CRM_API_KEY_OPTION = 'api_key'; var $CRM_API_KEY_OPTION = 'api_key';
var $CRM_ORDER_TYPES_ARR = 'order_types_arr'; var $CRM_ORDER_TYPES_ARR = 'order_types_arr';
@ -32,12 +31,10 @@ class intaro_intarocrm extends CModule
var $CRM_PAYMENT = 'payment_arr'; //order payment Y/N var $CRM_PAYMENT = 'payment_arr'; //order payment Y/N
var $CRM_ORDER_LAST_ID = 'order_last_id'; var $CRM_ORDER_LAST_ID = 'order_last_id';
var $CRM_ORDER_SITES = 'sites_ids'; var $CRM_ORDER_SITES = 'sites_ids';
var $CRM_ORDER_PROPS = 'order_props';
var $INSTALL_PATH; var $INSTALL_PATH;
function intaro_intarocrm() function intaro_intarocrm() {
{
$arModuleVersion = array(); $arModuleVersion = array();
$path = str_replace("\\", "/", __FILE__); $path = str_replace("\\", "/", __FILE__);
$path = substr($path, 0, strlen($path) - strlen("/index.php")); $path = substr($path, 0, strlen($path) - strlen("/index.php"));
@ -55,9 +52,7 @@ class intaro_intarocrm extends CModule
* Functions DoInstall and DoUninstall are * Functions DoInstall and DoUninstall are
* All other functions are optional * All other functions are optional
*/ */
function DoInstall() {
function DoInstall()
{
global $APPLICATION, $step, $arResult; global $APPLICATION, $step, $arResult;
if (!in_array('curl', get_loaded_extensions())) { if (!in_array('curl', get_loaded_extensions())) {
@ -78,6 +73,78 @@ class intaro_intarocrm extends CModule
$step = intval($_REQUEST['step']); $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('INTERCOMECODE'),
'ID' => 'intercomecode'
),
array(
'NAME' => GetMessage('FLOOR'),
'ID' => 'floor'
),
array(
'NAME' => GetMessage('BLOCK'),
'ID' => 'block'
),
array(
'NAME' => GetMessage('HOUSE'),
'ID' => 'house'
)
);
if ($step <= 1) { if ($step <= 1) {
if (!CModule::IncludeModule("sale")) { if (!CModule::IncludeModule("sale")) {
$arResult['errCode'] = 'ERR_SALE'; $arResult['errCode'] = 'ERR_SALE';
@ -97,8 +164,7 @@ class intaro_intarocrm extends CModule
$arResult['arSites'][] = $ar; $arResult['arSites'][] = $ar;
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), GetMessage('MODULE_INSTALL_TITLE'), $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step1.php'
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step1.php'
); );
} else if ($step == 2) { } else if ($step == 2) {
@ -127,8 +193,7 @@ class intaro_intarocrm extends CModule
return; return;
} }
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') && isset($_POST['ajax']) && ($_POST['ajax'] == 1)) {
&& isset($_POST['ajax']) && ($_POST['ajax'] == 1)) {
$api_host = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, 0); $api_host = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, 0); $api_key = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, 0);
@ -148,19 +213,14 @@ class intaro_intarocrm extends CModule
$arResult['paymentStatusesList'] = $this->INTARO_CRM_API->paymentStatusesList(); // --statuses $arResult['paymentStatusesList'] = $this->INTARO_CRM_API->paymentStatusesList(); // --statuses
$arResult['paymentList'] = $this->INTARO_CRM_API->orderStatusesList(); $arResult['paymentList'] = $this->INTARO_CRM_API->orderStatusesList();
$arResult['paymentGroupList'] = $this->INTARO_CRM_API->orderStatusGroupsList(); // -- statuses groups $arResult['paymentGroupList'] = $this->INTARO_CRM_API->orderStatusGroupsList(); // -- statuses groups
//bitrix orderTypesList -- personTypes //bitrix orderTypesList -- personTypes
$dbOrderTypesList = CSalePersonType::GetList( $dbOrderTypesList = CSalePersonType::GetList(
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"ACTIVE" => "Y", "ACTIVE" => "Y",
), ), false, false, array()
false,
false,
array()
); );
@ -178,13 +238,9 @@ class intaro_intarocrm extends CModule
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"ACTIVE" => "Y", "ACTIVE" => "Y",
), ), false, false, array()
false,
false,
array()
); );
//form delivery types ids arr //form delivery types ids arr
@ -201,8 +257,7 @@ class intaro_intarocrm extends CModule
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"ACTIVE" => "Y" "ACTIVE" => "Y"
) )
); );
@ -221,8 +276,7 @@ class intaro_intarocrm extends CModule
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"LID" => "ru", //ru "LID" => "ru", //ru
"ACTIVE" => "Y" "ACTIVE" => "Y"
) )
@ -306,7 +360,8 @@ class intaro_intarocrm extends CModule
$input['payment-status-' . $bitrixPaymentStatus['ID']] .= '<option value=""></option>'; $input['payment-status-' . $bitrixPaymentStatus['ID']] .= '<option value=""></option>';
foreach ($arResult['paymentGroupList'] as $orderStatusGroup) { foreach ($arResult['paymentGroupList'] as $orderStatusGroup) {
if(empty($orderStatusGroup['statuses'])) continue; if (empty($orderStatusGroup['statuses']))
continue;
$input['payment-status-' . $bitrixPaymentStatus['ID']].= $input['payment-status-' . $bitrixPaymentStatus['ID']].=
'<optgroup label="' . $orderStatusGroup['name'] . '">'; '<optgroup label="' . $orderStatusGroup['name'] . '">';
@ -429,19 +484,14 @@ class intaro_intarocrm extends CModule
$arResult['paymentStatusesList'] = $this->INTARO_CRM_API->paymentStatusesList(); // --statuses $arResult['paymentStatusesList'] = $this->INTARO_CRM_API->paymentStatusesList(); // --statuses
$arResult['paymentList'] = $this->INTARO_CRM_API->orderStatusesList(); $arResult['paymentList'] = $this->INTARO_CRM_API->orderStatusesList();
$arResult['paymentGroupList'] = $this->INTARO_CRM_API->orderStatusGroupsList(); // -- statuses groups $arResult['paymentGroupList'] = $this->INTARO_CRM_API->orderStatusGroupsList(); // -- statuses groups
//bitrix orderTypesList -- personTypes //bitrix orderTypesList -- personTypes
$dbOrderTypesList = CSalePersonType::GetList( $dbOrderTypesList = CSalePersonType::GetList(
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"ACTIVE" => "Y", "ACTIVE" => "Y",
), ), false, false, array()
false,
false,
array()
); );
if ($arOrderTypesList = $dbOrderTypesList->Fetch()) { if ($arOrderTypesList = $dbOrderTypesList->Fetch()) {
@ -455,13 +505,9 @@ class intaro_intarocrm extends CModule
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"ACTIVE" => "Y", "ACTIVE" => "Y",
), ), false, false, array()
false,
false,
array()
); );
if ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()) { if ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()) {
@ -475,8 +521,7 @@ class intaro_intarocrm extends CModule
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"ACTIVE" => "Y" "ACTIVE" => "Y"
) )
); );
@ -492,8 +537,7 @@ class intaro_intarocrm extends CModule
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"LID" => "ru", //ru "LID" => "ru", //ru
"ACTIVE" => "Y" "ACTIVE" => "Y"
) )
@ -511,38 +555,13 @@ class intaro_intarocrm extends CModule
); );
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), GetMessage('MODULE_INSTALL_TITLE'), $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step2.php'
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step2.php'
); );
} else if ($step == 3) { } else if ($step == 3) {
if (!CModule::IncludeModule("sale")) { if (!CModule::IncludeModule("sale")) {
//handler //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']) { if (isset($_POST['back']) && $_POST['back']) {
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), GetMessage('MODULE_INSTALL_TITLE'),
@ -560,13 +579,9 @@ class intaro_intarocrm extends CModule
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"ACTIVE" => "Y", "ACTIVE" => "Y",
), ), false, false, array()
false,
false,
array()
); );
//form order types ids arr //form order types ids arr
@ -582,13 +597,9 @@ class intaro_intarocrm extends CModule
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"ACTIVE" => "Y", "ACTIVE" => "Y",
), ), false, false, array()
false,
false,
array()
); );
//form delivery types ids arr //form delivery types ids arr
@ -633,7 +644,6 @@ class intaro_intarocrm extends CModule
ICrmOrderActions::eventLog('install/index.php', 'IntaroCrm\RestApi::deliveryTypeEdit', $this->INTARO_CRM_API->getLastError()); ICrmOrderActions::eventLog('install/index.php', 'IntaroCrm\RestApi::deliveryTypeEdit', $this->INTARO_CRM_API->getLastError());
} }
} }
} while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()); } while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch());
} }
} }
@ -643,8 +653,7 @@ class intaro_intarocrm extends CModule
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"ACTIVE" => "Y" "ACTIVE" => "Y"
) )
); );
@ -662,8 +671,7 @@ class intaro_intarocrm extends CModule
array( array(
"SORT" => "ASC", "SORT" => "ASC",
"NAME" => "ASC" "NAME" => "ASC"
), ), array(
array(
"LID" => "ru", //ru "LID" => "ru", //ru
"ACTIVE" => "Y" "ACTIVE" => "Y"
) )
@ -683,6 +691,12 @@ class intaro_intarocrm extends CModule
$paymentArr['Y'] = htmlspecialchars(trim($_POST['payment-Y'])); $paymentArr['Y'] = htmlspecialchars(trim($_POST['payment-Y']));
$paymentArr['N'] = htmlspecialchars(trim($_POST['payment-N'])); $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_ORDER_TYPES_ARR, serialize($orderTypesArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_TYPES, serialize($paymentTypesArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_TYPES, serialize($paymentTypesArr));
@ -695,6 +709,59 @@ class intaro_intarocrm extends CModule
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step3.php' $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step3.php'
); );
} else if ($step == 4) { } else if ($step == 4) {
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'),
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step2.php'
);
}
$propsCount = 0;
$orderPropsArr = array();
foreach ($arResult['orderProps'] as $orderProp) {
if ((!(int) htmlspecialchars(trim($_POST['address-detail']))) && $propsCount > 5)
break;
$orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID']]));
$propsCount++;
}
$arResult['test'] = $_POST;
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'; $arResult['errCode'] = 'ERR_IBLOCK';
} }
@ -704,10 +771,9 @@ class intaro_intarocrm extends CModule
} }
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), 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'
); );
} else if ($step == 6) {
} else if ($step == 5) {
if (!CModule::IncludeModule("iblock")) { if (!CModule::IncludeModule("iblock")) {
$arResult['errCode'] = 'ERR_IBLOCK'; $arResult['errCode'] = 'ERR_IBLOCK';
@ -720,7 +786,7 @@ class intaro_intarocrm extends CModule
if (isset($arResult['errCode']) && $arResult['errCode']) { if (isset($arResult['errCode']) && $arResult['errCode']) {
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), 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; return;
} }
@ -780,7 +846,7 @@ class intaro_intarocrm extends CModule
$oldValues = $arOldValues; $oldValues = $arOldValues;
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), 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; return;
} }
@ -796,7 +862,6 @@ class intaro_intarocrm extends CModule
$loader->filename = $filename; $loader->filename = $filename;
$loader->application = $APPLICATION; $loader->application = $APPLICATION;
$loader->Load(); $loader->Load();
} }
if ($typeLoading == 'agent' || $typeLoading == 'cron') { if ($typeLoading == 'agent' || $typeLoading == 'cron') {
@ -832,11 +897,7 @@ class intaro_intarocrm extends CModule
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec; $intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
$dateAgent->add($intAgent); $dateAgent->add($intAgent);
CAgent::AddAgent( CAgent::AddAgent(
"CCatalogExport::PreGenerateExport(" . $PROFILE_ID . ");", "CCatalogExport::PreGenerateExport(" . $PROFILE_ID . ");", "catalog", "N", 86400, $dateAgent->format('d.m.Y H:i:s'), // date of first check
"catalog",
"N",
86400,
$dateAgent->format('d.m.Y H:i:s'), // date of first check
"Y", // агент активен "Y", // агент активен
$dateAgent->format('d.m.Y H:i:s'), // date of first start $dateAgent->format('d.m.Y H:i:s'), // date of first start
30 30
@ -849,8 +910,7 @@ class intaro_intarocrm extends CModule
$agent_period = 24; $agent_period = 24;
$agent_php_path = "/usr/local/php/bin/php"; $agent_php_path = "/usr/local/php/bin/php";
if (!file_exists($_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS."cron_frame.php")) if (!file_exists($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS . "cron_frame.php")) {
{
CheckDirPath($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS); CheckDirPath($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS);
$tmp_file_size = filesize($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS_DEF . "cron_frame.php"); $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"); $fp = fopen($_SERVER["DOCUMENT_ROOT"] . CATALOG_PATH2EXPORTS_DEF . "cron_frame.php", "rb");
@ -866,8 +926,7 @@ class intaro_intarocrm extends CModule
} }
$cfg_data = ""; $cfg_data = "";
if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg")) if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg")) {
{
$cfg_file_size = filesize($_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"); $fp = fopen($_SERVER["DOCUMENT_ROOT"] . "/bitrix/crontab/crontab.cfg", "rb");
$cfg_data = fread($fp, $cfg_file_size); $cfg_data = fread($fp, $cfg_file_size);
@ -876,13 +935,10 @@ class intaro_intarocrm extends CModule
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 // remove
$cfg_data = preg_replace("#^.*?" . preg_quote(CATALOG_PATH2EXPORTS) . "cron_frame.php +" . $PROFILE_ID . " *>.*?$#im", "", $cfg_data); $cfg_data = preg_replace("#^.*?" . preg_quote(CATALOG_PATH2EXPORTS) . "cron_frame.php +" . $PROFILE_ID . " *>.*?$#im", "", $cfg_data);
} } else {
else
{
$strTime = "0 */" . $agent_period . " * * * "; $strTime = "0 */" . $agent_period . " * * * ";
if (strlen($cfg_data) > 0) if (strlen($cfg_data) > 0)
$cfg_data .= "\n"; $cfg_data .= "\n";
@ -902,23 +958,16 @@ class intaro_intarocrm extends CModule
$arRetval = array(); $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);
} }
} }
//
//agent //agent
$dateAgent = new DateTime(); $dateAgent = new DateTime();
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec; $intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
$dateAgent->add($intAgent); $dateAgent->add($intAgent);
CAgent::AddAgent( CAgent::AddAgent(
"ICrmOrderActions::uploadOrdersAgent();", "ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID, "N", 600, // interval - 10 mins
$this->MODULE_ID,
"N",
600, // interval - 10 mins
$dateAgent->format('d.m.Y H:i:s'), // date of first check $dateAgent->format('d.m.Y H:i:s'), // date of first check
"Y", // агент активен "Y", // агент активен
$dateAgent->format('d.m.Y H:i:s'), // date of first start $dateAgent->format('d.m.Y H:i:s'), // date of first start
@ -932,7 +981,7 @@ class intaro_intarocrm extends CModule
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), 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'
); );
} }
} }
@ -970,17 +1019,13 @@ class intaro_intarocrm extends CModule
UnRegisterModule($this->MODULE_ID); UnRegisterModule($this->MODULE_ID);
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_UNINSTALL_TITLE'), GetMessage('MODULE_UNINSTALL_TITLE'), $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/unstep1.php'
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/unstep1.php'
); );
} }
function CopyFiles() { function CopyFiles() {
CopyDirFiles( CopyDirFiles(
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/export/', $_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/php_interface/include/catalog_export/',
true, true
); );
} }
@ -995,7 +1040,6 @@ class intaro_intarocrm extends CModule
// IBLOCK_PROPERTY_ARTICLE[0]=ARTICLE& // IBLOCK_PROPERTY_ARTICLE[0]=ARTICLE&
// IBLOCK_PROPERTY_ARTICLE[1]=ARTNUMBER& // IBLOCK_PROPERTY_ARTICLE[1]=ARTNUMBER&
// SETUP_FILE_NAME=%2Fbitrix%2Fcatalog_export%2Ftestintarocrm.xml // SETUP_FILE_NAME=%2Fbitrix%2Fcatalog_export%2Ftestintarocrm.xml
//$arProfileFields = explode(",", $SETUP_FIELDS_LIST); //$arProfileFields = explode(",", $SETUP_FIELDS_LIST);
$strVars = ""; $strVars = "";
foreach ($iblocks as $key => $val) foreach ($iblocks as $key => $val)
@ -1007,4 +1051,5 @@ class intaro_intarocrm extends CModule
return $strVars; return $strVars;
} }
} }

View File

@ -2,168 +2,30 @@
if (!check_bitrix_sessid()) if (!check_bitrix_sessid())
return; return;
IncludeModuleLangFile(__FILE__); IncludeModuleLangFile(__FILE__);
$defaultOrderProps = 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" src="/bitrix/js/main/jquery/jquery-1.7.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
var globStop = false; $('input[name="address-detail"]').change(function(){
if(parseInt($(this).val()) === 1)
$('tr.address-detail').show('slow');
else if(parseInt($(this).val()) === 0)
$('tr.address-detail').hide('slow');
$('#percent').width($('.instal-progress-bar-outer').width());
$(window).resize(function(){ // strechin progress bar
$('#percent').width($('.instal-progress-bar-outer').width());
}); });
// 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> </script>
<div class="adm-detail-content-item-block">
<form action="<?php echo $APPLICATION->GetCurPage() ?>" method="POST"> <form action="<?php echo $APPLICATION->GetCurPage() ?>" method="POST">
<?php echo bitrix_sessid_post(); ?> <?php echo bitrix_sessid_post(); ?>
<input type="hidden" name="lang" value="<?php echo LANGUAGE_ID ?>"> <input type="hidden" name="lang" value="<?php echo LANGUAGE_ID ?>">
@ -171,33 +33,53 @@ IncludeModuleLangFile(__FILE__);
<input type="hidden" name="install" value="Y"> <input type="hidden" name="install" value="Y">
<input type="hidden" name="step" value="4"> <input type="hidden" name="step" value="4">
<input type="hidden" name="continue" value="3"> <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"> <table class="adm-detail-content-table edit-table" id="edit1_edit_table">
<tbody> <tbody>
<tr class="heading"> <tr class="heading">
<td colspan="2"><b><?php echo GetMessage('STEP_NAME'); ?></b></td> <td colspan="2"><b><?php echo GetMessage('STEP_NAME'); ?></b></td>
</tr> </tr>
<tr class="heading">
<td colspan="2"><b><?php echo GetMessage('ORDER_PROPS'); ?></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 type="radio" name="address-detail" value="0" <?php if (count($defaultOrderProps) < 6) echo "checked"; ?>><?php echo GetMessage('ADDRESS_SHORT'); ?></label>
<label><input type="radio" name="address-detail" value="1" <?php if (count($defaultOrderProps) > 5) echo "checked"; ?>><?php echo GetMessage('ADDRESS_FULL'); ?></label>
</b>
</td>
</tr>
<?php endif; ?>
<tr <?php if ($countProps > 5) echo 'class="address-detail"'; if (($countProps > 5) && (count($defaultOrderProps) < 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']; ?>" class="typeselect">
<option value=""></option>
<?php foreach ($arResult['arProp'] as $arProp): ?>
<option value="<?php echo $arProp['CODE']; ?>" <?php if ($defaultOrderProps[$orderProp['ID']] == $arProp['CODE']) echo 'selected'; ?>>
<?php echo $arProp['NAME']; ?>
</option>
<?php endforeach; ?>
</select>
</td>
</tr>
<?php $countProps++; endforeach; ?>
</tbody> </tbody>
</table> </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 /> <br />
<div style="padding: 1px 13px 2px; height:28px;"> <div style="padding: 1px 13px 2px; height:28px;">
<div align="right" style="float:right; width:50%; position:relative;"> <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"> <input type="submit" name="inst" value="<?php echo GetMessage("MOD_NEXT_STEP"); ?>" class="adm-btn-save">
</div> </div>
<div align="left" style="float:right; width:50%; position:relative; visible: none;"> <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"> <input type="submit" name="start" value="<?php echo GetMessage("MOD_PREV_STEP"); ?>" class="adm-btn-save">
</div>
</div> </div>
</div> </div>
</form> </form>
</div>

View File

@ -1,263 +1,203 @@
<?php <?php
if (!check_bitrix_sessid())
if(!check_bitrix_sessid()) return; return;
IncludeModuleLangFile(__FILE__); 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;
}
?> ?>
<style type="text/css">
.instal-load-block { /* */ }
.instal-load-label {
<table class="adm-list-table" id="export_setup"> color: #000;
<thead> margin-bottom: 15px;
<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");?>&nbsp;
</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">
&nbsp;
</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-outer {
?> height: 32px;
> border:1px solid;
<?=$prop["NAME"];?> border-color:#9ba6a8 #b1bbbe #bbc5c9 #b1bbbe;
</option> -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;
} }
?>
</select> .instal-progress-bar-alignment {
</td> height: 28px;
</tr> margin: 0;
<? position: relative;
} }
?>
</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> .instal-progress-bar-inner {
<input type="text" name="SETUP_FILE_NAME" height: 28px;
value="<?=htmlspecialcharsbx(strlen($SETUP_FILE_NAME) > 0 ? border-radius: 2px;
$SETUP_FILE_NAME : border-top: solid 1px #52b9df;
(COption::GetOptionString( background-color:#2396ce;
'catalog', background-image:-webkit-linear-gradient(top, #27a8d7, #2396ce, #1c79c0);
'export_default_path', background-image:-moz-linear-gradient(top, #27a8d7, #2396ce, #1c79c0);
'/bitrix/catalog_export/')) background-image:-ms-linear-gradient(top, #27a8d7, #2396ce, #1c79c0);
.'intarocrm'/* .mt_rand(0, 999999) */.'.xml' background-image:-o-linear-gradient(top, #27a8d7, #2396ce, #1c79c0);
); ?>" size="50"> background-image:linear-gradient(top, #27a8d7, #2396ce, #1c79c0);
position: absolute;
overflow: hidden;
top: 1px;
left:0;
}
<br> .instal-progress-bar-inner-text {
<br> color: #fff;
<br> text-shadow: 0 1px rgba(0,0,0,0.2);
font-size: 18px;
<font class="text"><?=GetMessage("LOAD_PERIOD");?><br><br></font> line-height: 32px;
<input type="radio" name="TYPE_LOADING" value="none" onclick="checkProfile(this);"><?=GetMessage("NOT_LOADING");?><Br> font-weight: bold;
<input type="radio" name="TYPE_LOADING" value="cron" onclick="checkProfile(this);"><?=GetMessage("CRON_LOADING");?><Br> text-align: center;
<input type="radio" name="TYPE_LOADING" value="agent" checked onclick="checkProfile(this);"><?=GetMessage("AGENT_LOADING");?><Br> position: absolute;
<br> left: -2px;
<br> top: -2px;
<font class="text"><?=GetMessage("LOAD_NOW");?>&nbsp;</font> }
<input id="load-now" type="checkbox" name="LOAD_NOW" value="now" checked > </style>
<br>
<br>
<br>
<div id="profile-field" >
<font class="text"><?=GetMessage("PROFILE_NAME");?>&nbsp;</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" src="/bitrix/js/main/jquery/jquery-1.7.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
function checkAll(obj,cnt) $(document).ready(function() {
{ var globStop = false;
var boolCheck = obj.checked;
for (i = 0; i < cnt; i++) $('#percent').width($('.instal-progress-bar-outer').width());
{
BX('IBLOCK_EXPORT'+i).checked = boolCheck; $(window).resize(function(){ // strechin progress bar
$('#percent').width($('.instal-progress-bar-outer').width());
});
// 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
} }
BX('count_checked').value = (boolCheck ? cnt : 0);
}; var handlerUrl = $(this).parents('form').attr('action');
function checkOne(obj,cnt) var step = $('input[name="continue"]').val();
{ var id = $('input[name="id"]').val();
var boolCheck = obj.checked; var install = $('input[name="install"]').val();
var intCurrent = parseInt(BX('count_checked').value); var sessid = BX.bitrix_sessid();
intCurrent += (boolCheck ? 1 : -1);
BX('icml_export_all').checked = (intCurrent < cnt ? false : true); var data = 'install=' + install +'&step=' + step + '&sessid=' + sessid +
BX('count_checked').value = intCurrent; '&id=' + id + '&ajax=1&finish=' + finish;
if (!boolCheck)
BX(obj.id.replace('IBLOCK_EXPORT','IBLOCK_PROPERTY_ARTICLE')).value = 'none'; // ajax request
}; $.ajax({
function checkProfile(obj) type: 'POST',
{ url: handlerUrl,
if (obj.value !== 'none') data: data,
$('#profile-field').show(); dataType: 'json',
else success: function(response) {
$('#profile-field').hide(); $('#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> </script>
<form action="<?php echo $APPLICATION->GetCurPage() ?>" method="POST">
<?//Следующие переменные должны быть обязательно установлены?> <?php echo bitrix_sessid_post(); ?>
<?=bitrix_sessid_post();?> <input type="hidden" name="lang" value="<?php echo LANGUAGE_ID ?>">
<input type="hidden" name="lang" value="<?php echo LANG; ?>">
<input type="hidden" name="id" value="intaro.intarocrm"> <input type="hidden" name="id" value="intaro.intarocrm">
<input type="hidden" name="install" value="Y"> <input type="hidden" name="install" value="Y">
<input type="hidden" name="step" value="5"> <input type="hidden" name="step" value="5">
<input type="hidden" name="continue" value="4"> <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 style="padding: 1px 13px 2px; height:28px;">
<div align="right" style="float:right; width:50%; position:relative;"> <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"> <input type="submit" name="inst" value="<?php echo GetMessage("MOD_NEXT_STEP"); ?>" class="adm-btn-save">
</div> </div>
<div align="left" style="float:right; width:50%; position:relative;"> <div align="left" style="float:right; width:50%; position:relative; visible: none;">
<input type="submit" name="back" value="<?php echo GetMessage("MOD_PREV_STEP"); ?>" class="adm-btn-save"> <input type="submit" name="start" value="<?php echo GetMessage("START_1"); ?>" class="adm-btn-save">
</div>
</div> </div>
</div> </div>
</form> </form>

View File

@ -1,11 +1,263 @@
<?php <?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");?>&nbsp;
</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">
&nbsp;
</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");?>&nbsp;</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");?>&nbsp;</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="lang" value="<?php echo LANG; ?>">
<input type="hidden" name="id" value="intaro.intarocrm"> <input type="hidden" name="id" value="intaro.intarocrm">
<input type="hidden" name="install" value="Y"> <input type="hidden" name="install" value="Y">
<input type="submit" name="" value="<?php echo GetMessage("MOD_BACK"); ?>"> <input type="hidden" name="step" value="6">
<form> <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>

View 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>

View File

@ -13,3 +13,22 @@ $MESS ['ERR_CATALOG'] = 'Отсутствует модуль catalog! Дальн
$MESS ['INTAROCRM_CURL_ERR'] = 'Для работы модуля интеграции с IntaroCRM требуется PHP-расширение CURL.'; $MESS ['INTAROCRM_CURL_ERR'] = 'Для работы модуля интеграции с IntaroCRM требуется PHP-расширение CURL.';
$MESS ['ERR_ARTICLE_IBLOCK'] = 'Не установлены артикулы'; $MESS ['ERR_ARTICLE_IBLOCK'] = 'Не установлены артикулы';
$MESS ['DATE_TIMEZONE_ERR'] = 'Не указана временная зона в настройках php.'; $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'] = 'Детальный адрес';

View File

@ -10,3 +10,23 @@ $MESS ['START_1'] = 'Начать выгрузку';
$MESS ['START_2'] = 'Приостановить выгрузку'; $MESS ['START_2'] = 'Приостановить выгрузку';
$MESS ['START_3'] = 'Возобновить выгрузку'; $MESS ['START_3'] = 'Возобновить выгрузку';
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг'; $MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
$MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг';
$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
View File

@ -1,24 +1,12 @@
<?php <?php
$MESS ['STEP_NAME'] = 'Шаг 4'; $MESS ['STEP_NAME'] = 'Шаг 4';
$MESS ['MOD_NEXT_STEP'] = 'Завершить установку'; $MESS ['MESS_1'] = 'На данном шаге вы можете выгрузить ранее оформленные заказы в IntaroCRM. Для запуска выгрузки нажмите кнопку «Начать выгрузку».';
$MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг'; $MESS ['MESS_2'] = 'Экспорт...';
$MESS ['DELIVERY_TYPES_LIST'] = 'Способы доставки'; $MESS ['MESS_3'] = 'Экспорт заказов успешно завершён.';
$MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты'; $MESS ['MESS_4'] = 'Экспорт заказов приостановлен.';
$MESS ['PAYMENT_STATUS_LIST'] = 'Статусы'; $MESS ['MESS_5'] = 'Произошла ошибка сервера, обратитесь в Интаро Софт.';
$MESS ['ORDER_TYPES_LIST'] = 'Типы заказа'; $MESS ['STOP'] = 'Приостановить выгрузку';
$MESS ['PAYMENT_LIST'] = 'Оплата'; $MESS ['START_1'] = 'Начать выгрузку';
$MESS ['PAYMENT_Y'] = 'Оплачен'; $MESS ['START_2'] = 'Приостановить выгрузку';
$MESS ['PAYMENT_N'] = 'Не оплачен'; $MESS ['START_3'] = 'Возобновить выгрузку';
$MESS ['CANCELED'] = 'Флаг «Отменен»'; $MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
$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'] = 'Не указано имя файла';

View File

@ -1,18 +1,24 @@
<?php <?php
$MESS ['INTAROCRM_INFO'] = ' $MESS ['STEP_NAME'] = 'Шаг 5';
<h2>Дальнейшие действия<h2> $MESS ['MOD_NEXT_STEP'] = 'Завершить установку';
<p> $MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг';
Если вы произвели выгрузку заказов на шаге 3, то эти заказы уже доступны в вашей CRM и $MESS ['DELIVERY_TYPES_LIST'] = 'Способы доставки';
через некоторое время по этим заказам будет подготовлены аналитические отчеты в Панели KPI. $MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты';
</p> $MESS ['PAYMENT_STATUS_LIST'] = 'Статусы';
<p> $MESS ['ORDER_TYPES_LIST'] = 'Типы заказа';
Новые заказы будут отправляться агентом <span style="font-family: Courier New;">ICrmOrderActions::uploadOrdersAgent();</span> $MESS ['PAYMENT_LIST'] = 'Оплата';
в IntaroCRM каждые 10 минут (интервал можно изменить в разделе <a href="/bitrix/admin/agent_list.php">Агенты</a>). $MESS ['PAYMENT_Y'] = 'Оплачен';
</p> $MESS ['PAYMENT_N'] = 'Не оплачен';
<p> $MESS ['CANCELED'] = 'Флаг «Отменен»';
Если вы выбрали опцию «Выгрузить каталог сейчас» на шаге 4, то ваш каталог уже загружается в IntaroCRM. $MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками IntaroCRM.';
Загрузка длится, как правило, не более 10 минут. Если вы не выбирали эту опцию, то генерацию файла с каталогом $MESS ['LOAD_PERIOD'] = 'Выгружать каталог периодически';
можно произвести экспортом «IntaroCRM» в разделе Магазин > Настройки > <a href="/bitrix/admin/cat_export_setup.php">Экспорт данных</a>. $MESS ['NOT_LOADING'] = 'Нет';
IntaroCRM проверяет и загружает данный файл с каталогом каждые 3 часа. $MESS ['CRON_LOADING'] = 'С помощью CRON каждые 24 часа';
</p> $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'] = 'Не указано имя файла';

View 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>
';

View File

@ -26,37 +26,77 @@ if($_GET['ok'] && $_GET['ok'] == 'Y') echo CAdminMessage::ShowNote(GetMessage('I
$arResult = array(); $arResult = array();
$arResult['orderProps'][0]['NAME'] = GetMessage('FIO'); $arResult['orderProps'] = array(
$arResult['orderProps'][0]['ID'] = 'fio'; array(
$arResult['orderProps'][1]['NAME'] = GetMessage('ZIP'); 'NAME' => GetMessage('FIO'),
$arResult['orderProps'][1]['ID'] = 'index'; 'ID' => 'fio'
$arResult['orderProps'][2]['NAME'] = GetMessage('PHONE'); ),
$arResult['orderProps'][2]['ID'] = 'phone'; array(
$arResult['orderProps'][3]['NAME'] = GetMessage('EMAIL'); 'NAME' => GetMessage('ZIP'),
$arResult['orderProps'][3]['ID'] = 'email'; '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 // address
$arResult['orderProps'][4]['NAME'] = GetMessage('ADDRESS'); /* array(
$arResult['orderProps'][4]['ID'] = 'text'; 'NAME' => GetMessage('COUNTRY'),
//$arResult['orderProps'][5]['NAME'] = GetMessage('COUNTRY'); 'ID' => 'country'
//$arResult['orderProps'][5]['ID'] = 'country'; ),
//$arResult['orderProps'][6]['NAME'] = GetMessage('REGION'); array(
//$arResult['orderProps'][6]['ID'] = 'region'; 'NAME' => GetMessage('REGION'),
//$arResult['orderProps'][7]['NAME'] = GetMessage('CITY'); 'ID' => 'region'
//$arResult['orderProps'][7]['ID'] = 'city'; ),
$arResult['orderProps'][8]['NAME'] = GetMessage('STREET'); array(
$arResult['orderProps'][8]['ID'] = 'street'; 'NAME' => GetMessage('CITY'),
$arResult['orderProps'][9]['NAME'] = GetMessage('BUILDING'); 'ID' => 'city'
$arResult['orderProps'][9]['ID'] = 'building'; ),*/
$arResult['orderProps'][10]['NAME'] = GetMessage('FLAT'); array(
$arResult['orderProps'][10]['ID'] = 'flat'; 'NAME' => GetMessage('ZIP'),
$arResult['orderProps'][11]['NAME'] = GetMessage('INTERCOMCODE'); 'ID' => 'index'
$arResult['orderProps'][11]['ID'] = 'intercomecode'; ),
$arResult['orderProps'][12]['NAME'] = GetMessage('FLOOR'); array(
$arResult['orderProps'][12]['ID'] = 'floor'; 'NAME' => GetMessage('STREET'),
$arResult['orderProps'][13]['NAME'] = GetMessage('BLOCK'); 'ID' => 'street'
$arResult['orderProps'][13]['ID'] = 'block'; ),
$arResult['orderProps'][14]['NAME'] = GetMessage('HOUSE'); array(
$arResult['orderProps'][14]['ID'] = 'house'; 'NAME' => GetMessage('BUILDING'),
'ID' => 'building'
),
array(
'NAME' => GetMessage('FLAT'),
'ID' => 'flat'
),
array(
'NAME' => GetMessage('INTERCOMECODE'),
'ID' => 'intercomecode'
),
array(
'NAME' => GetMessage('FLOOR'),
'ID' => 'floor'
),
array(
'NAME' => GetMessage('BLOCK'),
'ID' => 'block'
),
array(
'NAME' => GetMessage('HOUSE'),
'ID' => 'house'
)
);
//update connection settings //update connection settings
if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) { if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
@ -175,7 +215,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$propsCount = 0; $propsCount = 0;
$orderPropsArr = array(); $orderPropsArr = array();
foreach($arResult['orderProps'] as $orderProp) { foreach($arResult['orderProps'] as $orderProp) {
if((!(int) htmlspecialchars(trim($_POST['address-detail']))) && $propsCount > 4) if((!(int) htmlspecialchars(trim($_POST['address-detail']))) && $propsCount > 5)
break; break;
$orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID']])); $orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID']]));
$propsCount++; $propsCount++;
@ -501,7 +541,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</td> </td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<tr <?php if ($countProps > 4) echo 'class="address-detail"'; if(($countProps > 4) && (count($optionsOrderProps) < 6)) echo 'style="display:none;"';?>> <tr <?php if ($countProps > 5) echo 'class="address-detail"'; if(($countProps > 5) && (count($optionsOrderProps) < 6)) echo 'style="display:none;"';?>>
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $orderProp['ID']; ?>"> <td width="50%" class="adm-detail-content-cell-l" name="<?php echo $orderProp['ID']; ?>">
<?php echo $orderProp['NAME']; ?> <?php echo $orderProp['NAME']; ?>
</td> </td>