v.2.2.9 (#33)
This commit is contained in:
parent
0e1ec2b03c
commit
1e12e4d418
@ -1,3 +1,7 @@
|
||||
## 2017-11-01 v.2.2.8
|
||||
* Исправлены баги пакетной выгрузки
|
||||
* Исправлена ошибка при работе на php7.1
|
||||
|
||||
## 2017-10-26 v.2.2.7
|
||||
* Исправлен баг при работе с одним сайтом
|
||||
|
||||
|
@ -326,7 +326,7 @@ class RCrmActions
|
||||
return self::proxy($api, $methodApi, $method, array($params, $site));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function proxy($api, $methodApi, $method, $params) {
|
||||
$log = new Logger();
|
||||
$version = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_VERSION, 0);
|
||||
@ -360,11 +360,11 @@ class RCrmActions
|
||||
'params' => $params
|
||||
), 'apiErrors');
|
||||
}
|
||||
|
||||
|
||||
if (function_exists('retailCrmApiResult')) {
|
||||
retailCrmApiResult($methodApi, false, $result->getStatusCode());
|
||||
}
|
||||
|
||||
|
||||
if ($result->getStatusCode() == 460) {
|
||||
return true;
|
||||
}
|
||||
@ -408,11 +408,11 @@ class RCrmActions
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (function_exists('retailCrmApiResult')) {
|
||||
retailCrmApiResult($methodApi, true, $result->getStatusCode());
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ class RetailCrmHistory
|
||||
'CURRENCY' => \Bitrix\Currency\CurrencyManager::getBaseCurrency(),
|
||||
'LID' => $site,
|
||||
'BASE_PRICE' => $product['initialPrice'],
|
||||
'NAME' => $product['name'] ? RCrmActions::fromJSON($product['name']) : $elem['NAME'],
|
||||
'NAME' => $product['offer']['name'] ? RCrmActions::fromJSON($product['offer']['name']) : $elem['NAME'],
|
||||
'DETAIL_PAGE_URL' => $elem['URL']
|
||||
));
|
||||
} else {
|
||||
@ -1186,16 +1186,16 @@ class RetailCrmHistory
|
||||
return $outputArray;
|
||||
}
|
||||
|
||||
public static function setProp($obj, $value = '', $prop)
|
||||
public static function setProp($obj, $value = '', $prop = '')
|
||||
{
|
||||
if (!isset($obj)) {
|
||||
return false;
|
||||
}
|
||||
if ($prop) {
|
||||
if ($prop && $value) {
|
||||
$obj->setField($prop, $value);
|
||||
} elseif ($value) {
|
||||
} elseif ($value && !$prop) {
|
||||
$obj->setValue($value);
|
||||
} else {
|
||||
} elseif (!$value && !$prop) {
|
||||
$obj->delete();
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,7 @@ class RetailCrmHistory
|
||||
'CURRENCY' => \Bitrix\Currency\CurrencyManager::getBaseCurrency(),
|
||||
'LID' => $site,
|
||||
'BASE_PRICE' => $product['initialPrice'],
|
||||
'NAME' => $product['name'] ? RCrmActions::fromJSON($product['name']) : $elem['NAME'],
|
||||
'NAME' => $product['offer']['name'] ? RCrmActions::fromJSON($product['offer']['name']) : $elem['NAME'],
|
||||
'DETAIL_PAGE_URL' => $elem['URL'],
|
||||
'PRODUCT_PROVIDER_CLASS' => 'CCatalogProductProvider',
|
||||
'DIMENSIONS' => $elem['DIMENSIONS'],
|
||||
@ -1155,7 +1155,7 @@ class RetailCrmHistory
|
||||
//data from crm
|
||||
$paySumm = 0;
|
||||
foreach ($paymentsCrm['payments'] as $paymentCrm) {
|
||||
if (!empty($paymentCrm['externalId'])) {
|
||||
if (isset($paymentCrm['externalId']) && !empty($paymentCrm['externalId'])) {
|
||||
//find the payment
|
||||
$nowPayment = $paymentsList[$paymentCrm['externalId']];
|
||||
//update data
|
||||
@ -1189,9 +1189,9 @@ class RetailCrmHistory
|
||||
|
||||
unset($paymentsList[$newPaymentId]);
|
||||
|
||||
RCrmActions::apiMethod($api, 'ordersPaymentEdit', __METHOD__, array('id' => $paymentCrm['id'], 'externalId' => $newPaymentId));
|
||||
RCrmActions::apiMethod($api, 'paymentEditById', __METHOD__, array('id' => $paymentCrm['id'], 'externalId' => $newPaymentId));
|
||||
}
|
||||
|
||||
|
||||
if ($optionsPayment[$paymentCrm['status']] == 'Y') {
|
||||
$paySumm += $paymentCrm['amount'];
|
||||
}
|
||||
@ -1242,16 +1242,16 @@ class RetailCrmHistory
|
||||
return $outputArray;
|
||||
}
|
||||
|
||||
public static function setProp($obj, $value = '', $prop)
|
||||
public static function setProp($obj, $value = '', $prop = '')
|
||||
{
|
||||
if (!isset($obj)) {
|
||||
return false;
|
||||
}
|
||||
if ($prop) {
|
||||
if ($prop && $value) {
|
||||
$obj->setField($prop, $value);
|
||||
} elseif ($value) {
|
||||
} elseif ($value && !$prop) {
|
||||
$obj->setValue($value);
|
||||
} else {
|
||||
} elseif (!$value && !$prop) {
|
||||
$obj->delete();
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,15 @@ class RetailCrmOrder
|
||||
|
||||
if (count($resOrders) > 0) {
|
||||
foreach ($resCustomers as $key => $customerLoad) {
|
||||
$site = count($optionsSitesList) > 1 ? $optionsSitesList[$key] : null;
|
||||
if ($optionsSitesList) {
|
||||
if (array_key_exists($key, $optionsSitesList) && $optionsSitesList[$key] != null) {
|
||||
$site = $optionsSitesList[$key];
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} elseif (!$optionsSitesList) {
|
||||
$site == null;
|
||||
}
|
||||
if (RCrmActions::apiMethod($api, 'customersUpload', __METHOD__, $customerLoad, $site) === false) {
|
||||
return false;
|
||||
}
|
||||
@ -281,7 +289,15 @@ class RetailCrmOrder
|
||||
}
|
||||
}
|
||||
foreach ($resOrders as $key => $orderLoad) {
|
||||
$site = count($optionsSitesList) > 1 ? $optionsSitesList[$key] : null;
|
||||
if ($optionsSitesList) {
|
||||
if (array_key_exists($key, $optionsSitesList) && $optionsSitesList[$key] != null) {
|
||||
$site = $optionsSitesList[$key];
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} elseif (!$optionsSitesList) {
|
||||
$site == null;
|
||||
}
|
||||
if (RCrmActions::apiMethod($api, 'ordersUpload', __METHOD__, $orderLoad, $site) === false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ class RetailCrmOrder
|
||||
$order = $newResOrder;
|
||||
} elseif ($newResOrder === false) {
|
||||
RCrmActions::eventLog('RetailCrmOrder::orderSend', 'retailCrmBeforeOrderSend()', 'OrderID = ' . $arFields['ID'] . '. Sending canceled after retailCrmBeforeOrderSend');
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -279,16 +279,6 @@ class RetailCrmOrder
|
||||
$order = self::orderObjToArr($id);
|
||||
$user = Bitrix\Main\UserTable::getById($order['USER_ID'])->fetch();
|
||||
|
||||
if(array_key_exists($arOrder['LID'], $optionsSitesList)) {
|
||||
$site = $optionsSitesList[$arOrder['LID']];
|
||||
} else {
|
||||
$site = null;
|
||||
}
|
||||
|
||||
if ($site == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$arCustomers = RetailCrmUser::customerSend($user, $api, $optionsContragentType[$order['PERSON_TYPE_ID']], false, $site);
|
||||
$arOrders = self::orderSend($order, $api, $arParams, false, $site);
|
||||
|
||||
@ -304,10 +294,14 @@ class RetailCrmOrder
|
||||
|
||||
if (count($resOrders) > 0) {
|
||||
foreach ($resCustomers as $key => $customerLoad) {
|
||||
if(array_key_exists($key, $optionsSitesList)) {
|
||||
$site = $optionsSitesList[$key];
|
||||
} else {
|
||||
$site = null;
|
||||
if ($optionsSitesList) {
|
||||
if (array_key_exists($key, $optionsSitesList) && $optionsSitesList[$key] != null) {
|
||||
$site = $optionsSitesList[$key];
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} elseif (!$optionsSitesList) {
|
||||
$site == null;
|
||||
}
|
||||
if (RCrmActions::apiMethod($api, 'customersUpload', __METHOD__, $customerLoad, $site) === false) {
|
||||
return false;
|
||||
@ -317,10 +311,14 @@ class RetailCrmOrder
|
||||
}
|
||||
}
|
||||
foreach ($resOrders as $key => $orderLoad) {
|
||||
if(array_key_exists($key, $optionsSitesList)) {
|
||||
$site = $optionsSitesList[$key];
|
||||
} else {
|
||||
$site = null;
|
||||
if ($optionsSitesList) {
|
||||
if (array_key_exists($key, $optionsSitesList) && $optionsSitesList[$key] != null) {
|
||||
$site = $optionsSitesList[$key];
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} elseif (!$optionsSitesList) {
|
||||
$site == null;
|
||||
}
|
||||
if (RCrmActions::apiMethod($api, 'ordersUpload', __METHOD__, $orderLoad, $site) === false) {
|
||||
return false;
|
||||
|
@ -1 +1,2 @@
|
||||
- Исправлен баг при работе с одним сайтом
|
||||
- Исправлены ошибки подключения кастомных классов
|
||||
- Улучшена обработка истории
|
@ -5,20 +5,20 @@ $version = COption::GetOptionString('intaro.retailcrm', 'api_version');
|
||||
CModule::AddAutoloadClasses(
|
||||
'intaro.retailcrm', // module name
|
||||
array (
|
||||
'RestNormalizer' => file_exists($server . '/bitrix/php_interface/retailcrm/RestNormalizer.php') ? $server . '/bitrix/php_interface/retailcrm/RestNormalizer.php' : 'classes/general/RestNormalizer.php',
|
||||
'Logger' => file_exists($server . '/bitrix/php_interface/retailcrm/Logger.php') ? $server . '/bitrix/php_interface/retailcrm/Logger.php' : 'classes/general/Logger.php',
|
||||
'RetailCrm\ApiClient' => file_exists($server . '/bitrix/php_interface/retailcrm/ApiClient.php') ? $server . '/bitrix/php_interface/retailcrm/ApiClient.php' : 'classes/general/ApiClient_' . $version . '.php',
|
||||
'RetailCrm\Http\Client' => file_exists($server . '/bitrix/php_interface/retailcrm/Client.php') ? $server . '/bitrix/php_interface/retailcrm/Client.php' : 'classes/general/Http/Client.php',
|
||||
'RCrmActions' => file_exists($server . '/bitrix/php_interface/retailcrm/RCrmActions.php') ? $server . '/bitrix/php_interface/retailcrm/RCrmActions.php' : 'classes/general/RCrmActions.php',
|
||||
'RetailCrmUser' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmUser.php') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmUser.php' : 'classes/general/user/RetailCrmUser.php',
|
||||
'RetailCrmOrder' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmOrder.php') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmOrder.php' : 'classes/general/order/RetailCrmOrder_' . $version . '.php',
|
||||
'RetailCrmHistory' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmHistory.php') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmHistory.php' : 'classes/general/history/RetailCrmHistory_' . $version . '.php',
|
||||
'RestNormalizer' => file_exists($server . '/bitrix/php_interface/retailcrm/RestNormalizer.php') ? '../../php_interface/retailcrm/RestNormalizer.php' : 'classes/general/RestNormalizer.php',
|
||||
'Logger' => file_exists($server . '/bitrix/php_interface/retailcrm/Logger.php') ? '../../php_interface/retailcrm/Logger.php' : 'classes/general/Logger.php',
|
||||
'RetailCrm\ApiClient' => file_exists($server . '/bitrix/php_interface/retailcrm/ApiClient.php') ? '../../php_interface/retailcrm/ApiClient.php' : 'classes/general/ApiClient_' . $version . '.php',
|
||||
'RetailCrm\Http\Client' => file_exists($server . '/bitrix/php_interface/retailcrm/Client.php') ? '../../php_interface/retailcrm/Client.php' : 'classes/general/Http/Client.php',
|
||||
'RCrmActions' => file_exists($server . '/bitrix/php_interface/retailcrm/RCrmActions.php') ? '../../php_interface/retailcrm/RCrmActions.php' : 'classes/general/RCrmActions.php',
|
||||
'RetailCrmUser' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmUser.php') ? '../../php_interface/retailcrm/RetailCrmUser.php' : 'classes/general/user/RetailCrmUser.php',
|
||||
'RetailCrmOrder' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmOrder.php') ? '../../php_interface/retailcrm/RetailCrmOrder.php' : 'classes/general/order/RetailCrmOrder_' . $version . '.php',
|
||||
'RetailCrmHistory' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmHistory.php') ? '../../php_interface/retailcrm/RetailCrmHistory.php' : 'classes/general/history/RetailCrmHistory_' . $version . '.php',
|
||||
'RetailCrmICML' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmICML.php') ? '../../php_interface/retailcrm/RetailCrmICML.php' : 'classes/general/icml/RetailCrmICML.php',
|
||||
'RetailCrmInventories' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmInventories.php') ? '../../php_interface/retailcrm/RetailCrmInventories.php' : 'classes/general/inventories/RetailCrmInventories.php',
|
||||
'RetailCrmPrices' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmPrices.php') ? '../../php_interface/retailcrm/RetailCrmPrices.php' : 'classes/general/prices/RetailCrmPrices.php',
|
||||
'RetailCrmCollector' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmCollector.php') ? '../../php_interface/retailcrm/RetailCrmCollector.php' : 'classes/general/collector/RetailCrmCollector.php',
|
||||
'RetailCrmUa' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmUa.php') ? '../../php_interface/retailcrm/RetailCrmUa.php' : 'classes/general/ua/RetailCrmUa.php',
|
||||
'RetailCrmEvent' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmEvent.php') ? $server . '/bitrix/php_interface/retailcrm/RetailCrmEvent.php' : 'classes/general/events/RetailCrmEvent.php',
|
||||
'RetailCrmEvent' => file_exists($server . '/bitrix/php_interface/retailcrm/RetailCrmEvent.php') ? '../../php_interface/retailcrm/RetailCrmEvent.php' : 'classes/general/events/RetailCrmEvent.php',
|
||||
'RetailCrm\Response\ApiResponse' => 'classes/general/Response/ApiResponse.php',
|
||||
'RetailCrm\Exception\InvalidJsonException' => 'classes/general/Exception/InvalidJsonException.php',
|
||||
'RetailCrm\Exception\CurlException' => 'classes/general/Exception/CurlException.php',
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?
|
||||
$arModuleVersion = array(
|
||||
"VERSION" => "2.2.7",
|
||||
"VERSION_DATE" => "2017-09-25 14:50:00"
|
||||
"VERSION" => "2.2.9",
|
||||
"VERSION_DATE" => "2017-11-13 11:00:00"
|
||||
);
|
||||
|
@ -276,12 +276,16 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
UnRegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $mid, "RetailCrmEvent", "orderSave");
|
||||
UnRegisterModuleDependences("sale", "OnOrderUpdate", $mid, "RetailCrmEvent", "onUpdateOrder");
|
||||
UnRegisterModuleDependences("sale", "OnSaleOrderEntityDelete", $mid, "RetailCrmEvent", "orderDelete");
|
||||
UnRegisterModuleDependences("sale", "OnSalePaymentEntitySaved", $mid, "RetailCrmEvent", "paymentSave");
|
||||
UnRegisterModuleDependences("sale", "OnSalePaymentEntityDeleted", $mid, "RetailCrmEvent", "paymentDelete");
|
||||
|
||||
} elseif (($orderDischarge != $previousDischarge) && ($orderDischarge == 1)) {
|
||||
// event dependencies
|
||||
RegisterModuleDependences("sale", "OnSaleOrderEntitySaved", $mid, "RetailCrmEvent", "orderSave");
|
||||
RegisterModuleDependences("sale", "OnOrderUpdate", $mid, "RetailCrmEvent", "onUpdateOrder");
|
||||
RegisterModuleDependences("sale", "OnSaleOrderEntityDelete", $mid, "RetailCrmEvent", "orderDelete");
|
||||
RegisterModuleDependences("sale", "OnSalePaymentEntitySaved", $mid, "RetailCrmEvent", "paymentSave");
|
||||
RegisterModuleDependences("sale", "OnSalePaymentEntityDeleted", $mid, "RetailCrmEvent", "paymentDelete");
|
||||
}
|
||||
|
||||
$orderPropsArr = array();
|
||||
|
Loading…
Reference in New Issue
Block a user