1
0
mirror of synced 2024-11-26 07:16:08 +03:00

Merge remote-tracking branch 'refs/remotes/origin/master'

This commit is contained in:
m.korolev 2013-07-29 17:59:12 +04:00
commit 184df6a4d0
12 changed files with 146 additions and 87 deletions

View File

@ -1,14 +1,13 @@
Bitrix module Bitrix module
============= =============
Bitrix module for interaction with IntaroCRM through REST API. Bitrix module for interaction with [IntaroCRM](http://www.intarocrm.com) through [REST API](http://docs.intarocrm.ru/rest-api/).
Module allows: Module allows:
* Send to IntaroCRM new orders and changes for old orders from Bitrix * Send to IntaroCRM new orders
* Load from IntaroCRM changes for old orders to Bitrix
* Configure relations between dictionaries of IntaroCRM and Bitrix (statuses, payments, delivery types and etc) * Configure relations between dictionaries of IntaroCRM and Bitrix (statuses, payments, delivery types and etc)
* Generate extended YML (YandexML) for catalog loading by IntaroCRM * Generate [ICML](http://docs.intarocrm.ru/index.php?n=Пользователи.ФорматICML) (IntaroCRM Markup Language) for catalog loading by IntaroCRM
Installation Installation
------------- -------------

View File

@ -90,7 +90,7 @@ class ICrmOrderActions
self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError()); self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError());
if ($api->getStatusCode() != 460) // some orders were sent if ($api->getStatusCode() != 460) // some orders were sent
return false; // in pack mode return errors return true;
} }
} }
@ -120,9 +120,10 @@ class ICrmOrderActions
if($api->getStatusCode() != 460) // some orders were sent if($api->getStatusCode() != 460) // some orders were sent
return false; // in pack mode return errors return false; // in pack mode return errors
}
if($lastOrderId)
COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, $lastOrderId); COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, $lastOrderId);
}
return true; // end of pack return true; // end of pack
} }
@ -194,6 +195,9 @@ class ICrmOrderActions
$rsUser = CUser::GetByID($arFields['USER_ID']); $rsUser = CUser::GetByID($arFields['USER_ID']);
$arUser = $rsUser->Fetch(); $arUser = $rsUser->Fetch();
$createdAt = new \DateTime($arUser['DATE_REGISTER']);
$createdAt = $createdAt->format('Y-m-d H:i:s');
// push customer (for crm) // push customer (for crm)
$firstName = self::toJSON($arUser['NAME']); $firstName = self::toJSON($arUser['NAME']);
$lastName = self::toJSON($arUser['LAST_NAME']); $lastName = self::toJSON($arUser['LAST_NAME']);
@ -216,7 +220,8 @@ class ICrmOrderActions
'lastName' => $lastName, 'lastName' => $lastName,
'firstName' => $firstName, 'firstName' => $firstName,
'patronymic' => $patronymic, 'patronymic' => $patronymic,
'phones' => $phones 'phones' => $phones,
'createdAt' => $createdAt
)); ));
$customer = $api->customerEdit($result); $customer = $api->customerEdit($result);
@ -251,7 +256,7 @@ class ICrmOrderActions
break; break;
case 'ADDRESS': $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']); case 'ADDRESS': $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']);
break; break;
case 'FIO': $resOrder['contactName'] = self::toJSON($ar['VALUE']); case 'FIO': $resOrder['contactName'] = explode(" ", self::toJSON($ar['VALUE']));
break; break;
case 'PHONE': $resOrder['phone'] = $ar['VALUE']; case 'PHONE': $resOrder['phone'] = $ar['VALUE'];
break; break;
@ -270,6 +275,9 @@ class ICrmOrderActions
else else
$pr = ''; $pr = '';
if($p['DISCOUNT_VALUE'])
$p['DISCOUNT_PRICE'] = null;
$items[] = array( $items[] = array(
'initialPrice' => (double) $p['PRICE'] + (double) $p['DISCOUNT_PRICE'], 'initialPrice' => (double) $p['PRICE'] + (double) $p['DISCOUNT_PRICE'],
'purchasePrice' => $pr, 'purchasePrice' => $pr,
@ -284,12 +292,13 @@ class ICrmOrderActions
if($arFields['CANCELED'] == 'Y') if($arFields['CANCELED'] == 'Y')
$arFields['STATUS_ID'] = $arFields['CANCELED']; $arFields['STATUS_ID'] = $arFields['CANCELED'];
$createdAt = \datetime::createfromformat('Y-m-d H:i:s', $arFields['DATE_INSERT']); $createdAt = new \DateTime($arFields['DATE_INSERT']);
if($createdAt) $createdAt = $createdAt->format('Y-m-d H:i:s');
$createdAt = $createdAt->format('d-m-Y H:i:s');
$resOrder = self::clearArr(array( $resOrder = self::clearArr(array(
'contactName' => $resOrder['contactName'], 'firstName' => $resOrder['contactName'][0],
'lastName' => $resOrder['contactName'][1],
'patronymic' => $resOrder['contactName'][2],
'phone' => $resOrder['phone'], 'phone' => $resOrder['phone'],
'email' => $resOrder['email'], 'email' => $resOrder['email'],
'deliveryCost' => $arFields['PRICE_DELIVERY'], 'deliveryCost' => $arFields['PRICE_DELIVERY'],

View File

@ -6,7 +6,8 @@ class RestApi
protected $apiUrl; protected $apiUrl;
protected $apiKey; protected $apiKey;
protected $apiVersion = '1'; protected $apiVersion = '1';
protected $lastError;
protected $response;
protected $statusCode; protected $statusCode;
protected $parameters; protected $parameters;
@ -30,16 +31,23 @@ class RestApi
/* Получение кода статуса и сообщения об ошибке */ /* Получение кода статуса и сообщения об ошибке */
public function getLastError() public function getLastError()
{ {
if (!is_null($this->lastError)) if (isset($this->response['errorMsg']) && isset($this->response['errors']))
return $this->statusCode . ' ' . $this->lastError; {
$result = $this->statusCode . ' ' . $this->response['errorMsg'];
foreach ($this->response['errors'] as $error)
$result .= ' ' . $error;
}
elseif (isset($this->response['errorMsg']))
$result = $this->statusCode . ' ' . $this->response['errorMsg'];
else else
return null; $result = null;
return $result;
} }
/* Псообщения об ошибке */ /* Псообщения об ошибке */
public function getLastErrorMessage() public function getLastErrorMessage()
{ {
return $this->lastError; return $this->response['errorMsg'];
} }
@ -94,7 +102,7 @@ class RestApi
} }
/** /**
* Загрузка нескольких заказов * Пакетная загрузка заказов
* *
* @param array $orders - массив заказов * @param array $orders - массив заказов
* @return array * @return array
@ -106,6 +114,8 @@ class RestApi
$url = $this->apiUrl.'orders/upload'; $url = $this->apiUrl.'orders/upload';
$result = $this->curlRequest($url, 'POST'); $result = $this->curlRequest($url, 'POST');
if (is_null($result) && isset($result['uploadedOrders']))
return $result['uploadedOrders'];
return $result; return $result;
} }
@ -154,9 +164,7 @@ class RestApi
public function orderHistory($startDate = null, $endDate = null, $limit = 100, $offset = 0) public function orderHistory($startDate = null, $endDate = null, $limit = 100, $offset = 0)
{ {
$url = $this->apiUrl.'orders/history'; $url = $this->apiUrl.'orders/history';
if($startDate)
$this->parameters['startDate'] = $startDate; $this->parameters['startDate'] = $startDate;
if($endDate)
$this->parameters['endDate'] = $endDate; $this->parameters['endDate'] = $endDate;
$this->parameters['limit'] = $limit; $this->parameters['limit'] = $limit;
$this->parameters['offset'] = $offset; $this->parameters['offset'] = $offset;
@ -215,6 +223,26 @@ class RestApi
return $result; return $result;
} }
/**
* Пакетная загрузка клиентов
*
* @param array $customers - массив клиентов
* @return array
*/
public function customerUpload($customers)
{
$dataJson = json_encode($customers);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['customers'] = $dataJson;
$url = $this->apiUrl.'customers/upload';
$result = $this->curlRequest($url, 'POST');
if (is_null($result) && isset($result['uploaded']))
return $result['uploaded'];
return $result;
}
/** /**
* Удаление клиента * Удаление клиента
* *
@ -415,8 +443,17 @@ class RestApi
return $result; return $result;
} }
/**
* Обновление статистики
*
* @return array - статус вып обновления
*/
public function statisticUpdate()
{
$url = $this->apiUrl.'statistic/update';
$result = $this->curlRequest($url);
return $result;
}
protected function curlRequest($url, $method = 'GET', $format = 'json') protected function curlRequest($url, $method = 'GET', $format = 'json')
{ {
@ -444,22 +481,21 @@ class RestApi
if (curl_errno($ch)) if (curl_errno($ch))
{ {
$this->lastError = 'Curl error: ' . curl_error($ch); $this->response = array('errorMsg' => 'Curl error: ' . curl_error($ch));
return null; return null;
} }
curl_close($ch); curl_close($ch);
$result = (array)json_decode($response, true); $result = (array)json_decode($response, true);
$this->response = $result;
if ($result['success'] == false) if ($result['success'] == false)
{
$this->lastError = $result['errorMsg'];
return null; return null;
}
$this->lastError = null;
unset($result['success']); unset($result['success']);
if (count($result) == 0) if (count($result) == 0)
return true; return true;
return reset($result); return reset($result);
} }
} }
?>

View File

@ -124,7 +124,7 @@ if ($STEP==1)
<td width="0%" valign="top"></td> <td width="0%" valign="top"></td>
<td width="100%" valign="top"> <td width="100%" valign="top">
<font class="text"> <font class="text">
<?echo GetMessage("CET_SAVE_FILENAME");?> <input type="text" name="SETUP_FILE_NAME" value="<?echo htmlspecialcharsbx(strlen($SETUP_FILE_NAME)>0 ? $SETUP_FILE_NAME : (COption::GetOptionString("catalog", "export_default_path", "/bitrix/catalog_export/"))."yandex_".mt_rand(0, 999999).".php"); ?>" size="50"> <?echo GetMessage("CET_SAVE_FILENAME");?> <input type="text" name="SETUP_FILE_NAME" value="<?echo htmlspecialcharsbx(strlen($SETUP_FILE_NAME)>0 ? $SETUP_FILE_NAME : (COption::GetOptionString("catalog", "export_default_path", "/bitrix/catalog_export/"))."intarocrm"/* .mt_rand(0, 999999) */.".php"); ?>" size="50">
</font> </font>
<br><br> <br><br>
</td> </td>
@ -150,8 +150,8 @@ if ($STEP==1)
</td> </td>
<td width="100%" valign="top"> <td width="100%" valign="top">
<input type="hidden" name="lang" value="<?echo LANGUAGE_ID ?>"> <input type="hidden" name="lang" value="<?echo LANGUAGE_ID ?>">
<input type="hidden" name="ACT_FILE" value="<?echo htmlspecialcharsbx($_REQUEST["ACT_FILE"]) ?>"> <input type="hidden" name="ACT_FILE" value="<?echo htmlspecialchars($_REQUEST["ACT_FILE"]) ?>">
<input type="hidden" name="ACTION" value="<?echo htmlspecialcharsbx($ACTION) ?>"> <input type="hidden" name="ACTION" value="<?echo htmlspecialchars($ACTION) ?>">
<input type="hidden" name="STEP" value="<?echo intval($STEP) + 1 ?>"> <input type="hidden" name="STEP" value="<?echo intval($STEP) + 1 ?>">
<input type="hidden" name="SETUP_FIELDS_LIST" value="YANDEX_EXPORT,SETUP_SERVER_NAME,SETUP_FILE_NAME"> <input type="hidden" name="SETUP_FIELDS_LIST" value="YANDEX_EXPORT,SETUP_SERVER_NAME,SETUP_FILE_NAME">
<input type="submit" value="<?echo ($ACTION=="EXPORT")?GetMessage("CET_EXPORT"):GetMessage("CET_SAVE")?>"> <input type="submit" value="<?echo ($ACTION=="EXPORT")?GetMessage("CET_EXPORT"):GetMessage("CET_SAVE")?>">

View File

@ -59,6 +59,7 @@ class intaro_intarocrm extends CModule
global $APPLICATION, $step, $arResult; global $APPLICATION, $step, $arResult;
include($this->INSTALL_PATH . '/../classes/general/RestApi.php'); include($this->INSTALL_PATH . '/../classes/general/RestApi.php');
include($this->INSTALL_PATH . '/../classes/general/ICrmOrderActions.php');
$step = intval($_REQUEST['step']); $step = intval($_REQUEST['step']);
@ -141,6 +142,7 @@ class intaro_intarocrm extends CModule
$arResult['paymentTypesList'] = $this->INTARO_CRM_API->paymentTypesList(); $arResult['paymentTypesList'] = $this->INTARO_CRM_API->paymentTypesList();
$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
//bitrix orderTypesList -- personTypes //bitrix orderTypesList -- personTypes
$dbOrderTypesList = CSalePersonType::GetList( $dbOrderTypesList = CSalePersonType::GetList(
@ -234,8 +236,6 @@ class intaro_intarocrm extends CModule
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)) {
include($this->INSTALL_PATH . '/../classes/general/ICrmOrderActions.php');
ICrmOrderActions::uploadOrders(true); // each 50 ICrmOrderActions::uploadOrders(true); // each 50
$lastUpOrderId = COption::GetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0); $lastUpOrderId = COption::GetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
@ -249,8 +249,14 @@ class intaro_intarocrm extends CModule
$percent = 100 - round(($countLeft * 100 / $countAll), 1); $percent = 100 - round(($countLeft * 100 / $countAll), 1);
if(!$countLeft) if(!$countLeft) {
$api_host = COption::GetOptionString($mid, $this->CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString($mid, $this->CRM_API_KEY_OPTION, 0);
$this->INTARO_CRM_API = new \IntaroCrm\RestApi($api_host, $api_key);
$this->INTARO_CRM_API->statisticUpdate();
$finish = 1; $finish = 1;
}
$APPLICATION->RestartBuffer(); $APPLICATION->RestartBuffer();
header('Content-Type: application/x-javascript; charset='.LANG_CHARSET); header('Content-Type: application/x-javascript; charset='.LANG_CHARSET);
@ -359,25 +365,6 @@ class intaro_intarocrm extends CModule
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT, serialize($paymentArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT, serialize($paymentArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0); COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
/*RegisterModule($this->MODULE_ID);
//agent
$dateAgent = new DateTime();
$intAgent = new DateInterval('PT600S'); // PT60S - 60 sec; 600 - 600 sec
$dateAgent->add($intAgent);
CAgent::AddAgent(
"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
30
);
$this->CopyFiles(); */
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), GetMessage('MODULE_INSTALL_TITLE'),
@ -445,7 +432,7 @@ class intaro_intarocrm extends CModule
} }
function DeleteFiles() { function DeleteFiles() {
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/crm_run.php'); unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_run.php');
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/crm_setup.php'); unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_setup.php');
} }
} }

