1
0
mirror of synced 2024-11-25 14:56: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

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

View File

@ -72,14 +72,14 @@ $defaultOrderProps = array(
</td> </td>
</tr> </tr>
<?php endif; ?> <?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']; ?>"> <td width="50%" class="adm-detail-content-cell-l" name="<?php echo $orderProp['ID']; ?>">
<?php echo $orderProp['NAME']; ?> <?php echo $orderProp['NAME']; ?>
</td> </td>
<td width="50%" class="adm-detail-content-cell-r"> <td width="50%" class="adm-detail-content-cell-r">
<select name="order-prop-<?php echo $orderProp['ID'] . '-' . $bitrixOrderType['ID']; ?>" class="typeselect"> <select name="order-prop-<?php echo $orderProp['ID'] . '-' . $bitrixOrderType['ID']; ?>" class="typeselect">
<option value=""></option> <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'; ?>> <option value="<?php echo $arProp['CODE']; ?>" <?php if ($defaultOrderProps[$bitrixOrderType['ID']][$orderProp['ID']] == $arProp['CODE']) echo 'selected'; ?>>
<?php echo $arProp['NAME']; ?> <?php echo $arProp['NAME']; ?>
</option> </option>

View File

@ -32,10 +32,6 @@ $arResult['orderProps'] = array(
'NAME' => GetMessage('FIO'), 'NAME' => GetMessage('FIO'),
'ID' => 'fio' 'ID' => 'fio'
), ),
array(
'NAME' => GetMessage('ZIP'),
'ID' => 'index'
),
array( array(
'NAME' => GetMessage('PHONE'), 'NAME' => GetMessage('PHONE'),
'ID' => 'phone' 'ID' => 'phone'
@ -44,10 +40,6 @@ $arResult['orderProps'] = array(
'NAME' => GetMessage('EMAIL'), 'NAME' => GetMessage('EMAIL'),
'ID' => 'email' 'ID' => 'email'
), ),
array(
'NAME' => GetMessage('ZIP'),
'ID' => 'index'
),
array( array(
'NAME' => GetMessage('ADDRESS'), 'NAME' => GetMessage('ADDRESS'),
'ID' => 'text' 'ID' => 'text'
@ -245,18 +237,19 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
RegisterModuleDependences("sale", "OnOrderNewSendEmail", $mid, "ICrmOrderEvent", "onSendOrderMail"); RegisterModuleDependences("sale", "OnOrderNewSendEmail", $mid, "ICrmOrderEvent", "onSendOrderMail");
RegisterModuleDependences("sale", "OnOrderUpdate", $mid, "ICrmOrderEvent", "onUpdateOrder"); RegisterModuleDependences("sale", "OnOrderUpdate", $mid, "ICrmOrderEvent", "onUpdateOrder");
$orderPropsArr = array(); }
foreach ($orderTypesList as $orderType) {
$propsCount = 0; $orderPropsArr = array();
$_orderPropsArr = array(); foreach ($orderTypesList as $orderType) {
foreach ($arResult['orderProps'] as $orderProp) { $propsCount = 0;
if ((!(int) htmlspecialchars(trim($_POST['address-detail-' . $orderType['ID']]))) && $propsCount > 5) $_orderPropsArr = array();
break; foreach ($arResult['orderProps'] as $orderProp) {
$_orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID'] . '-' . $orderType['ID']])); if ((!(int) htmlspecialchars(trim($_POST['address-detail-' . $orderType['ID']]))) && $propsCount > 4)
$propsCount++; break;
} $_orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID'] . '-' . $orderType['ID']]));
$orderPropsArr[$orderType['ID']] = $_orderPropsArr; $propsCount++;
} }
$orderPropsArr[$orderType['ID']] = $_orderPropsArr;
} }
COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr)); 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()); $dbProp = CSaleOrderProps::GetList(array(), array());
while ($arProp = $dbProp->GetNext()) { while ($arProp = $dbProp->GetNext()) {
$arResult['arProp'][] = $arProp; $arResult['arProp'][$arProp['PERSON_TYPE_ID']][] = $arProp;
} }
//saved cat params //saved cat params
@ -597,14 +590,14 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</td> </td>
</tr> </tr>
<?php endif; ?> <?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']; ?>"> <td width="50%" class="adm-detail-content-cell-l" name="<?php echo $orderProp['ID']; ?>">
<?php echo $orderProp['NAME']; ?> <?php echo $orderProp['NAME']; ?>
</td> </td>
<td width="50%" class="adm-detail-content-cell-r"> <td width="50%" class="adm-detail-content-cell-r">
<select name="order-prop-<?php echo $orderProp['ID'] . '-' . $bitrixOrderType['ID']; ?>" class="typeselect"> <select name="order-prop-<?php echo $orderProp['ID'] . '-' . $bitrixOrderType['ID']; ?>" class="typeselect">
<option value=""></option> <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'; ?>> <option value="<?php echo $arProp['CODE']; ?>" <?php if ($optionsOrderProps[$bitrixOrderType['ID']][$orderProp['ID']] == $arProp['CODE']) echo 'selected'; ?>>
<?php echo $arProp['NAME']; ?> <?php echo $arProp['NAME']; ?>
</option> </option>