diff --git a/intaro.intarocrm/install/index.php b/intaro.intarocrm/install/index.php index bd0940cf..9b443a6c 100755 --- a/intaro.intarocrm/install/index.php +++ b/intaro.intarocrm/install/index.php @@ -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()); + } + + $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; } - - $arResult['test'] = $_POST; 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"); diff --git a/intaro.intarocrm/install/step3.php b/intaro.intarocrm/install/step3.php index eea3f901..7c5a7446 100755 --- a/intaro.intarocrm/install/step3.php +++ b/intaro.intarocrm/install/step3.php @@ -4,23 +4,34 @@ if (!check_bitrix_sessid()) IncludeModuleLangFile(__FILE__); $defaultOrderProps = array( - 'fio' => 'FIO', - 'index' => 'ZIP', - 'text' => 'ADDRESS', - 'phone' => 'PHONE', - 'email' => 'EMAIL' + 1 => array( + 'fio' => 'FIO', + 'index' => 'ZIP', + 'text' => 'ADDRESS', + 'phone' => 'PHONE', + 'email' => 'EMAIL' + ), + 2 => array( + 'fio' => 'FIO', + 'index' => 'ZIP', + 'text' => 'ADDRESS', + 'phone' => 'PHONE', + 'email' => 'EMAIL' + ) ); ?> @@ -42,34 +53,42 @@ $defaultOrderProps = array( - - + + + + + + + + + + - - + + - 5) echo 'class="address-detail"'; if (($countProps > 5) && (count($defaultOrderProps) < 6)) echo 'style="display:none;"'; ?>> + 5) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 5) && (count($defaultOrderProps[$bitrixOrderType['ID']]) < 6)) echo 'style="display:none;"';?>> - - - - - + + + + + +
diff --git a/intaro.intarocrm/lang/ru/options.php b/intaro.intarocrm/lang/ru/options.php index 92f0abea..1be8a41e 100755 --- a/intaro.intarocrm/lang/ru/options.php +++ b/intaro.intarocrm/lang/ru/options.php @@ -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'] = 'Телефон'; diff --git a/intaro.intarocrm/options.php b/intaro.intarocrm/options.php index df1c1fd5..0e30a58a 100755 --- a/intaro.intarocrm/options.php +++ b/intaro.intarocrm/options.php @@ -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']]; + $orderTypesArr[$arOrderTypesList['ID']] = $_POST['order-type-' . $arOrderTypesList['ID']]; + $orderTypesList[] = $arOrderTypesList; } while ($arOrderTypesList = $dbOrderTypesList->Fetch()); } @@ -212,13 +214,17 @@ 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) - break; - $orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID']])); - $propsCount++; + 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($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr)); @@ -379,12 +385,14 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) { AddHeadString(''); ?> @@ -530,26 +538,34 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) { + + + + + + + + - - + + - 5) echo 'class="address-detail"'; if(($countProps > 5) && (count($optionsOrderProps) < 6)) echo 'style="display:none;"';?>> + 5) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 5) && (count($optionsOrderProps[$bitrixOrderType['ID']]) < 6)) echo 'style="display:none;"';?>> - - @@ -557,6 +573,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) { + BeginNextTab(); ?> Buttons(); ?>