View File

@ -24,7 +24,7 @@ $defaultPayTypes = array (
); );
$defaultPayStatuses = array ( $defaultPayStatuses = array (
'N' => 'in-processing', 'N' => 'new',
'P' => 'approval', 'P' => 'approval',
'F' => 'complete', 'F' => 'complete',
'Y' => 'cancel-other' 'Y' => 'cancel-other'
@ -106,12 +106,16 @@ $defaultPayment = array(
<td width="50%" class="adm-detail-content-cell-r"> <td width="50%" class="adm-detail-content-cell-r">
<select name="payment-status-<?php echo $bitrixPaymentStatus['ID']; ?>" class="typeselect"> <select name="payment-status-<?php echo $bitrixPaymentStatus['ID']; ?>" class="typeselect">
<option value="" selected=""></option> <option value="" selected=""></option>
<?php foreach($arResult['paymentList'] as $payment): ?> <?php foreach($arResult['paymentGroupList'] as $orderStatusGroup): if(!empty($orderStatusGroup['statuses'])) : ?>
<option value="<?php echo $payment['code']; ?>" <optgroup label="<?php echo $orderStatusGroup['name']; ?>">
<?php if($defaultPayStatuses[$bitrixPaymentStatus['ID']] == $payment['code']) echo 'selected'; ?>> <?php foreach($orderStatusGroup['statuses'] as $payment): ?>
<?php echo $APPLICATION->ConvertCharset($payment['name'], 'utf-8', SITE_CHARSET); ?> <option value="<?php echo $arResult['paymentList'][$payment]['code']; ?>"
<?php if ($defaultPayStatuses[$bitrixPaymentStatus['ID']] == $arResult['paymentList'][$payment]['code']) echo 'selected'; ?>>
<?php echo $APPLICATION->ConvertCharset($arResult['paymentList'][$payment]['name'], 'utf-8', SITE_CHARSET); ?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</optgroup>
<?php endif; endforeach; ?>
</select> </select>
</td> </td>
</tr> </tr>

View File

@ -73,15 +73,23 @@ IncludeModuleLangFile(__FILE__);
$(document).ready(function() { $(document).ready(function() {
var globStop = false; var globStop = false;
$('#percent').width($('.instal-progress-bar-outer').width());
$(window).resize(function(){ // strechin progress bar
$('#percent').width($('.instal-progress-bar-outer').width());
});
// orderUpload function // orderUpload function
function orderUpload(finish) { function orderUpload(finish) {
if(globStop) if(globStop)
return false; return false;
if(finish == 1) { if(finish == 1) {
$('#status').text('<?php echo GetMessage('MESS_3'); ?>'); $('#status').text('<?php echo GetMessage("MESS_3"); ?>');
BX.closeWait(); BX.closeWait();
$('input[name="inst"]').css('opacity', '1').removeAttr('disabled'); $('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 return true; // exit from function, end recursion
} }
@ -107,6 +115,16 @@ IncludeModuleLangFile(__FILE__);
orderUpload(response.finish); // wait until next response 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'); ?>');
} }
}); });
} }

View File

@ -1,5 +1,5 @@
<? <?
$arModuleVersion = array( $arModuleVersion = array(
'VERSION' => '0.3.5', 'VERSION' => '0.3.6',
'VERSION_DATE' => '2013-07-24 18:27:00', 'VERSION_DATE' => '2013-07-29 12:29:00',
); );

View File

@ -7,7 +7,7 @@ $MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты';
$MESS ['PAYMENT_STATUS_LIST'] = 'Статусы'; $MESS ['PAYMENT_STATUS_LIST'] = 'Статусы';
$MESS ['ORDER_TYPES_LIST'] = 'Типы заказа'; $MESS ['ORDER_TYPES_LIST'] = 'Типы заказа';
$MESS ['PAYMENT_LIST'] = 'Оплата'; $MESS ['PAYMENT_LIST'] = 'Оплата';
$MESS ['PAYMENT_Y'] = 'Флаг «Отменен»'; $MESS ['PAYMENT_Y'] = 'Оплачен';
$MESS ['PAYMENT_N'] = 'Не оплачен'; $MESS ['PAYMENT_N'] = 'Не оплачен';
$MESS ['CANCELED'] = 'Отменен'; $MESS ['CANCELED'] = 'Флаг «Отменен»';
$MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками IntaroCRM.'; $MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками IntaroCRM.';

View File

@ -1,11 +1,12 @@
<?php <?php
$MESS ['STEP_NAME'] = 'Шаг 3'; $MESS ['STEP_NAME'] = 'Шаг 3';
$MESS ['MESS_1'] = 'Нажмите кнопку для экспорта оформленных ранее заказов в IntaroCRM.'; $MESS ['MESS_1'] = 'На данном шаге вы можете выгрузить ранее оформленные заказы в IntaroCRM. Для запуска выгрузки нажмите кнопку «Начать выгрузку».';
$MESS ['MESS_2'] = 'Экспорт...'; $MESS ['MESS_2'] = 'Экспорт...';
$MESS ['MESS_3'] = 'Экспорт заказов успешно завершён.'; $MESS ['MESS_3'] = 'Экспорт заказов успешно завершён.';
$MESS ['MESS_4'] = 'Экспорт заказов приостановлен.'; $MESS ['MESS_4'] = 'Экспорт заказов приостановлен.';
$MESS ['MESS_5'] = 'Произошла ошибка сервера, обратитесь в Интаро Софт.';
$MESS ['STOP'] = 'Приостановить выгрузку'; $MESS ['STOP'] = 'Приостановить выгрузку';
$MESS ['START_1'] = 'Начать выгрузку'; $MESS ['START_1'] = 'Начать выгрузку';
$MESS ['START_2'] = 'Приостановить выгрузку'; $MESS ['START_2'] = 'Приостановить выгрузку';
$MESS ['START_3'] = 'Вообновить выгрузку'; $MESS ['START_3'] = 'Возобновить выгрузку';
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг'; $MESS ['MOD_NEXT_STEP'] = 'Завершить установку';

View File

@ -21,4 +21,4 @@ $MESS ['ERR_404'] = 'Возможно не верно введен адрес CR
$MESS ['ERR_403'] = 'Неверный apiKey.'; $MESS ['ERR_403'] = 'Неверный apiKey.';
$MESS ['ERR_0'] = 'Превышено время ожидания ответа от сервера.'; $MESS ['ERR_0'] = 'Превышено время ожидания ответа от сервера.';
$MESS ['ICRM_OPTIONS_OK'] = 'Изменения успешно сохранены.'; $MESS ['ICRM_OPTIONS_OK'] = 'Изменения успешно сохранены.';
$MESS ['CANCELED'] = 'Отменен'; $MESS ['CANCELED'] = 'Флаг «Отменен»';

View File

@ -152,6 +152,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$arResult['paymentTypesList'] = $api->paymentTypesList(); $arResult['paymentTypesList'] = $api->paymentTypesList();
$arResult['paymentStatusesList'] = $api->paymentStatusesList(); // --statuses $arResult['paymentStatusesList'] = $api->paymentStatusesList(); // --statuses
$arResult['paymentList'] = $api->orderStatusesList(); $arResult['paymentList'] = $api->orderStatusesList();
$arResult['paymentGroupList'] = $api->orderStatusGroupsList(); // -- statuses groups
//check connection & apiKey valid //check connection & apiKey valid
if ((int) $api->getStatusCode() != 200) if ((int) $api->getStatusCode() != 200)
@ -336,11 +337,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<td width="50%" class="adm-detail-content-cell-r"> <td width="50%" class="adm-detail-content-cell-r">
<select name="payment-status-<?php echo $bitrixPaymentStatus['ID']; ?>" class="typeselect"> <select name="payment-status-<?php echo $bitrixPaymentStatus['ID']; ?>" class="typeselect">
<option value=""></option> <option value=""></option>
<?php foreach($arResult['paymentList'] as $payment): ?> <?php foreach($arResult['paymentGroupList'] as $orderStatusGroup): if(!empty($orderStatusGroup['statuses'])) : ?>
<option value="<?php echo $payment['code']; ?>" <?php if ($optionsPayStatuses[$bitrixPaymentStatus['ID']] == $payment['code']) echo 'selected'; ?>> <optgroup label="<?php echo $orderStatusGroup['name']; ?>">
<?php echo $APPLICATION->ConvertCharset($payment['name'], 'utf-8', SITE_CHARSET); ?> <?php foreach($orderStatusGroup['statuses'] as $payment): ?>
<option value="<?php echo $arResult['paymentList'][$payment]['code']; ?>" <?php if ($optionsPayStatuses[$bitrixPaymentStatus['ID']] == $arResult['paymentList'][$payment]['code']) echo 'selected'; ?>>
<?php echo $APPLICATION->ConvertCharset($arResult['paymentList'][$payment]['name'], 'utf-8', SITE_CHARSET); ?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</optgroup>
<?php endif; endforeach; ?>
</select> </select>
</td> </td>
</tr> </tr>