commit
e4ba1db330
@ -1,3 +1,10 @@
|
||||
## 2018-11-02 v.2.4.0
|
||||
* Изменена привязка на событие сохранения заказа. Используется привязка к событию "OnSaleOrderSaved"
|
||||
* Исправлено удаление событий модуля при удалении модуля интеграции из CMS
|
||||
* Добавлено подключение файла Logger.php при удалении модуля
|
||||
* Изменен механизм определения протокола, с которым работает сайт. Используется метод isHttps() 1С-Bitrix
|
||||
* Исправлена передача веса товара при отправке габбаритов заказа
|
||||
|
||||
## 2018-10-29 v.2.3.14
|
||||
* Добавлено подключение файла RCrmActions.php при удалении модуля
|
||||
|
||||
|
@ -168,7 +168,6 @@ class RetailCrmEvent
|
||||
$arParams['crmOrder'] = $orderCrm['order'];
|
||||
} else {
|
||||
$methodApi = 'ordersCreate';
|
||||
$GLOBALS['RETAILCRM_ORDER_NEW_ORDER'] = true;
|
||||
}
|
||||
|
||||
//user
|
||||
@ -222,7 +221,6 @@ class RetailCrmEvent
|
||||
'SUM' => $event->getField('SUM'),
|
||||
'LID' => $event->getField('LID'),
|
||||
'DATE_PAID' => $event->getField('DATE_PAID'),
|
||||
'METHOD' => $GLOBALS['RETAILCRM_ORDER_NEW_ORDER'],
|
||||
);
|
||||
|
||||
try {
|
||||
@ -252,18 +250,6 @@ class RetailCrmEvent
|
||||
$payments = $orderCrm['order']['payments'];
|
||||
}
|
||||
|
||||
if ($arPayment['METHOD'] === true) {
|
||||
if ($payments) {
|
||||
foreach ($payments as $payment) {
|
||||
if (!isset($payment['externalId'])) {
|
||||
if ($payment['type'] == $optionsPaymentTypes[$arPayment['PAY_SYSTEM_ID']]) {
|
||||
$payment['externalId'] = $arPayment['ID'];
|
||||
RCrmActions::apiMethod($api, 'paymentEditById', __METHOD__, $payment, $site);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($payments) {
|
||||
foreach ($payments as $payment) {
|
||||
if (isset($payment['externalId'])) {
|
||||
@ -312,7 +298,6 @@ class RetailCrmEvent
|
||||
RCrmActions::apiMethod($api, 'ordersPaymentCreate', __METHOD__, $paymentToCrm, $site);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* paymentDelete
|
||||
|
@ -36,6 +36,7 @@ class RetailCrmICML
|
||||
|
||||
protected $MODULE_ID = 'intaro.retailcrm';
|
||||
protected $CRM_CATALOG_BASE_PRICE = 'catalog_base_price';
|
||||
protected $PROTOCOL_OPTION = 'protocol';
|
||||
|
||||
protected $measurement = array (
|
||||
'mm' => 1, // 1 mm = 1 mm
|
||||
@ -74,17 +75,7 @@ class RetailCrmICML
|
||||
$defaultSite = CSite::GetList($by = "def", $order = "desc", array('DEF' => 'Y'))->Fetch();
|
||||
$this->encodingDefault = $defaultSite["CHARSET"];
|
||||
|
||||
$url = 'https://' . $this->defaultServerName;
|
||||
$curlHandler = curl_init();
|
||||
curl_setopt($curlHandler, CURLOPT_URL, $url);
|
||||
$responseBody = curl_exec($curlHandler);
|
||||
$statusCode = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE);
|
||||
curl_close($curlHandler);
|
||||
if ($statusCode == 200) {
|
||||
$this->protocol = 'https://';
|
||||
} else {
|
||||
$this->protocol = 'http://';
|
||||
}
|
||||
$this->protocol = COption::GetOptionString($this->MODULE_ID, $this->PROTOCOL_OPTION);
|
||||
|
||||
$this->PrepareSettings();
|
||||
|
||||
|
@ -171,7 +171,7 @@ class RetailCrmOrder
|
||||
$width += $dimensions['WIDTH'];
|
||||
$height += $dimensions['HEIGHT'];
|
||||
$length += $dimensions['LENGTH'];
|
||||
$weight += $product['WEIGHT'];
|
||||
$weight += $product['WEIGHT'] * $product['QUANTITY'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,2 @@
|
||||
- Исправлены ошибки
|
||||
- Изменена привязка на событие сохранения заказа. Теперь модуль привязан к событию, которое вызывается после сохранения всех сущностей.
|
||||
- Изменена механика получения протокола, с которым работает сайт клиента. ТЕперь используется внутренний метод 1C-Bitrix
|
@ -70,6 +70,7 @@ class intaro_retailcrm extends CModule
|
||||
var $HISTORY_TIME = 'history_time';
|
||||
|
||||
var $CLIENT_ID = 'client_id';
|
||||
var $PROTOCOL = 'protocol';
|
||||
|
||||
var $INSTALL_PATH;
|
||||
|
||||
@ -512,6 +513,14 @@ class intaro_retailcrm extends CModule
|
||||
//form orderProps
|
||||
$arResult['arProp'] = RCrmActions::OrderPropsList();
|
||||
|
||||
$request = \Bitrix\Main\Application::getInstance()->getContext()->getRequest();
|
||||
|
||||
if ($request->isHttps() === true) {
|
||||
COption::SetOptionString($this->MODULE_ID, $this->PROTOCOL, 'https://');
|
||||
} else {
|
||||
COption::SetOptionString($this->MODULE_ID, $this->PROTOCOL, 'http://');
|
||||
}
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_TYPES_ARR, serialize(RCrmActions::clearArr($orderTypesArr)));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, serialize(RCrmActions::clearArr($deliveryTypesArr)));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_TYPES, serialize(RCrmActions::clearArr($paymentTypesArr)));
|
||||
@ -891,7 +900,7 @@ class intaro_retailcrm extends CModule
|
||||
RegisterModule($this->MODULE_ID);
|
||||
RegisterModuleDependences("sale", "OnOrderUpdate", $this->MODULE_ID, "RetailCrmEvent", "onUpdateOrder");
|
||||
RegisterModuleDependences("main", "OnAfterUserUpdate", $this->MODULE_ID, "RetailCrmEvent", "OnAfterUserUpdate");
|
||||
RegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $this->MODULE_ID, "RetailCrmEvent", "orderSave");
|
||||
RegisterModuleDependences("sale", \Bitrix\sale\EventActions::EVENT_ON_ORDER_SAVED, $this->MODULE_ID, "RetailCrmEvent", "orderSave");
|
||||
RegisterModuleDependences("sale", "OnSaleOrderDeleted", $this->MODULE_ID, "RetailCrmEvent", "orderDelete");
|
||||
RegisterModuleDependences("sale", "OnSalePaymentEntitySaved", $this->MODULE_ID, "RetailCrmEvent", "paymentSave");
|
||||
RegisterModuleDependences("sale", "OnSalePaymentEntityDeleted", $this->MODULE_ID, "RetailCrmEvent", "paymentDelete");
|
||||
@ -1068,6 +1077,8 @@ class intaro_retailcrm extends CModule
|
||||
include($this->INSTALL_PATH . '/../classes/general/Exception/InvalidJsonException.php');
|
||||
include($this->INSTALL_PATH . '/../classes/general/Exception/CurlException.php');
|
||||
include($this->INSTALL_PATH . '/../classes/general/RCrmActions.php');
|
||||
include($this->INSTALL_PATH . '/../classes/general/Logger.php');
|
||||
|
||||
|
||||
if ($api_version == 'v4') {
|
||||
include($this->INSTALL_PATH . '/../classes/general/ApiClient_v4.php');
|
||||
@ -1128,11 +1139,21 @@ class intaro_retailcrm extends CModule
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_VERSION);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->HISTORY_TIME);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->CLIENT_ID);
|
||||
COption::RemoveOption($this->MODULE_ID, $this->PROTOCOL);
|
||||
|
||||
if (CModule::IncludeModule('sale')) {
|
||||
UnRegisterModuleDependences(
|
||||
"sale",
|
||||
\Bitrix\sale\EventActions::EVENT_ON_ORDER_SAVED,
|
||||
$this->MODULE_ID,
|
||||
"RetailCrmEvent",
|
||||
"orderSave"
|
||||
);
|
||||
}
|
||||
|
||||
UnRegisterModuleDependences("sale", "OnOrderUpdate", $this->MODULE_ID, "RetailCrmEvent", "onUpdateOrder");
|
||||
UnRegisterModuleDependences("main", "OnAfterUserUpdate", $this->MODULE_ID, "RetailCrmEvent", "OnAfterUserUpdate");
|
||||
UnRegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $this->MODULE_ID, "RetailCrmEvent", "orderSave");
|
||||
UnRegisterModuleDependences("sale", "OnSaleBeforeOrderDelete", $this->MODULE_ID, "RetailCrmEvent", "orderDelete");
|
||||
UnRegisterModuleDependences("sale", "OnSaleOrderDeleted", $this->MODULE_ID, "RetailCrmEvent", "orderDelete");
|
||||
UnRegisterModuleDependences("main", "OnBeforeProlog", $this->MODULE_ID, "RetailCrmCollector", "add");
|
||||
UnRegisterModuleDependences("main", "OnBeforeProlog", $this->MODULE_ID, "RetailCrmUa", "add");
|
||||
UnRegisterModuleDependences("sale", "OnSalePaymentEntitySaved", $this->MODULE_ID, "RetailCrmEvent", "paymentSave");
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?
|
||||
$arModuleVersion = array(
|
||||
"VERSION" => "2.3.14",
|
||||
"VERSION_DATE" => "2018-10-29 11:40:00"
|
||||
"VERSION" => "2.4.0",
|
||||
"VERSION_DATE" => "2018-11-02 14:20:00"
|
||||
);
|
||||
|
@ -43,6 +43,7 @@ $CRM_API_VERSION = 'api_version';
|
||||
$CRM_CURRENCY = 'currency';
|
||||
$CRM_ADDRESS_OPTIONS = 'address_options';
|
||||
$CRM_DIMENSIONS = 'order_dimensions';
|
||||
$PROTOCOL = 'protocol';
|
||||
|
||||
if(!CModule::IncludeModule('intaro.retailcrm') || !CModule::IncludeModule('sale') || !CModule::IncludeModule('iblock') || !CModule::IncludeModule('catalog'))
|
||||
return;
|
||||
@ -276,12 +277,12 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
$orderDischarge = (int) htmlspecialchars(trim($_POST['order-discharge']));
|
||||
if (($orderDischarge != $previousDischarge) && ($orderDischarge == 0)) {
|
||||
// remove depenedencies
|
||||
UnRegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $mid, "RetailCrmEvent", "orderSave");
|
||||
UnRegisterModuleDependences("sale", \Bitrix\sale\EventActions::EVENT_ON_ORDER_SAVED, $mid, "RetailCrmEvent", "orderSave");
|
||||
UnRegisterModuleDependences("sale", "OnOrderUpdate", $mid, "RetailCrmEvent", "onUpdateOrder");
|
||||
UnRegisterModuleDependences("sale", "OnSaleOrderDeleted", $mid, "RetailCrmEvent", "orderDelete");
|
||||
} elseif (($orderDischarge != $previousDischarge) && ($orderDischarge == 1)) {
|
||||
// event dependencies
|
||||
RegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $mid, "RetailCrmEvent", "orderSave");
|
||||
RegisterModuleDependences("sale", \Bitrix\sale\EventActions::EVENT_ON_ORDER_SAVED, $mid, "RetailCrmEvent", "orderSave");
|
||||
RegisterModuleDependences("sale", "OnOrderUpdate", $mid, "RetailCrmEvent", "onUpdateOrder");
|
||||
RegisterModuleDependences("sale", "OnSaleOrderDeleted", $mid, "RetailCrmEvent", "orderDelete");
|
||||
}
|
||||
@ -513,6 +514,12 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
COption::SetOptionString($mid, $CRM_UA_KEYS, serialize(RCrmActions::clearArr($uaKeys)));
|
||||
COption::SetOptionString($mid, $CRM_DIMENSIONS, $orderDimensions);
|
||||
|
||||
if ($request->isHttps() === true) {
|
||||
COption::SetOptionString($mid, $PROTOCOL, 'https://');
|
||||
} else {
|
||||
COption::SetOptionString($mid, $PROTOCOL, 'http://');
|
||||
}
|
||||
|
||||
$uri .= '&ok=Y';
|
||||
LocalRedirect($uri);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user