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

options fix

This commit is contained in:
Grisha Pomadchin 2013-09-17 15:17:39 +04:00
parent e8f55aa087
commit 13f72cc89f
3 changed files with 39 additions and 47 deletions

View File

@ -64,7 +64,14 @@ class intaro_intarocrm extends CModule {
if (!date_default_timezone_get()) {
if (!ini_get('date.timezone')) {
$APPLICATION->ThrowException(GetMessage("DATE_TIMEZONE_ERR"));
return false;
return false;
}
}
if (!date_default_timezone_get()) {
if (!ini_get('date.timezone')) {
$APPLICATION->ThrowException(GetMessage("DATE_TIMEZONE_ERR"));
return false;
}
}
@ -77,27 +84,19 @@ class intaro_intarocrm extends CModule {
$arResult['orderProps'] = array(
array(
'NAME' => GetMessage('FIO'),
'ID' => 'fio'
),
array(
'NAME' => GetMessage('ZIP'),
'ID' => 'index'
'ID' => 'fio'
),
array(
'NAME' => GetMessage('PHONE'),
'ID' => 'phone'
'ID' => 'phone'
),
array(
'NAME' => GetMessage('EMAIL'),
'ID' => 'email'
),
array(
'NAME' => GetMessage('ZIP'),
'ID' => 'index'
'ID' => 'email'
),
array(
'NAME' => GetMessage('ADDRESS'),
'ID' => 'text'
'ID' => 'text'
),
// address
/* array(
@ -114,35 +113,35 @@ class intaro_intarocrm extends CModule {
), */
array(
'NAME' => GetMessage('ZIP'),
'ID' => 'index'
'ID' => 'index'
),
array(
'NAME' => GetMessage('STREET'),
'ID' => 'street'
'ID' => 'street'
),
array(
'NAME' => GetMessage('BUILDING'),
'ID' => 'building'
'ID' => 'building'
),
array(
'NAME' => GetMessage('FLAT'),
'ID' => 'flat'
'ID' => 'flat'
),
array(
'NAME' => GetMessage('INTERCOMCODE'),
'ID' => 'intercomcode'
'ID' => 'intercomcode'
),
array(
'NAME' => GetMessage('FLOOR'),
'ID' => 'floor'
'ID' => 'floor'
),
array(
'NAME' => GetMessage('BLOCK'),
'ID' => 'block'
'ID' => 'block'
),
array(
'NAME' => GetMessage('HOUSE'),
'ID' => 'house'
'ID' => 'house'
)
);
@ -698,7 +697,7 @@ class intaro_intarocrm extends CModule {
//form orderProps
$dbProp = CSaleOrderProps::GetList(array(), array());
while ($arProp = $dbProp->GetNext()) {
$arResult['arProp'][] = $arProp;
$arResult['arProp'][$arProp['PERSON_TYPE_ID']] = $arProp;
}
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_TYPES_ARR, serialize($orderTypesArr));
@ -772,7 +771,7 @@ class intaro_intarocrm extends CModule {
$propsCount = 0;
$_orderPropsArr = array();
foreach ($arResult['orderProps'] as $orderProp) {
if ((!(int) htmlspecialchars(trim($_POST['address-detail-' . $orderType['ID']]))) && $propsCount > 5)
if ((!(int) htmlspecialchars(trim($_POST['address-detail-' . $orderType['ID']]))) && $propsCount > 4)
break;
$_orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID'] . '-' . $orderType['ID']]));
$propsCount++;

View File

@ -72,14 +72,14 @@ $defaultOrderProps = array(
</td>
</tr>
<?php endif; ?>
<tr <?php if ($countProps > 5) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 5) && (count($defaultOrderProps[$bitrixOrderType['ID']]) < 6)) echo 'style="display:none;"';?>>
<tr <?php if ($countProps > 4) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 4) && (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'] . '-' . $bitrixOrderType['ID']; ?>" class="typeselect">
<option value=""></option>
<?php foreach ($arResult['arProp'] as $arProp): ?>
<?php foreach ($arResult['arProp'][$bitrixOrderType['ID']] as $arProp): ?>
<option value="<?php echo $arProp['CODE']; ?>" <?php if ($defaultOrderProps[$bitrixOrderType['ID']][$orderProp['ID']] == $arProp['CODE']) echo 'selected'; ?>>
<?php echo $arProp['NAME']; ?>
</option>

View File

@ -32,10 +32,6 @@ $arResult['orderProps'] = array(
'NAME' => GetMessage('FIO'),
'ID' => 'fio'
),
array(
'NAME' => GetMessage('ZIP'),
'ID' => 'index'
),
array(
'NAME' => GetMessage('PHONE'),
'ID' => 'phone'
@ -44,10 +40,6 @@ $arResult['orderProps'] = array(
'NAME' => GetMessage('EMAIL'),
'ID' => 'email'
),
array(
'NAME' => GetMessage('ZIP'),
'ID' => 'index'
),
array(
'NAME' => GetMessage('ADDRESS'),
'ID' => 'text'
@ -245,18 +237,19 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
RegisterModuleDependences("sale", "OnOrderNewSendEmail", $mid, "ICrmOrderEvent", "onSendOrderMail");
RegisterModuleDependences("sale", "OnOrderUpdate", $mid, "ICrmOrderEvent", "onUpdateOrder");
$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;
}
$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 > 4)
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));
@ -380,7 +373,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$dbProp = CSaleOrderProps::GetList(array(), array());
while ($arProp = $dbProp->GetNext()) {
$arResult['arProp'][] = $arProp;
$arResult['arProp'][$arProp['PERSON_TYPE_ID']][] = $arProp;
}
//saved cat params
@ -597,14 +590,14 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</td>
</tr>
<?php endif; ?>
<tr <?php if ($countProps > 5) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 5) && (count($optionsOrderProps[$bitrixOrderType['ID']]) < 6)) echo 'style="display:none;"';?>>
<tr <?php if ($countProps > 4) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 4) && (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'] . '-' . $bitrixOrderType['ID']; ?>" class="typeselect">
<option value=""></option>
<?php foreach ($arResult['arProp'] as $arProp): ?>
<?php foreach ($arResult['arProp'][$bitrixOrderType['ID']] as $arProp): ?>
<option value="<?php echo $arProp['CODE']; ?>" <?php if ($optionsOrderProps[$bitrixOrderType['ID']][$orderProp['ID']] == $arProp['CODE']) echo 'selected'; ?>>
<?php echo $arProp['NAME']; ?>
</option>