+order Types support
This commit is contained in:
parent
6f97c22b54
commit
ba82f22b64
@ -128,8 +128,8 @@ class intaro_intarocrm extends CModule {
|
||||
'ID' => 'flat'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('INTERCOMECODE'),
|
||||
'ID' => 'intercomecode'
|
||||
'NAME' => GetMessage('INTERCOMCODE'),
|
||||
'ID' => 'intercomcode'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('FLOOR'),
|
||||
@ -555,7 +555,8 @@ class intaro_intarocrm extends CModule {
|
||||
);
|
||||
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'), $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step2.php'
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step2.php'
|
||||
);
|
||||
} else if ($step == 3) {
|
||||
if (!CModule::IncludeModule("sale")) {
|
||||
@ -586,9 +587,11 @@ class intaro_intarocrm extends CModule {
|
||||
|
||||
//form order types ids arr
|
||||
$orderTypesArr = array();
|
||||
$arResult['bitrixOrderTypesList'] = array();
|
||||
if ($arOrderTypesList = $dbOrderTypesList->Fetch()) {
|
||||
do {
|
||||
$orderTypesArr[$arOrderTypesList['ID']] = htmlspecialchars(trim($_POST['order-type-' . $arOrderTypesList['ID']]));
|
||||
$arResult['bitrixOrderTypesList'][] = $arOrderTypesList;
|
||||
} while ($arOrderTypesList = $dbOrderTypesList->Fetch());
|
||||
}
|
||||
|
||||
@ -738,21 +741,42 @@ class intaro_intarocrm extends CModule {
|
||||
|
||||
if (isset($_POST['back']) && $_POST['back']) {
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step2.php'
|
||||
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++;
|
||||
//bitrix orderTypesList -- personTypes
|
||||
$dbOrderTypesList = CSalePersonType::GetList(
|
||||
array(
|
||||
"SORT" => "ASC",
|
||||
"NAME" => "ASC"
|
||||
), array(
|
||||
"ACTIVE" => "Y",
|
||||
), false, false, array()
|
||||
);
|
||||
|
||||
//form order types ids arr
|
||||
$orderTypesArr = array();
|
||||
$orderTypesList = array();
|
||||
if ($arOrderTypesList = $dbOrderTypesList->Fetch()) {
|
||||
do {
|
||||
$orderTypesArr[$arOrderTypesList['ID']] = htmlspecialchars(trim($_POST['order-type-' . $arOrderTypesList['ID']]));
|
||||
$orderTypesList[] = $arOrderTypesList;
|
||||
} while ($arOrderTypesList = $dbOrderTypesList->Fetch());
|
||||
}
|
||||
|
||||
$arResult['test'] = $_POST;
|
||||
$orderPropsArr = array();
|
||||
foreach ($orderTypesList as $orderType) {
|
||||
$propsCount = 0;
|
||||
$_orderPropsArr = array();
|
||||
foreach ($arResult['orderProps'] as $orderProp) {
|
||||
if ((!(int) htmlspecialchars(trim($_POST['address-detail-' . $orderType['ID']]))) && $propsCount > 5)
|
||||
break;
|
||||
$_orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID'] . '-' . $orderType['ID']]));
|
||||
$propsCount++;
|
||||
}
|
||||
$orderPropsArr[$orderType['ID']] = $_orderPropsArr;
|
||||
}
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_PROPS, serialize($orderPropsArr));
|
||||
|
||||
@ -998,6 +1022,8 @@ class intaro_intarocrm extends CModule {
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_LAST_ID);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_SITES);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_PROPS);
|
||||
|
||||
UnRegisterModuleDependences("sale", "OnSalePayOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSalePayOrder");
|
||||
UnRegisterModuleDependences("sale", "OnSaleCancelOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSaleCancelOrder");
|
||||
|
@ -4,23 +4,34 @@ if (!check_bitrix_sessid())
|
||||
IncludeModuleLangFile(__FILE__);
|
||||
|
||||
$defaultOrderProps = array(
|
||||
1 => array(
|
||||
'fio' => 'FIO',
|
||||
'index' => 'ZIP',
|
||||
'text' => 'ADDRESS',
|
||||
'phone' => 'PHONE',
|
||||
'email' => 'EMAIL'
|
||||
),
|
||||
2 => array(
|
||||
'fio' => 'FIO',
|
||||
'index' => 'ZIP',
|
||||
'text' => 'ADDRESS',
|
||||
'phone' => 'PHONE',
|
||||
'email' => 'EMAIL'
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
<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');
|
||||
$('input.addr').change(function(){
|
||||
splitName = $(this).attr('name').split('-');
|
||||
orderType = splitName[2];
|
||||
|
||||
if(parseInt($(this).val()) === 1)
|
||||
$('tr.address-detail-' + orderType).show('slow');
|
||||
else if(parseInt($(this).val()) === 0)
|
||||
$('tr.address-detail-' + orderType).hide('slow');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@ -42,27 +53,34 @@ $defaultOrderProps = array(
|
||||
<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 align="center">
|
||||
<td colspan="2"><b><?php echo GetMessage('INFO_2'); ?></b></td>
|
||||
</tr>
|
||||
<?php foreach($arResult['bitrixOrderTypesList'] as $bitrixOrderType): ?>
|
||||
<tr class="heading">
|
||||
<td colspan="2"><b><?php echo $bitrixOrderType['NAME']; ?></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>
|
||||
<label><input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID'];; ?>" value="0" <?php if(count($defaultOrderProps[$bitrixOrderType['ID']]) < 6) echo "checked"; ?>><?php echo GetMessage('ADDRESS_SHORT'); ?></label>
|
||||
<label><input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID']; ?>" value="1" <?php if(count($defaultOrderProps[$bitrixOrderType['ID']]) > 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;"'; ?>>
|
||||
<tr <?php if ($countProps > 5) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 5) && (count($defaultOrderProps[$bitrixOrderType['ID']]) < 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">
|
||||
<select name="order-prop-<?php echo $orderProp['ID'] . '-' . $bitrixOrderType['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'; ?>>
|
||||
<option value="<?php echo $arProp['CODE']; ?>" <?php if ($defaultOrderProps[$bitrixOrderType['ID']][$orderProp['ID']] == $arProp['CODE']) echo 'selected'; ?>>
|
||||
<?php echo $arProp['NAME']; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
@ -70,6 +88,7 @@ $defaultOrderProps = array(
|
||||
</td>
|
||||
</tr>
|
||||
<?php $countProps++; endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
|
@ -25,9 +25,10 @@ $MESS ['ERR_0'] = 'Превышено время ожидания ответа
|
||||
$MESS ['ICRM_OPTIONS_OK'] = 'Изменения успешно сохранены.';
|
||||
$MESS ['CANCELED'] = 'Флаг «Отменен»';
|
||||
$MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками IntaroCRM.';
|
||||
$MESS ['INFO_2'] = ' Задайте соответствие между полями заказа 1C-Битрикс и IntaroCRM.';
|
||||
|
||||
$MESS ['ORDER_PROPS'] = 'Настройки соответствия полей заказа IntaroCRM свойствам заказа 1С-Битрикс';
|
||||
$MESS ['FIO'] = 'ф.И.О.';
|
||||
$MESS ['FIO'] = 'Ф.И.О.';
|
||||
$MESS ['ZIP'] = 'Индекс';
|
||||
$MESS ['ADDRESS'] = 'Адрес (строкой)';
|
||||
$MESS ['PHONE'] = 'Телефон';
|
||||
|
@ -81,8 +81,8 @@ $arResult['orderProps'] = array(
|
||||
'ID' => 'flat'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('INTERCOMECODE'),
|
||||
'ID' => 'intercomecode'
|
||||
'NAME' => GetMessage('INTERCOMCODE'),
|
||||
'ID' => 'intercomcode'
|
||||
),
|
||||
array(
|
||||
'NAME' => GetMessage('FLOOR'),
|
||||
@ -140,9 +140,11 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
|
||||
//form order types ids arr
|
||||
$orderTypesArr = array();
|
||||
$orderTypesList = array();
|
||||
if ($arOrderTypesList = $dbOrderTypesList->Fetch()) {
|
||||
do {
|
||||
$orderTypesArr[$arOrderTypesList['ID']] = $_POST['order-type-' . $arOrderTypesList['ID']];
|
||||
$orderTypesList[] = $arOrderTypesList;
|
||||
} while ($arOrderTypesList = $dbOrderTypesList->Fetch());
|
||||
}
|
||||
|
||||
@ -212,14 +214,18 @@ 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 > 5)
|
||||
foreach ($orderTypesList as $orderType) {
|
||||
$propsCount = 0;
|
||||
$_orderPropsArr = array();
|
||||
foreach ($arResult['orderProps'] as $orderProp) {
|
||||
if ((!(int) htmlspecialchars(trim($_POST['address-detail-' . $orderType['ID']]))) && $propsCount > 5)
|
||||
break;
|
||||
$orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID']]));
|
||||
$_orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID'] . '-' . $orderType['ID']]));
|
||||
$propsCount++;
|
||||
}
|
||||
$orderPropsArr[$orderType['ID']] = $_orderPropsArr;
|
||||
}
|
||||
|
||||
COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr));
|
||||
COption::SetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr));
|
||||
@ -379,12 +385,14 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
<?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');
|
||||
$('input.addr').change(function(){
|
||||
splitName = $(this).attr('name').split('-');
|
||||
orderType = splitName[2];
|
||||
|
||||
if(parseInt($(this).val()) === 1)
|
||||
$('tr.address-detail-' + orderType).show('slow');
|
||||
else if(parseInt($(this).val()) === 0)
|
||||
$('tr.address-detail-' + orderType).hide('slow');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@ -530,26 +538,34 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
<tr class="heading">
|
||||
<td colspan="2"><b><?php echo GetMessage('ORDER_PROPS'); ?></b></td>
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<td colspan="2"><b><?php echo GetMessage('INFO_2'); ?></b></td>
|
||||
</tr>
|
||||
<?php foreach($arResult['bitrixOrderTypesList'] as $bitrixOrderType): ?>
|
||||
<tr class="heading">
|
||||
<td colspan="2"><b><?php echo $bitrixOrderType['NAME']; ?></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>
|
||||
<label><input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID'];; ?>" value="0" <?php if(count($optionsOrderProps[$bitrixOrderType['ID']]) < 6) echo "checked"; ?>><?php echo GetMessage('ADDRESS_SHORT'); ?></label>
|
||||
<label><input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID']; ?>" value="1" <?php if(count($optionsOrderProps[$bitrixOrderType['ID']]) > 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($optionsOrderProps) < 6)) echo 'style="display:none;"';?>>
|
||||
<tr <?php if ($countProps > 5) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 5) && (count($optionsOrderProps[$bitrixOrderType['ID']]) < 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">
|
||||
<select name="order-prop-<?php echo $orderProp['ID'] . '-' . $bitrixOrderType['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'; ?>>
|
||||
<option value="<?php echo $arProp['CODE']; ?>" <?php if ($optionsOrderProps[$bitrixOrderType['ID']][$orderProp['ID']] == $arProp['CODE']) echo 'selected'; ?>>
|
||||
<?php echo $arProp['NAME']; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
@ -557,6 +573,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
</td>
|
||||
</tr>
|
||||
<?php $countProps++; endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php $tabControl->BeginNextTab(); ?>
|
||||
<?php $tabControl->Buttons(); ?>
|
||||
<input type="hidden" name="Update" value="Y" />
|
||||
|
Loading…
Reference in New Issue
Block a user