1
0
mirror of synced 2024-11-22 05:16:09 +03:00

inserted into options; new branch

This commit is contained in:
Grisha Pomadchin 2013-09-03 18:00:12 +04:00
parent 84d9727fa4
commit c2729dcb93
2 changed files with 121 additions and 2 deletions

View File

@ -1,6 +1,7 @@
<?php
$MESS ['ICRM_OPTIONS_GENERAL_TAB'] = 'Общие настройки';
$MESS ['ICRM_OPTIONS_IMPORT_TAB'] = 'Настройки импората';
$MESS ['ICRM_OPTIONS_IMPORT_TAB'] = 'Настройки импорта';
$MESS ['ICRM_OPTIONS_ORDER_PROPS_TAB'] = 'Cоответствия полей свойств заказа';
$MESS ['ICRM_CONN_SETTINGS'] = 'Настройка соединения';
$MESS ['ICRM_API_HOST'] = 'Адрес Intaro CRM:';
$MESS ['ICRM_API_KEY'] = 'Ключ авторизации:';
@ -23,4 +24,23 @@ $MESS ['ERR_403'] = 'Неверный apiKey.';
$MESS ['ERR_0'] = 'Превышено время ожидания ответа от сервера.';
$MESS ['ICRM_OPTIONS_OK'] = 'Изменения успешно сохранены.';
$MESS ['CANCELED'] = 'Флаг «Отменен»';
$MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками IntaroCRM.';
$MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками IntaroCRM.';
$MESS ['ORDER_PROPS'] = 'Настройки соответствия полей заказа IntaroCRM свойствам заказа 1С-Битрикс';
$MESS ['FIO'] = 'ф.И.О.';
$MESS ['ZIP'] = 'Индекс';
$MESS ['ADDRESS'] = 'Адрес (строкой)';
$MESS ['PHONE'] = 'Телефон';
$MESS ['EMAIL'] = 'E-mail';
$MESS ['COUNTRY'] = 'Страна';
$MESS ['REGION'] = 'Область / Край';
$MESS ['CITY'] = 'Город';
$MESS ['STREET'] = 'Улица';
$MESS ['BUILDING'] = 'Строение';
$MESS ['FLAT'] = 'Квартира';
$MESS ['INTERCOMCODE'] = 'Домофон';
$MESS ['FLOOR'] = 'Этаж';
$MESS ['BLOCK'] = 'Подъезд';
$MESS ['HOUSE'] = 'Строение / корпус';
$MESS ['ADDRESS_SHORT'] = 'Краткий адрес';
$MESS ['ADDRESS_FULL'] = 'Детальный адрес';

View File

@ -12,6 +12,7 @@ $CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
$CRM_PAYMENT = 'payment_arr'; //order payment Y/N
$CRM_ORDER_LAST_ID = 'order_last_id';
$CRM_ORDER_SITES = 'sites_ids';
$CRM_ORDER_PROPS = 'order_props';
if(!CModule::IncludeModule('intaro.intarocrm')
|| !CModule::IncludeModule('sale'))
@ -24,6 +25,37 @@ if($_GET['errc']) echo CAdminMessage::ShowMessage(GetMessage($_GET['errc']));
if($_GET['ok'] && $_GET['ok'] == 'Y') echo CAdminMessage::ShowNote(GetMessage('ICRM_OPTIONS_OK'));
$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
if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
@ -139,12 +171,22 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$paymentArr['Y'] = htmlspecialchars(trim($_POST['payment-Y']));
$paymentArr['N'] = htmlspecialchars(trim($_POST['payment-N']));
$propsCount = 0;
$orderPropsArr = array();
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_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr));
COption::SetOptionString($mid, $CRM_PAYMENT_TYPES, serialize($paymentTypesArr));
COption::SetOptionString($mid, $CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr));
COption::SetOptionString($mid, $CRM_PAYMENT, serialize($paymentArr));
COption::SetOptionString($mid, $CRM_ORDER_SITES, serialize($orderSites));
COption::SetOptionString($mid, $CRM_ORDER_PROPS, serialize($orderPropsArr));
$uri .= '&ok=Y';
LocalRedirect($uri);
@ -255,6 +297,11 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$arResult['bitrixPaymentList'][0]['ID'] = 'Y';
$arResult['bitrixPaymentList'][1]['NAME'] = GetMessage('PAYMENT_N');
$arResult['bitrixPaymentList'][1]['ID'] = 'N';
$dbProp = CSaleOrderProps::GetList(array(), array());
while ($arProp = $dbProp->GetNext()) {
$arResult['arProp'][] = $arProp;
}
//saved cat params
$optionsOrderTypes = unserialize(COption::GetOptionString($mid, $CRM_ORDER_TYPES_ARR, 0));
@ -263,6 +310,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$optionsPayStatuses = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_STATUSES, 0)); // --statuses
$optionsPayment = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT, 0));
$optionsSites = unserialize(COption::GetOptionString($mid, $CRM_ORDER_SITES, 0));
$optionsOrderProps = unserialize(COption::GetOptionString($mid, $CRM_ORDER_PROPS, 0));
$aTabs = array(
array(
@ -277,10 +325,29 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
"ICON" => '',
"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->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">
<?php
echo bitrix_sessid_post();
@ -417,6 +484,38 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</td>
</tr>
<?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>
<label><input type="radio" name="address-detail" value="0" <?php if(count($optionsOrderProps) < 6) echo "checked"; ?>><?php echo GetMessage('ADDRESS_SHORT'); ?></label>
<label><input type="radio" name="address-detail" value="1" <?php if(count($optionsOrderProps) > 5) echo "checked"; ?>><?php echo GetMessage('ADDRESS_FULL'); ?></label>
</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->Buttons(); ?>
<input type="hidden" name="Update" value="Y" />