From 084147eb2bf5bd11b57944654ad7dabe2278d900 Mon Sep 17 00:00:00 2001 From: Grisha Pomadchin Date: Thu, 12 Sep 2013 19:00:46 +0400 Subject: [PATCH] merge fix; v0.4.0 --- .../classes/general/ICrmOrderActions.php | 24 +++++++- intaro.intarocrm/description.ru | 4 -- intaro.intarocrm/include.php | 10 +++ intaro.intarocrm/install/index.php | 8 ++- intaro.intarocrm/options.php | 61 +++++++++---------- intaro.intarocrm/updater.php | 12 ---- 6 files changed, 66 insertions(+), 53 deletions(-) delete mode 100644 intaro.intarocrm/description.ru create mode 100755 intaro.intarocrm/include.php delete mode 100644 intaro.intarocrm/updater.php diff --git a/intaro.intarocrm/classes/general/ICrmOrderActions.php b/intaro.intarocrm/classes/general/ICrmOrderActions.php index d47064b0..9ec6299f 100755 --- a/intaro.intarocrm/classes/general/ICrmOrderActions.php +++ b/intaro.intarocrm/classes/general/ICrmOrderActions.php @@ -646,7 +646,7 @@ class ICrmOrderActions if(isset($arParams['optionsSites']) && is_array($arParams['optionsSites']) && in_array($arFields['LID'], $arParams['optionsSites'])) $resOrder['site'] = $arFields['LID']; - + // parse fio if(count($contactNameArr) == 1) { $resOrder['firstName'] = $contactNameArr[0]; @@ -655,8 +655,10 @@ class ICrmOrderActions $resOrder['firstName'] = $contactNameArr[1]; $resOrder['patronymic'] = $contactNameArr[2]; } - + $resOrder = self::clearArr($resOrder); + + self::eventLog('ICrmOrderActions::orderHistory', 'iblock', json_encode($resOrder)); if($send) return $api->orderEdit($resOrder); @@ -729,4 +731,22 @@ class ICrmOrderActions 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, + )); + } + } } \ No newline at end of file diff --git a/intaro.intarocrm/description.ru b/intaro.intarocrm/description.ru deleted file mode 100644 index e7c53b7d..00000000 --- a/intaro.intarocrm/description.ru +++ /dev/null @@ -1,4 +0,0 @@ -* Доработан скрипт генерации ICML-файла в части работы со спецсимволами -* Добавлена поддержка многосайтовости -* Добавлена возможность выгрузки способов доставки на втором шаге установки -* Проверка временной зоны перед установкой \ No newline at end of file diff --git a/intaro.intarocrm/include.php b/intaro.intarocrm/include.php new file mode 100755 index 00000000..933ef5fa --- /dev/null +++ b/intaro.intarocrm/include.php @@ -0,0 +1,10 @@ + 'classes/general/RestApi.php', + 'ICrmOrderActions' => 'classes/general/ICrmOrderActions.php', + 'ICMLLoader' => 'classes/general/ICMLLoader.php', + 'ICrmOrderEvent' => 'classes/general/events/ICrmOrderEvent.php' + ) +); \ No newline at end of file diff --git a/intaro.intarocrm/install/index.php b/intaro.intarocrm/install/index.php index b6005234..2979d7b9 100755 --- a/intaro.intarocrm/install/index.php +++ b/intaro.intarocrm/install/index.php @@ -32,6 +32,7 @@ class intaro_intarocrm extends CModule { var $CRM_ORDER_LAST_ID = 'order_last_id'; var $CRM_ORDER_SITES = 'sites_ids'; var $CRM_ORDER_PROPS = 'order_props'; + var $CRM_ORDER_DISCHARGE = 'order_discharge'; var $INSTALL_PATH; function intaro_intarocrm() { @@ -67,7 +68,6 @@ class intaro_intarocrm extends CModule { } } - if (!date_default_timezone_get()) { if (!ini_get('date.timezone')) { $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, serialize($paymentArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0); + COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_DISCHARGE, 0); $APPLICATION->IncludeAdminFile( GetMessage('MODULE_INSTALL_TITLE'), @@ -866,8 +867,7 @@ class intaro_intarocrm extends CModule { $arResult['errCode'] = 'ERR_FIELDS_FILE'; if (isset($arResult['errCode']) && $arResult['errCode']) { - - + $arOldValues = Array( 'IBLOCK_EXPORT' => $iblocks, 'IBLOCK_PROPERTY_ARTICLE' => $articleProperties, @@ -1034,6 +1034,7 @@ class intaro_intarocrm extends CModule { global $APPLICATION; 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_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_SITES); 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", "OnSaleCancelOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSaleCancelOrder"); diff --git a/intaro.intarocrm/options.php b/intaro.intarocrm/options.php index 3ce0ef26..a394538c 100755 --- a/intaro.intarocrm/options.php +++ b/intaro.intarocrm/options.php @@ -245,17 +245,18 @@ 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 = 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[$orderType['ID']] = $_orderPropsArr; } COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr)); @@ -407,15 +408,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) { ), array( "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'), "ICON" => '', "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); @@ -453,7 +454,6 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) { -<<<<<<< HEAD -======= ->>>>>>> 22b82eff3f805aaef606018b1c6f63202aca7ad3 BeginNextTab(); ?> @@ -578,18 +576,6 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) { BeginNextTab(); ?> -<<<<<<< HEAD - - - - - - - - - - -======= @@ -629,7 +615,18 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) { BeginNextTab(); ?> ->>>>>>> 22b82eff3f805aaef606018b1c6f63202aca7ad3 + + + + + + + + + + + + Buttons(); ?> diff --git a/intaro.intarocrm/updater.php b/intaro.intarocrm/updater.php deleted file mode 100644 index d6f14b7a..00000000 --- a/intaro.intarocrm/updater.php +++ /dev/null @@ -1,12 +0,0 @@ -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())); \ No newline at end of file