1
0
mirror of synced 2024-11-22 05:16:09 +03:00
This commit is contained in:
Grisha Pomadchin 2013-08-06 15:02:11 +04:00
parent 2e4d520f65
commit f101809165
6 changed files with 22 additions and 186 deletions

View File

@ -11,7 +11,6 @@ class ICrmOrderActions
protected static $CRM_PAYMENT_STATUSES = 'pay_statuses_arr'; protected static $CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
protected static $CRM_PAYMENT = 'payment_arr'; //order payment Y/N protected static $CRM_PAYMENT = 'payment_arr'; //order payment Y/N
protected static $CRM_ORDER_LAST_ID = 'order_last_id'; protected static $CRM_ORDER_LAST_ID = 'order_last_id';
protected static $CRM_ORDER_PROPS = 'order_props';
/** /**
* Mass order uploading, without repeating; always returns true, but writes error log * Mass order uploading, without repeating; always returns true, but writes error log
@ -55,7 +54,6 @@ class ICrmOrderActions
$optionsPayTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_TYPES, 0)); $optionsPayTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_TYPES, 0));
$optionsPayStatuses = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0)); // --statuses $optionsPayStatuses = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0)); // --statuses
$optionsPayment = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT, 0)); $optionsPayment = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT, 0));
$optionsOrderProps = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_PROPS, 0));
$api = new IntaroCrm\RestApi($api_host, $api_key); $api = new IntaroCrm\RestApi($api_host, $api_key);
@ -64,8 +62,7 @@ class ICrmOrderActions
'optionsDelivTypes' => $optionsDelivTypes, 'optionsDelivTypes' => $optionsDelivTypes,
'optionsPayTypes' => $optionsPayTypes, 'optionsPayTypes' => $optionsPayTypes,
'optionsPayStatuses' => $optionsPayStatuses, 'optionsPayStatuses' => $optionsPayStatuses,
'optionsPayment' => $optionsPayment, 'optionsPayment' => $optionsPayment
'optionsOrderProps' => $optionsOrderProps
); );
// pack mode enable / disable // pack mode enable / disable
@ -186,7 +183,7 @@ class ICrmOrderActions
if(!$api || empty($arParams)) { // add cond to check $arParams if(!$api || empty($arParams)) { // add cond to check $arParams
return false; return false;
} }
if (empty($arFields)) { if (empty($arFields)) {
//handle err //handle err
self::eventLog('ICrmOrderActions::orderCreate', 'empty($arFields)', 'incorrect order'); self::eventLog('ICrmOrderActions::orderCreate', 'empty($arFields)', 'incorrect order');
@ -252,50 +249,24 @@ class ICrmOrderActions
$rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID'])); $rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
while ($ar = $rsOrderProps->Fetch()) { while ($ar = $rsOrderProps->Fetch()) {
switch ($ar['CODE']) { switch ($ar['CODE']) {
case $arParams['optionsOrderProps']['index']: $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']); case 'ZIP': $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']);
break; break;
case 'CITY': if (!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city']) case 'CITY': $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']);
$resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']); // we check both locations & city for export
break; break;
case $arParams['optionsOrderProps']['text']: $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']); case 'ADDRESS': $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']);
break; break;
case 'LOCATION': if (!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city']) { case 'LOCATION': if(!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city']) {
$resOrderDeliveryAddress['city'] = CSaleLocation::GetByID($ar['VALUE']); $resOrderDeliveryAddress['city'] = CSaleLocation::GetByID($ar['VALUE']);
$resOrderDeliveryAddress['city'] = self::toJSON($resOrderDeliveryAddress['city']['CITY_NAME_LANG']); $resOrderDeliveryAddress['city'] = self::toJSON($resOrderDeliveryAddress['city']['CITY_NAME_LANG']);
} }
break; break;
case $arParams['optionsOrderProps']['fio']: $resOrder['contactName'] = explode(" ", self::toJSON($ar['VALUE'])); case 'FIO': $resOrder['contactName'] = explode(" ", self::toJSON($ar['VALUE']));
break; break;
case $arParams['optionsOrderProps']['phone']: $resOrder['phone'] = $ar['VALUE']; case 'PHONE': $resOrder['phone'] = $ar['VALUE'];
break; break;
case $arParams['optionsOrderProps']['email']: $resOrder['email'] = $ar['VALUE']; case 'EMAIL': $resOrder['email'] = $ar['VALUE'];
break; 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(); $items = array();

View File

@ -30,7 +30,6 @@ class intaro_intarocrm extends CModule
var $CRM_PAYMENT_STATUSES = 'pay_statuses_arr'; var $CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
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_PROPS = 'order_props';
var $INSTALL_PATH; var $INSTALL_PATH;
@ -255,8 +254,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);
@ -358,15 +363,6 @@ class intaro_intarocrm extends CModule
$paymentArr = array(); $paymentArr = array();
$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']));
// orderProps assoc arr
$orderPropsArr = array(
'fio' => 'FIO',
'index' => 'ZIP',
'text' => 'ADDRESS',
'phone' => 'PHONE',
'email' => 'EMAIL'
);
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));
@ -374,7 +370,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);
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_PROPS, serialize($orderPropsArr));
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), GetMessage('MODULE_INSTALL_TITLE'),
@ -402,12 +397,6 @@ class intaro_intarocrm extends CModule
); );
$this->CopyFiles(); $this->CopyFiles();
//statistic update
$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);
$this->INTARO_CRM_API = new \IntaroCrm\RestApi($api_host, $api_key);
$this->INTARO_CRM_API->statisticUpdate();
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), GetMessage('MODULE_INSTALL_TITLE'),
@ -419,7 +408,7 @@ class intaro_intarocrm extends CModule
function DoUninstall() { function DoUninstall() {
global $APPLICATION; global $APPLICATION;
CAgent::RemoveAgent("ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID); CAgent::RemoveAgent("ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID);
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_HOST_OPTION); COption::RemoveOption($this->MODULE_ID, $this->CRM_API_HOST_OPTION);
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_KEY_OPTION); COption::RemoveOption($this->MODULE_ID, $this->CRM_API_KEY_OPTION);
@ -453,4 +442,4 @@ class intaro_intarocrm extends CModule
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_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/intarocrm_setup.php'); unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_setup.php');
} }
} }

View File

@ -1,5 +1,5 @@
<? <?
$arModuleVersion = array( $arModuleVersion = array(
'VERSION' => '0.3.7', 'VERSION' => '0.3.6',
'VERSION_DATE' => '2013-08-06 13:13:00', 'VERSION_DATE' => '2013-07-29 12:29:00',
); );

View File

@ -1,5 +0,0 @@
<?
$arModuleVersion = array(
'VERSION' => '0.4.6',
'VERSION_DATE' => '2013-07-25 15:35:00',
);

View File

@ -1,7 +1,6 @@
<?php <?php
$MESS ['ICRM_OPTIONS_GENERAL_TAB'] = 'Общие настройки'; $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_CONN_SETTINGS'] = 'Настройка соединения';
$MESS ['ICRM_API_HOST'] = 'Адрес Intaro CRM:'; $MESS ['ICRM_API_HOST'] = 'Адрес Intaro CRM:';
$MESS ['ICRM_API_KEY'] = 'Ключ авторизации:'; $MESS ['ICRM_API_KEY'] = 'Ключ авторизации:';
@ -22,23 +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'] = 'Флаг «Отменен»';
$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

@ -11,7 +11,6 @@ $CRM_PAYMENT_TYPES = 'pay_types_arr';
$CRM_PAYMENT_STATUSES = 'pay_statuses_arr'; $CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
$CRM_PAYMENT = 'payment_arr'; //order payment Y/N $CRM_PAYMENT = 'payment_arr'; //order payment Y/N
$CRM_ORDER_LAST_ID = 'order_last_id'; $CRM_ORDER_LAST_ID = 'order_last_id';
$CRM_ORDER_PROPS = 'order_props';
if(!CModule::IncludeModule('intaro.intarocrm') if(!CModule::IncludeModule('intaro.intarocrm')
|| !CModule::IncludeModule('sale')) || !CModule::IncludeModule('sale'))
@ -24,37 +23,6 @@ if($_GET['errc']) echo CAdminMessage::ShowMessage(GetMessage($_GET['errc']));
if($_GET['ok'] && $_GET['ok'] == 'Y') echo CAdminMessage::ShowNote(GetMessage('ICRM_OPTIONS_OK')); if($_GET['ok'] && $_GET['ok'] == 'Y') echo CAdminMessage::ShowNote(GetMessage('ICRM_OPTIONS_OK'));
$arResult = array(); $arResult = array();
$arResult['orderProps'][0]['NAME'] = GetMessage('FIO');
$arResult['orderProps'][0]['ID'] = 'fio';
$arResult['orderProps'][1]['NAME'] = GetMessage('ZIP');
$arResult['orderProps'][1]['ID'] = 'index';
$arResult['orderProps'][2]['NAME'] = GetMessage('PHONE');
$arResult['orderProps'][2]['ID'] = 'phone';
$arResult['orderProps'][3]['NAME'] = GetMessage('EMAIL');
$arResult['orderProps'][3]['ID'] = 'email';
// address
$arResult['orderProps'][4]['NAME'] = GetMessage('ADDRESS');
$arResult['orderProps'][4]['ID'] = 'text';
$arResult['orderProps'][5]['NAME'] = GetMessage('COUNTRY');
$arResult['orderProps'][5]['ID'] = 'country';
$arResult['orderProps'][6]['NAME'] = GetMessage('REGION');
$arResult['orderProps'][6]['ID'] = 'region';
$arResult['orderProps'][7]['NAME'] = GetMessage('CITY');
$arResult['orderProps'][7]['ID'] = 'city';
$arResult['orderProps'][8]['NAME'] = GetMessage('STREET');
$arResult['orderProps'][8]['ID'] = 'street';
$arResult['orderProps'][9]['NAME'] = GetMessage('BUILDING');
$arResult['orderProps'][9]['ID'] = 'building';
$arResult['orderProps'][10]['NAME'] = GetMessage('FLAT');
$arResult['orderProps'][10]['ID'] = 'flat';
$arResult['orderProps'][11]['NAME'] = GetMessage('INTERCOMCODE');
$arResult['orderProps'][11]['ID'] = 'intercomecode';
$arResult['orderProps'][12]['NAME'] = GetMessage('FLOOR');
$arResult['orderProps'][12]['ID'] = 'floor';
$arResult['orderProps'][13]['NAME'] = GetMessage('BLOCK');
$arResult['orderProps'][13]['ID'] = 'block';
$arResult['orderProps'][14]['NAME'] = GetMessage('HOUSE');
$arResult['orderProps'][14]['ID'] = 'house';
//update connection settings //update connection settings
if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) { if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
@ -164,20 +132,11 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$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']));
$propsCount = 0;
foreach($arResult['orderProps'] as $orderProp) {
if((!(int) htmlspecialchars(trim($_POST['address-detail']))) && $propsCount > 4)
break;
$orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID']]));
$propsCount++;
}
COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr)); COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr));
COption::SetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr)); COption::SetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr));
COption::SetOptionString($mid, $CRM_PAYMENT_TYPES, serialize($paymentTypesArr)); COption::SetOptionString($mid, $CRM_PAYMENT_TYPES, serialize($paymentTypesArr));
COption::SetOptionString($mid, $CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr)); COption::SetOptionString($mid, $CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr));
COption::SetOptionString($mid, $CRM_PAYMENT, serialize($paymentArr)); COption::SetOptionString($mid, $CRM_PAYMENT, serialize($paymentArr));
COption::SetOptionString($mid, $CRM_ORDER_PROPS, serialize($orderPropsArr));
$uri .= '&ok=Y'; $uri .= '&ok=Y';
LocalRedirect($uri); LocalRedirect($uri);
@ -278,26 +237,19 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
'NAME' => GetMessage('CANCELED') 'NAME' => GetMessage('CANCELED')
); );
$dbProp = CSaleOrderProps::GetList(array(), array());
//bitrix pyament Y/N //bitrix pyament Y/N
$arResult['bitrixPaymentList'][0]['NAME'] = GetMessage('PAYMENT_Y'); $arResult['bitrixPaymentList'][0]['NAME'] = GetMessage('PAYMENT_Y');
$arResult['bitrixPaymentList'][0]['ID'] = 'Y'; $arResult['bitrixPaymentList'][0]['ID'] = 'Y';
$arResult['bitrixPaymentList'][1]['NAME'] = GetMessage('PAYMENT_N'); $arResult['bitrixPaymentList'][1]['NAME'] = GetMessage('PAYMENT_N');
$arResult['bitrixPaymentList'][1]['ID'] = 'N'; $arResult['bitrixPaymentList'][1]['ID'] = 'N';
while ($arProp = $dbProp->GetNext()) {
$arResult['arProp'][] = $arProp;
}
//saved cat params //saved cat params
$optionsOrderTypes = unserialize(COption::GetOptionString($mid, $CRM_ORDER_TYPES_ARR, 0)); $optionsOrderTypes = unserialize(COption::GetOptionString($mid, $CRM_ORDER_TYPES_ARR, 0));
$optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0)); $optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0));
$optionsPayTypes = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_TYPES, 0)); $optionsPayTypes = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_TYPES, 0));
$optionsPayStatuses = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_STATUSES, 0)); // --statuses $optionsPayStatuses = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_STATUSES, 0)); // --statuses
$optionsPayment = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT, 0)); $optionsPayment = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT, 0));
$optionsOrderProps = unserialize(COption::GetOptionString($mid, $CRM_ORDER_PROPS, 0));
$aTabs = array( $aTabs = array(
array( array(
"DIV" => "edit1", "DIV" => "edit1",
@ -311,29 +263,10 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
"ICON" => '', "ICON" => '',
"TITLE" => GetMessage('ICRM_OPTIONS_CATALOG_CAPTION') "TITLE" => GetMessage('ICRM_OPTIONS_CATALOG_CAPTION')
), ),
array(
"DIV" => "edit3",
"TAB" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_TAB'),
"ICON" => '',
"TITLE" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_CAPTION')
),
); );
$tabControl = new CAdminTabControl("tabControl", $aTabs); $tabControl = new CAdminTabControl("tabControl", $aTabs);
$tabControl->Begin(); $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[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');
});
});
</script>
<form method="POST" action="<?php echo $uri; ?>" id="FORMACTION"> <form method="POST" action="<?php echo $uri; ?>" id="FORMACTION">
<?php <?php
echo bitrix_sessid_post(); echo bitrix_sessid_post();
@ -457,38 +390,6 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<?php $tabControl->BeginNextTab(); ?>
<input type="hidden" name="tab" value="catalog">
<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>
<input type="radio" name="address-detail" value="0" <?php if(count($optionsOrderProps) < 6) echo "checked"; ?>><?php echo GetMessage('ADDRESS_SHORT'); ?>
<input type="radio" name="address-detail" value="1" <?php if(count($optionsOrderProps) > 5) echo "checked"; ?>><?php echo GetMessage('ADDRESS_FULL'); ?>
</b>
</td>
</tr>
<?php endif; ?>
<tr <?php if ($countProps > 4) echo 'class="address-detail"'; if(($countProps > 4) && (count($optionsOrderProps) < 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 ($optionsOrderProps[$orderProp['ID']] == $arProp['CODE']) echo 'selected'; ?>>
<?php echo $arProp['NAME']; ?>
</option>
<?php endforeach; ?>
</select>
</td>
</tr>
<?php $countProps++; endforeach; ?>
<?php $tabControl->BeginNextTab(); ?> <?php $tabControl->BeginNextTab(); ?>
<?php $tabControl->Buttons(); ?> <?php $tabControl->Buttons(); ?>
<input type="hidden" name="Update" value="Y" /> <input type="hidden" name="Update" value="Y" />