1
0
mirror of synced 2024-11-25 14:56:09 +03:00

merge fix; v0.4.0

This commit is contained in:
Grisha Pomadchin 2013-09-12 19:00:46 +04:00
parent 90ea4b3eab
commit 084147eb2b
6 changed files with 66 additions and 53 deletions

View File

@ -646,7 +646,7 @@ class ICrmOrderActions
if(isset($arParams['optionsSites']) && is_array($arParams['optionsSites']) if(isset($arParams['optionsSites']) && is_array($arParams['optionsSites'])
&& in_array($arFields['LID'], $arParams['optionsSites'])) && in_array($arFields['LID'], $arParams['optionsSites']))
$resOrder['site'] = $arFields['LID']; $resOrder['site'] = $arFields['LID'];
// parse fio // parse fio
if(count($contactNameArr) == 1) { if(count($contactNameArr) == 1) {
$resOrder['firstName'] = $contactNameArr[0]; $resOrder['firstName'] = $contactNameArr[0];
@ -655,8 +655,10 @@ class ICrmOrderActions
$resOrder['firstName'] = $contactNameArr[1]; $resOrder['firstName'] = $contactNameArr[1];
$resOrder['patronymic'] = $contactNameArr[2]; $resOrder['patronymic'] = $contactNameArr[2];
} }
$resOrder = self::clearArr($resOrder); $resOrder = self::clearArr($resOrder);
self::eventLog('ICrmOrderActions::orderHistory', 'iblock', json_encode($resOrder));
if($send) if($send)
return $api->orderEdit($resOrder); return $api->orderEdit($resOrder);
@ -729,4 +731,22 @@ class ICrmOrderActions
return $newArray; return $newArray;
} }
public static function addOrderProperty($code, $value, $order) {
if (!$code)
return;
if (!CModule::IncludeModule('sale'))
return;
if ($arProp = CSaleOrderProps::GetList(array(), array('CODE' => $code))->Fetch()) {
return CSaleOrderPropsValue::Add(array(
'NAME' => $arProp['NAME'],
'CODE' => $arProp['CODE'],
'ORDER_PROPS_ID' => $arProp['ID'],
'ORDER_ID' => $order,
'VALUE' => $value,
));
}
}
} }

View File

@ -1,4 +0,0 @@
* Доработан скрипт генерации ICML-файла в части работы со спецсимволами
* Добавлена поддержка многосайтовости
* Добавлена возможность выгрузки способов доставки на втором шаге установки
* Проверка временной зоны перед установкой

10
intaro.intarocrm/include.php Executable file
View File

@ -0,0 +1,10 @@
<?php
CModule::AddAutoloadClasses(
'intaro.intarocrm', // module name
array (
'IntaroCrm\RestApi' => 'classes/general/RestApi.php',
'ICrmOrderActions' => 'classes/general/ICrmOrderActions.php',
'ICMLLoader' => 'classes/general/ICMLLoader.php',
'ICrmOrderEvent' => 'classes/general/events/ICrmOrderEvent.php'
)
);

View File

