1
0
mirror of synced 2024-11-22 13:26:10 +03:00

histore update fixes

This commit is contained in:
Grisha Pomadchin 2013-09-19 00:18:32 +04:00
parent e13fddda75
commit e210a7a26f
8 changed files with 75 additions and 53 deletions

View File

@ -249,7 +249,9 @@ class ICrmOrderActions
if(isset($order['customer']) && $order['customer']) $userId = $order['customer']; if(isset($order['customer']) && $order['customer']) $userId = $order['customer'];
$LID = $arFields['LID']; $LID = $arFields['LID'];
$rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID'])); $rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
while ($ar = $rsOrderProps->Fetch()) { while ($ar = $rsOrderProps->Fetch()) {
if (isset($order['deliveryAddress']) && $order['deliveryAddress']) { if (isset($order['deliveryAddress']) && $order['deliveryAddress']) {
switch ($ar['CODE']) { switch ($ar['CODE']) {
@ -414,13 +416,15 @@ class ICrmOrderActions
'PAYED' => $optionsPayment[$order['paymentStatus']], 'PAYED' => $optionsPayment[$order['paymentStatus']],
//'PERSON_TYPE_ID' => $optionsOrderTypes[$order['orderType']], //'PERSON_TYPE_ID' => $optionsOrderTypes[$order['orderType']],
'DELIVERY_ID' => $optionsDelivTypes[$order['deliveryType']], 'DELIVERY_ID' => $optionsDelivTypes[$order['deliveryType']],
'STATUS_ID' => $optionsPayStatuses[$order['status']] 'STATUS_ID' => $optionsPayStatuses[$order['status']],
'REASON_CANCELED' => $order['statusComment'],
'USER_DESCRIPTION' => $order['customerComment'],
'COMMENTS' => $order['managerComment']
)); ));
$GLOBALS['FROM_HISTORY'] = true; $GLOBALS['INTARO_CRM_FROM_HISTORY'] = true;
CSaleOrder::Update($order['externalId'], $arFields); CSaleOrder::Update($order['externalId'], $arFields);
} }
} }
@ -550,46 +554,46 @@ class ICrmOrderActions
$rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID'])); $rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
while ($ar = $rsOrderProps->Fetch()) { while ($ar = $rsOrderProps->Fetch()) {
switch ($ar['CODE']) { switch ($ar['CODE']) {
case $arParams['optionsOrderProps']['index']: $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['index']: $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']);
break; break;
case 'CITY': $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']); case 'CITY': $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']);
break; break;
case $arParams['optionsOrderProps']['text']: $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['text']: $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']);
break; break;
case 'LOCATION': if(!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city']) { case 'LOCATION': if(!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city']) {
$resOrderDeliveryAddress['city'] = CSaleLocation::GetByID($ar['VALUE']); $resOrderDeliveryAddress['city'] = CSaleLocation::GetByID($ar['VALUE']);
$resOrderDeliveryAddress['city'] = self::toJSON($resOrderDeliveryAddress['city']['CITY_NAME_LANG']); $resOrderDeliveryAddress['city'] = self::toJSON($resOrderDeliveryAddress['city']['CITY_NAME_LANG']);
} }
break; break;
case $arParams['optionsOrderProps']['fio']: $contactNameArr = self::explodeFIO($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['fio']: $contactNameArr = self::explodeFIO($ar['VALUE']);
break; break;
case $arParams['optionsOrderProps']['phone']: $resOrder['phone'] = $ar['VALUE']; case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['phone']: $resOrder['phone'] = $ar['VALUE'];
break; break;
case $arParams['optionsOrderProps']['email']: $resOrder['email'] = $ar['VALUE']; case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['email']: $resOrder['email'] = $ar['VALUE'];
break; break;
} }
if (count($arParams['optionsOrderProps'] > 5)) { if (count($arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']] > 5)) {
switch ($ar['CODE']) { switch ($ar['CODE']) {
/*case $arParams['optionsOrderProps']['country']: $resOrderDeliveryAddress['country'] = self::toJSON($ar['VALUE']); /*case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['country']: $resOrderDeliveryAddress['country'] = self::toJSON($ar['VALUE']);
break; break;
case $arParams['optionsOrderProps']['region']: $resOrderDeliveryAddress['region'] = self::toJSON($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['region']: $resOrderDeliveryAddress['region'] = self::toJSON($ar['VALUE']);
break; break;
case $arParams['optionsOrderProps']['city']: $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['city']: $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']);
break; */ break; */
case $arParams['optionsOrderProps']['street']: $resOrderDeliveryAddress['street'] = self::toJSON($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['street']: $resOrderDeliveryAddress['street'] = self::toJSON($ar['VALUE']);
break; break;
case $arParams['optionsOrderProps']['building']: $resOrderDeliveryAddress['building'] = self::toJSON($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['building']: $resOrderDeliveryAddress['building'] = self::toJSON($ar['VALUE']);
break; break;
case $arParams['optionsOrderProps']['flat']: $resOrderDeliveryAddress['flat'] = self::toJSON($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['flat']: $resOrderDeliveryAddress['flat'] = self::toJSON($ar['VALUE']);
break; break;
case $arParams['optionsOrderProps']['inercomcode']: $resOrderDeliveryAddress['intercomcode'] = self::toJSON($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['inercomcode']: $resOrderDeliveryAddress['intercomcode'] = self::toJSON($ar['VALUE']);
break; break;
case $arParams['optionsOrderProps']['floor']: $resOrderDeliveryAddress['floor'] = self::toJSON($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['floor']: $resOrderDeliveryAddress['floor'] = self::toJSON($ar['VALUE']);
break; break;
case $arParams['optionsOrderProps']['block']: $resOrderDeliveryAddress['block'] = self::toJSON($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['block']: $resOrderDeliveryAddress['block'] = self::toJSON($ar['VALUE']);
break; break;
case $arParams['optionsOrderProps']['house']: $resOrderDeliveryAddress['house'] = self::toJSON($ar['VALUE']); case $arParams['optionsOrderProps'][$arFields['PERSON_TYPE_ID']]['house']: $resOrderDeliveryAddress['house'] = self::toJSON($ar['VALUE']);
break; break;
} }
} }
@ -626,6 +630,7 @@ class ICrmOrderActions
$createdAt = $createdAt->format('Y-m-d H:i:s'); $createdAt = $createdAt->format('Y-m-d H:i:s');
$resOrder = array( $resOrder = array(
'number' => $resOrder['ACCOUNT_NUMBER'],
'phone' => $resOrder['phone'], 'phone' => $resOrder['phone'],
'email' => $resOrder['email'], 'email' => $resOrder['email'],
'deliveryCost' => $arFields['PRICE_DELIVERY'], 'deliveryCost' => $arFields['PRICE_DELIVERY'],
@ -638,7 +643,9 @@ class ICrmOrderActions
'orderType' => $arParams['optionsOrderTypes'][$arFields['PERSON_TYPE_ID']], 'orderType' => $arParams['optionsOrderTypes'][$arFields['PERSON_TYPE_ID']],
'deliveryType' => $arParams['optionsDelivTypes'][$resultDeliveryTypeId], 'deliveryType' => $arParams['optionsDelivTypes'][$resultDeliveryTypeId],
'status' => $arParams['optionsPayStatuses'][$arFields['STATUS_ID']], 'status' => $arParams['optionsPayStatuses'][$arFields['STATUS_ID']],
'statusComment' => $arFields['USER_DESCRIPTION'], 'statusComment' => $arFields['REASON_CANCELED'],
'customerComment' => $arFields['USER_DESCRIPTION'],
'managerComment' => $arFields['COMMENTS'],
'createdAt' => $createdAt, 'createdAt' => $createdAt,
'deliveryAddress' => $resOrderDeliveryAddress, 'deliveryAddress' => $resOrderDeliveryAddress,
'items' => $items 'items' => $items

View File

@ -13,6 +13,17 @@ class ICrmOrderEvent {
protected static $CRM_PAYMENT_STATUSES = 'pay_statuses_arr'; protected static $CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
protected static $CRM_PAYMENT = 'payment_arr'; //order payment Y/N protected static $CRM_PAYMENT = 'payment_arr'; //order payment Y/N
protected static $CRM_ORDER_LAST_ID = 'order_last_id'; protected static $CRM_ORDER_LAST_ID = 'order_last_id';
protected static $CRM_ORDER_PROPS = 'order_props';
/**
* onBeforeOrderAdd
*
* @param mixed $arFields - Order arFields
*/
function onBeforeOrderAdd($arFields = array()) {
$GLOBALS['INTARO_CRM_ORDER_ADD'] = true;
return;
}
/** /**
* onUpdateOrder * onUpdateOrder
@ -21,7 +32,10 @@ class ICrmOrderEvent {
* @param mixed $arFields - Order arFields * @param mixed $arFields - Order arFields
*/ */
function onUpdateOrder($ID, $arFields = array()) { function onUpdateOrder($ID, $arFields = array()) {
if(isset($GLOBALS['FROM_HISTORY']) && $GLOBALS['FROM_HISTORY']) if(isset($GLOBALS['INTARO_CRM_ORDER_ADD']) && $GLOBALS['INTARO_CRM_ORDER_ADD'])
return;
if(isset($GLOBALS['INTARO_CRM_FROM_HISTORY']) && $GLOBALS['INTARO_CRM_FROM_HISTORY'])
return; return;
self::writeDataOnOrderCreate($ID); self::writeDataOnOrderCreate($ID);
@ -47,6 +61,7 @@ class ICrmOrderEvent {
* @param integer $ID - Order Id * @param integer $ID - Order Id
*/ */
function writeDataOnOrderCreate($ID) { function writeDataOnOrderCreate($ID) {
if (!CModule::IncludeModule('iblock')) { if (!CModule::IncludeModule('iblock')) {
//handle err //handle err
ICrmOrderActions::eventLog('ICrmOrderEvent::writeDataOnOrderCreate', 'iblock', 'module not found'); ICrmOrderActions::eventLog('ICrmOrderEvent::writeDataOnOrderCreate', 'iblock', 'module not found');
@ -65,6 +80,9 @@ class ICrmOrderEvent {
return true; return true;
} }
$GLOBALS['INTARO_CRM_ORDER_ADD'] = false;
$GLOBALS['INTARO_CRM_FROM_HISTORY'] = false;
$api_host = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_HOST_OPTION, 0); $api_host = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_HOST_OPTION, 0);
$api_key = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_KEY_OPTION, 0); $api_key = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_KEY_OPTION, 0);
@ -74,6 +92,7 @@ class ICrmOrderEvent {
$optionsPayTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_TYPES, 0)); $optionsPayTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_TYPES, 0));
$optionsPayStatuses = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0)); // --statuses $optionsPayStatuses = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0)); // --statuses
$optionsPayment = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT, 0)); $optionsPayment = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT, 0));
$optionsOrderProps = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_PROPS, 0));
$api = new IntaroCrm\RestApi($api_host, $api_key); $api = new IntaroCrm\RestApi($api_host, $api_key);
@ -82,7 +101,8 @@ class ICrmOrderEvent {
'optionsDelivTypes' => $optionsDelivTypes, 'optionsDelivTypes' => $optionsDelivTypes,
'optionsPayTypes' => $optionsPayTypes, 'optionsPayTypes' => $optionsPayTypes,
'optionsPayStatuses' => $optionsPayStatuses, 'optionsPayStatuses' => $optionsPayStatuses,
'optionsPayment' => $optionsPayment 'optionsPayment' => $optionsPayment,
'optionsOrderProps' => $optionsOrderProps
); );
$arOrder = CSaleOrder::GetById($ID); $arOrder = CSaleOrder::GetById($ID);
@ -191,6 +211,7 @@ class ICrmOrderEvent {
$api->orderEdit($order); $api->orderEdit($order);
// error pushing order // error pushing order
if ($api->getStatusCode() != 201) if ($api->getStatusCode() != 201)
ICrmOrderActions::eventLog('ICrmOrderEvent::onSalePayOrder', 'IntaroCrm\RestApi::orderEdit', $api->getLastError()); ICrmOrderActions::eventLog('ICrmOrderEvent::onSalePayOrder', 'IntaroCrm\RestApi::orderEdit', $api->getLastError());

View File

@ -68,13 +68,6 @@ 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');
@ -697,7 +690,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['PERSON_TYPE_ID']] = $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));
@ -876,6 +869,7 @@ class intaro_intarocrm extends CModule {
} }
RegisterModule($this->MODULE_ID); RegisterModule($this->MODULE_ID);
RegisterModuleDependences("sale", "OnSalePayOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSalePayOrder");
RegisterModuleDependences("sale", "OnSaleCancelOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSaleCancelOrder"); RegisterModuleDependences("sale", "OnSaleCancelOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSaleCancelOrder");
$this->CopyFiles(); $this->CopyFiles();
if (isset($_POST['LOAD_NOW'])) { if (isset($_POST['LOAD_NOW'])) {

View File

@ -29,9 +29,6 @@
<!--<tr align="center"> <!--<tr align="center">
<td colspan="2"><b><?php echo GetMessage('INFO_3'); ?></b></td> <td colspan="2"><b><?php echo GetMessage('INFO_3'); ?></b></td>
</tr>--> </tr>-->
<tr align="center">
<td colspan="2"><b><?php echo GetMessage('INFO_3'); ?></b></td>
</tr>
<tr align="center"> <tr align="center">
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>

View File

@ -58,13 +58,12 @@ $defaultOrderProps = array(
</tr> </tr>
<?php foreach($arResult['bitrixOrderTypesList'] as $bitrixOrderType): ?> <?php foreach($arResult['bitrixOrderTypesList'] as $bitrixOrderType): ?>
<tr class="heading"> <tr class="heading">
<td colspan="2"><b><?php echo $bitrixOrderType['NAME']; ?></b></td> <td colspan="2"><b><?php echo GetMessage('ORDER_TYPE_INFO') . ' ' . $bitrixOrderType['NAME']; ?></b></td>
</tr> </tr>
<?php $countProps = 0; foreach($arResult['orderProps'] as $orderProp): ?> <?php $countProps = 0; foreach($arResult['orderProps'] as $orderProp): ?>
<?php if($orderProp['ID'] == 'text'): ?> <?php if($orderProp['ID'] == 'text'): ?>
<tr class="heading"> <tr class="heading">
<td colspan="2"> <td colspan="2" style="background-color: transparent;">
<b> <b>
<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="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> <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>
@ -74,14 +73,14 @@ $defaultOrderProps = array(
<?php endif; ?> <?php endif; ?>
<tr <?php if ($countProps > 4) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 4) && (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 $APPLICATION->ConvertCharset($orderProp['NAME'], 'utf-8', SITE_CHARSET);; ?>
</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'][$bitrixOrderType['ID']] 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 $APPLICATION->ConvertCharset($arProp['NAME'], 'utf-8', SITE_CHARSET); ?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>

View File

@ -12,6 +12,7 @@ $MESS ['START_3'] = 'Возобновить выгрузку';
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг'; $MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
$MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг'; $MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг';
$MESS ['INFO_2'] = ' Задайте соответствие между полями заказа 1C-Битрикс и IntaroCRM.'; $MESS ['INFO_2'] = ' Задайте соответствие между полями заказа 1C-Битрикс и IntaroCRM.';
$MESS ['ORDER_TYPE_INFO'] = 'Тип заказа:';
$MESS ['ORDER_PROPS'] = 'Настройки соответствия полей заказа IntaroCRM свойствам заказа 1С-Битрикс'; $MESS ['ORDER_PROPS'] = 'Настройки соответствия полей заказа IntaroCRM свойствам заказа 1С-Битрикс';
$MESS ['FIO'] = 'Ф.И.О.'; $MESS ['FIO'] = 'Ф.И.О.';

View File

@ -51,3 +51,5 @@ $MESS ['BLOCK'] = 'Подъезд';
$MESS ['HOUSE'] = 'Строение / корпус'; $MESS ['HOUSE'] = 'Строение / корпус';
$MESS ['ADDRESS_SHORT'] = 'Краткий адрес'; $MESS ['ADDRESS_SHORT'] = 'Краткий адрес';
$MESS ['ADDRESS_FULL'] = 'Детальный адрес'; $MESS ['ADDRESS_FULL'] = 'Детальный адрес';
$MESS ['ORDER_TYPE_INFO'] = 'Тип заказа:';

View File

@ -219,6 +219,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
// remove depenedencies // remove depenedencies
UnRegisterModuleDependences("sale", "OnOrderNewSendEmail", $mid, "ICrmOrderEvent", "onSendOrderMail"); UnRegisterModuleDependences("sale", "OnOrderNewSendEmail", $mid, "ICrmOrderEvent", "onSendOrderMail");
UnRegisterModuleDependences("sale", "OnOrderUpdate", $mid, "ICrmOrderEvent", "onUpdateOrder"); UnRegisterModuleDependences("sale", "OnOrderUpdate", $mid, "ICrmOrderEvent", "onUpdateOrder");
UnRegisterModuleDependences("sale", "OnBeforeOrderAdd", $mid, "ICrmOrderEvent", "onBeforeOrderAdd");
// new agent // new agent
$dateAgent = new DateTime(); $dateAgent = new DateTime();
$intAgent = new DateInterval('PT60S'); // PT60S - 60 sec; $intAgent = new DateInterval('PT60S'); // PT60S - 60 sec;
@ -236,7 +237,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
// event dependencies // event dependencies
RegisterModuleDependences("sale", "OnOrderNewSendEmail", $mid, "ICrmOrderEvent", "onSendOrderMail"); RegisterModuleDependences("sale", "OnOrderNewSendEmail", $mid, "ICrmOrderEvent", "onSendOrderMail");
RegisterModuleDependences("sale", "OnOrderUpdate", $mid, "ICrmOrderEvent", "onUpdateOrder"); RegisterModuleDependences("sale", "OnOrderUpdate", $mid, "ICrmOrderEvent", "onUpdateOrder");
RegisterModuleDependences("sale", "OnBeforeOrderAdd", $mid, "ICrmOrderEvent", "onBeforeOrderAdd");
} }
$orderPropsArr = array(); $orderPropsArr = array();
@ -576,13 +577,13 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</tr> </tr>
<?php foreach($arResult['bitrixOrderTypesList'] as $bitrixOrderType): ?> <?php foreach($arResult['bitrixOrderTypesList'] as $bitrixOrderType): ?>
<tr class="heading"> <tr class="heading">
<td colspan="2"><b><?php echo $bitrixOrderType['NAME']; ?></b></td> <td colspan="2"><b><?php echo GetMessage('ORDER_TYPE_INFO') . ' ' . $bitrixOrderType['NAME']; ?></b></td>
</tr> </tr>
<?php $countProps = 0; foreach($arResult['orderProps'] as $orderProp): ?> <?php $countProps = 0; foreach($arResult['orderProps'] as $orderProp): ?>
<?php if($orderProp['ID'] == 'text'): ?> <?php if($orderProp['ID'] == 'text'): ?>
<tr class="heading"> <tr class="heading">
<td colspan="2"> <td colspan="2" style="background-color: transparent;">
<b> <b>
<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="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> <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>
@ -599,7 +600,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<option value=""></option> <option value=""></option>
<?php foreach ($arResult['arProp'][$bitrixOrderType['ID']] 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 $APPLICATION->ConvertCharset($arProp['NAME'], 'utf-8', SITE_CHARSET); ?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>