1
0
mirror of synced 2024-11-25 14:56:09 +03:00

working props order settings

This commit is contained in:
Grisha Pomadchin 2013-08-02 17:05:12 +04:00
parent cdef1b84c5
commit 8935639265
5 changed files with 104 additions and 25 deletions

View File

@ -256,14 +256,6 @@ class ICrmOrderActions
switch ($ar['CODE']) {
case $arParams['optionsOrderProps']['index']: $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['city']: if ($arParams['optionsOrderProps']['index'] == 'LOCATION') {
if (!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city']) {
$resOrderDeliveryAddress['city'] = CSaleLocation::GetByID($ar['VALUE']);
$resOrderDeliveryAddress['city'] = self::toJSON($resOrderDeliveryAddress['city']['CITY_NAME_LANG']);
}
} else
$resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']);
break;
case 'CITY': if (!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city'])
$resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']); // we check both locations & city for export
break;
@ -281,6 +273,31 @@ class ICrmOrderActions
case $arParams['optionsOrderProps']['email']: $resOrder['email'] = $ar['VALUE'];
break;
}
if (count($arParams['optionsOrderProps'] > 5)) {
switch ($ar['CODE']) {
case $arParams['optionsOrderProps']['country']: $resOrderDeliveryAddress['country'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['region']: $resOrderDeliveryAddress['region'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['city']: $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['street']: $resOrderDeliveryAddress['street'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['building']: $resOrderDeliveryAddress['building'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['flat']: $resOrderDeliveryAddress['flat'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['inercomcode']: $resOrderDeliveryAddress['intercomcode'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['floor']: $resOrderDeliveryAddress['floor'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['block']: $resOrderDeliveryAddress['block'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['house']: $resOrderDeliveryAddress['house'] = self::toJSON($ar['VALUE']);
break;
}
}
}
$items = array();

View File

@ -367,7 +367,6 @@ class intaro_intarocrm extends CModule
// orderProps assoc arr
$orderPropsArr = array(
'city' => 'CITY',
'fio' => 'FIO',
'index' => 'ZIP',
'text' => 'ADDRESS',

View File

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

View File

@ -26,8 +26,19 @@ $MESS ['CANCELED'] = 'Флаг «Отменен»';
$MESS ['ORDER_PROPS'] = 'Настройки соответствия полей заказа IntaroCRM свойствам заказа 1С-Битрикс';
$MESS ['FIO'] = 'ф.И.О.';
$MESS ['CITY'] = 'Город';
$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

@ -26,16 +26,35 @@ if($_GET['ok'] && $_GET['ok'] == 'Y') echo CAdminMessage::ShowNote(GetMessage('I
$arResult = array();
$arResult['orderProps'][0]['NAME'] = GetMessage('FIO');
$arResult['orderProps'][0]['ID'] = 'fio';
$arResult['orderProps'][1]['NAME'] = GetMessage('CITY');
$arResult['orderProps'][1]['ID'] = 'city';
$arResult['orderProps'][2]['NAME'] = GetMessage('ZIP');
$arResult['orderProps'][2]['ID'] = 'index';
$arResult['orderProps'][3]['NAME'] = GetMessage('ADDRESS');
$arResult['orderProps'][3]['ID'] = 'text';
$arResult['orderProps'][4]['NAME'] = GetMessage('PHONE');
$arResult['orderProps'][4]['ID'] = 'phone';
$arResult['orderProps'][5]['NAME'] = GetMessage('EMAIL');
$arResult['orderProps'][5]['ID'] = 'email';
$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')) {
@ -145,8 +164,13 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$paymentArr['Y'] = htmlspecialchars(trim($_POST['payment-Y']));
$paymentArr['N'] = htmlspecialchars(trim($_POST['payment-N']));
foreach($arResult['orderProps'] as $orderProp)
$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_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr));
@ -297,6 +321,19 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$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();
@ -425,8 +462,18 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<tr class="heading">
<td colspan="2"><b><?php echo GetMessage('ORDER_PROPS'); ?></b></td>
</tr>
<?php foreach($arResult['orderProps'] as $orderProp): ?>
<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>
@ -441,7 +488,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</select>
</td>
</tr>
<?php endforeach; ?>
<?php $countProps++; endforeach; ?>
<?php $tabControl->BeginNextTab(); ?>
<?php $tabControl->Buttons(); ?>
<input type="hidden" name="Update" value="Y" />