@ -32,6 +32,7 @@ class intaro_intarocrm extends CModule {
var $CRM_ORDER_LAST_ID = 'order_last_id'; var $CRM_ORDER_LAST_ID = 'order_last_id';
var $CRM_ORDER_SITES = 'sites_ids'; var $CRM_ORDER_SITES = 'sites_ids';
var $CRM_ORDER_PROPS = 'order_props'; var $CRM_ORDER_PROPS = 'order_props';
var $CRM_ORDER_DISCHARGE = 'order_discharge';
var $INSTALL_PATH; var $INSTALL_PATH;
function intaro_intarocrm() { function intaro_intarocrm() {
@ -67,7 +68,6 @@ class intaro_intarocrm extends CModule {
} }
} }
if (!date_default_timezone_get()) { if (!date_default_timezone_get()) {
if (!ini_get('date.timezone')) { if (!ini_get('date.timezone')) {
$APPLICATION->ThrowException(GetMessage("DATE_TIMEZONE_ERR")); $APPLICATION->ThrowException(GetMessage("DATE_TIMEZONE_ERR"));
@ -714,6 +714,7 @@ class intaro_intarocrm extends CModule {
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT, serialize($paymentArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT, serialize($paymentArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0); COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_DISCHARGE, 0);
$APPLICATION->IncludeAdminFile( $APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'), GetMessage('MODULE_INSTALL_TITLE'),
@ -866,8 +867,7 @@ class intaro_intarocrm extends CModule {
$arResult['errCode'] = 'ERR_FIELDS_FILE'; $arResult['errCode'] = 'ERR_FIELDS_FILE';
if (isset($arResult['errCode']) && $arResult['errCode']) { if (isset($arResult['errCode']) && $arResult['errCode']) {
$arOldValues = Array( $arOldValues = Array(
'IBLOCK_EXPORT' => $iblocks, 'IBLOCK_EXPORT' => $iblocks,
'IBLOCK_PROPERTY_ARTICLE' => $articleProperties, 'IBLOCK_PROPERTY_ARTICLE' => $articleProperties,
@ -1034,6 +1034,7 @@ class intaro_intarocrm extends CModule {
global $APPLICATION; global $APPLICATION;
CAgent::RemoveAgent("ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID); CAgent::RemoveAgent("ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID);
CAgent::RemoveAgent("ICrmOrderActions::orderHistoryAgent();", $this->MODULE_ID);
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_HOST_OPTION); COption::RemoveOption($this->MODULE_ID, $this->CRM_API_HOST_OPTION);
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_KEY_OPTION); COption::RemoveOption($this->MODULE_ID, $this->CRM_API_KEY_OPTION);
@ -1044,6 +1045,7 @@ class intaro_intarocrm extends CModule {
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_LAST_ID); 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_SITES);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_PROPS); COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_PROPS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_DISCHARGE);
UnRegisterModuleDependences("sale", "OnSalePayOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSalePayOrder"); UnRegisterModuleDependences("sale", "OnSalePayOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSalePayOrder");
UnRegisterModuleDependences("sale", "OnSaleCancelOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSaleCancelOrder"); UnRegisterModuleDependences("sale", "OnSaleCancelOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSaleCancelOrder");

View File

@ -245,17 +245,18 @@ 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(); $orderPropsArr = array();
foreach ($orderTypesList as $orderType) { foreach ($orderTypesList as $orderType) {
$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 > 5)
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++;
}
$orderPropsArr[$orderType['ID']] = $_orderPropsArr;
} }
$orderPropsArr[$orderType['ID']] = $_orderPropsArr;
} }
COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr)); COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr));
@ -407,15 +408,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
), ),
array( array(
"DIV" => "edit3", "DIV" => "edit3",
"TAB" => GetMessage('ICRM_OPTIONS_ORDER_DISCHARGE_TAB'),
"ICON" => '',
"TITLE" => GetMessage('ICRM_OPTIONS_ORDER_DISCHARGE_CAPTION')
),
array(
"DIV" => "edit4",
"TAB" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_TAB'), "TAB" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_TAB'),
"ICON" => '', "ICON" => '',
"TITLE" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_CAPTION') "TITLE" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_CAPTION')
),
array(
"DIV" => "edit4",
"TAB" => GetMessage('ICRM_OPTIONS_ORDER_DISCHARGE_TAB'),
"ICON" => '',
"TITLE" => GetMessage('ICRM_OPTIONS_ORDER_DISCHARGE_CAPTION')
) )
); );
$tabControl = new CAdminTabControl("tabControl", $aTabs); $tabControl = new CAdminTabControl("tabControl", $aTabs);
@ -453,7 +454,6 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<td width="50%" class="adm-detail-content-cell-l"><?php echo GetMessage('ICRM_API_KEY'); ?></td> <td width="50%" class="adm-detail-content-cell-l"><?php echo GetMessage('ICRM_API_KEY'); ?></td>
<td width="50%" class="adm-detail-content-cell-r"><input type="text" id="api_key" name="api_key" value="<?php echo $api_key; ?>"></td> <td width="50%" class="adm-detail-content-cell-r"><input type="text" id="api_key" name="api_key" value="<?php echo $api_key; ?>"></td>
</tr> </tr>
<<<<<<< HEAD
<!--<tr> <!--<tr>
<td width="50%" class="adm-detail-content-cell-l"><?php echo GetMessage('ICRM_SITES'); ?></td> <td width="50%" class="adm-detail-content-cell-l"><?php echo GetMessage('ICRM_SITES'); ?></td>
<td width="50%" class="adm-detail-content-cell-r"> <td width="50%" class="adm-detail-content-cell-r">
@ -464,8 +464,6 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</select> </select>
</td> </td>
</tr>--> </tr>-->
=======
>>>>>>> 22b82eff3f805aaef606018b1c6f63202aca7ad3
<?php $tabControl->BeginNextTab(); ?> <?php $tabControl->BeginNextTab(); ?>
<input type="hidden" name="tab" value="catalog"> <input type="hidden" name="tab" value="catalog">
<tr align="center"> <tr align="center">
@ -578,18 +576,6 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<?php $tabControl->BeginNextTab(); ?> <?php $tabControl->BeginNextTab(); ?>
<input type="hidden" name="tab" value="catalog"> <input type="hidden" name="tab" value="catalog">
<tr class="heading"> <tr class="heading">
<<<<<<< HEAD
<td colspan="2"><b><?php echo GetMessage('ORDER_DISCH'); ?></b></td>
</tr>
<tr class="heading">
<td colspan="2">
<b>
<label><input class="addr" type="radio" name="order-discharge" value="0" <?php if($optionsDischarge == 0) echo "checked"; ?>><?php echo GetMessage('DISCHARGE_AGENT'); ?></label>
<label><input class="addr" type="radio" name="order-discharge" value="1" <?php if($optionsDischarge == 1) echo "checked"; ?>><?php echo GetMessage('DISCHARGE_EVENTS'); ?></label>
</b>
</td>
</tr>
=======
<td colspan="2"><b><?php echo GetMessage('ORDER_PROPS'); ?></b></td> <td colspan="2"><b><?php echo GetMessage('ORDER_PROPS'); ?></b></td>
</tr> </tr>
<tr align="center"> <tr align="center">
@ -629,7 +615,18 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<?php $countProps++; endforeach; ?> <?php $countProps++; endforeach; ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php $tabControl->BeginNextTab(); ?> <?php $tabControl->BeginNextTab(); ?>
>>>>>>> 22b82eff3f805aaef606018b1c6f63202aca7ad3 <input type="hidden" name="tab" value="catalog">
<tr class="heading">
<td colspan="2"><b><?php echo GetMessage('ORDER_DISCH'); ?></b></td>
</tr>
<tr class="heading">
<td colspan="2">
<b>
<label><input class="addr" type="radio" name="order-discharge" value="0" <?php if($optionsDischarge == 0) echo "checked"; ?>><?php echo GetMessage('DISCHARGE_AGENT'); ?></label>
<label><input class="addr" type="radio" name="order-discharge" value="1" <?php if($optionsDischarge == 1) echo "checked"; ?>><?php echo GetMessage('DISCHARGE_EVENTS'); ?></label>
</b>
</td>
</tr>
<?php $tabControl->Buttons(); ?> <?php $tabControl->Buttons(); ?>
<input type="hidden" name="Update" value="Y" /> <input type="hidden" name="Update" value="Y" />
<input type="submit" title="<?php echo GetMessage('ICRM_OPTIONS_SUBMIT_TITLE'); ?>" value="<?php echo GetMessage('ICRM_OPTIONS_SUBMIT_VALUE'); ?>" name="btn-update" class="adm-btn-save" /> <input type="submit" title="<?php echo GetMessage('ICRM_OPTIONS_SUBMIT_TITLE'); ?>" value="<?php echo GetMessage('ICRM_OPTIONS_SUBMIT_VALUE'); ?>" name="btn-update" class="adm-btn-save" />

View File

@ -1,12 +0,0 @@
<?php
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_run.php')) {
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_run.php');
}
$updater->CopyFiles("install/export/intarocrm_run.php", "php_interface/include/catalog_export/intarocrm_run.php");
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_setup.php')) {
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_setup.php');
}
$updater->CopyFiles("install/export/intarocrm_setup.php", "php_interface/include/catalog_export/intarocrm_setup.php");
COption::SetOptionString('intaro.intarocrm', 'sites_ids', serialize(array()));