v2.3.8
This commit is contained in:
parent
6412e6bf7f
commit
7e3ea3fa87
@ -1,4 +1,9 @@
|
||||
## 2018-06-33 v.2.3.7
|
||||
## 2018-07-16 v.2.3.8
|
||||
* Добавлен рассчет стоимости товара с учетом наценки
|
||||
* Добавлена выгрузка картинок товара, если отсутствует картинка торгового предложения
|
||||
* Заменены устаревшие методы в API клиенте
|
||||
|
||||
## 2018-06-13 v.2.3.7
|
||||
* Добавлена выгрузка штрихкодов в ICML
|
||||
* Добавлена выгрузка картинок торговых предложений в ICML
|
||||
* Улучшена передача типа доставки в заказе
|
||||
|
@ -48,8 +48,6 @@ class ApiClient
|
||||
* @param string $site site code
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __construct($url, $apiKey, $site = null)
|
||||
{
|
||||
@ -1373,30 +1371,6 @@ class ApiClient
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get store settings
|
||||
*
|
||||
* @param string $code get settings code
|
||||
*
|
||||
* @return ApiResponse
|
||||
* @throws \RetailCrm\Exception\InvalidJsonException
|
||||
* @throws \RetailCrm\Exception\CurlException
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function storeSettingsGet($code)
|
||||
{
|
||||
if (empty($code)) {
|
||||
throw new \InvalidArgumentException('Parameter `code` must be set');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
"/store/setting/$code",
|
||||
Client::METHOD_GET
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload store inventories
|
||||
*
|
||||
@ -1486,30 +1460,31 @@ class ApiClient
|
||||
}
|
||||
|
||||
/**
|
||||
* Get delivery settings
|
||||
* Get module configuration
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws \RetailCrm\Exception\CurlException
|
||||
* @throws \RetailCrm\Exception\InvalidJsonException
|
||||
* @throws \RetailCrm\Exception\CurlException
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function deliverySettingsGet($code)
|
||||
public function integrationModulesGet($code)
|
||||
{
|
||||
if (empty($code)) {
|
||||
throw new \InvalidArgumentException('Parameter `code` must be set');
|
||||
throw new \InvalidArgumentException(
|
||||
'Parameter `code` must be set'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
"/delivery/generic/setting/$code",
|
||||
sprintf('/integration-modules/%s', $code),
|
||||
Client::METHOD_GET
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit delivery configuration
|
||||
* Edit module configuration
|
||||
*
|
||||
* @param array $configuration
|
||||
*
|
||||
@ -1519,7 +1494,7 @@ class ApiClient
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function deliverySettingsEdit(array $configuration)
|
||||
public function integrationModulesEdit(array $configuration)
|
||||
{
|
||||
if (!count($configuration) || empty($configuration['code'])) {
|
||||
throw new \InvalidArgumentException(
|
||||
@ -1528,9 +1503,9 @@ class ApiClient
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
sprintf('/delivery/generic/setting/%s/edit', $configuration['code']),
|
||||
sprintf('/integration-modules/%s/edit', $configuration['code']),
|
||||
Client::METHOD_POST,
|
||||
array('configuration' => json_encode($configuration))
|
||||
array('integrationModule' => json_encode($configuration))
|
||||
);
|
||||
}
|
||||
|
||||
@ -2116,134 +2091,6 @@ class ApiClient
|
||||
array('priceType' => json_encode($data))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get telephony settings
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @throws \RetailCrm\Exception\InvalidJsonException
|
||||
* @throws \RetailCrm\Exception\CurlException
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function telephonySettingsGet($code)
|
||||
{
|
||||
if (empty($code)) {
|
||||
throw new \InvalidArgumentException('Parameter `code` must be set');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
"/telephony/setting/$code",
|
||||
Client::METHOD_GET
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit telephony settings
|
||||
*
|
||||
* @param string $code symbolic code
|
||||
* @param string $clientId client id
|
||||
* @param boolean $active telephony activity
|
||||
* @param mixed $name service name
|
||||
* @param mixed $makeCallUrl service init url
|
||||
* @param mixed $image service logo url(svg file)
|
||||
*
|
||||
* @param array $additionalCodes
|
||||
* @param array $externalPhones
|
||||
* @param bool $allowEdit
|
||||
* @param bool $inputEventSupported
|
||||
* @param bool $outputEventSupported
|
||||
* @param bool $hangupEventSupported
|
||||
* @param bool $changeUserStatusUrl
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function telephonySettingsEdit(
|
||||
$code,
|
||||
$clientId,
|
||||
$active = false,
|
||||
$name = false,
|
||||
$makeCallUrl = false,
|
||||
$image = false,
|
||||
$additionalCodes = array(),
|
||||
$externalPhones = array(),
|
||||
$allowEdit = false,
|
||||
$inputEventSupported = false,
|
||||
$outputEventSupported = false,
|
||||
$hangupEventSupported = false,
|
||||
$changeUserStatusUrl = false
|
||||
)
|
||||
{
|
||||
if (!isset($code)) {
|
||||
throw new \InvalidArgumentException('Code must be set');
|
||||
}
|
||||
|
||||
$parameters['code'] = $code;
|
||||
|
||||
if (!isset($clientId)) {
|
||||
throw new \InvalidArgumentException('client id must be set');
|
||||
}
|
||||
|
||||
$parameters['clientId'] = $clientId;
|
||||
|
||||
if (!isset($active)) {
|
||||
$parameters['active'] = false;
|
||||
} else {
|
||||
$parameters['active'] = $active;
|
||||
}
|
||||
|
||||
if (!isset($name)) {
|
||||
throw new \InvalidArgumentException('name must be set');
|
||||
}
|
||||
|
||||
if (isset($name)) {
|
||||
$parameters['name'] = $name;
|
||||
}
|
||||
|
||||
if (isset($makeCallUrl)) {
|
||||
$parameters['makeCallUrl'] = $makeCallUrl;
|
||||
}
|
||||
|
||||
if (isset($image)) {
|
||||
$parameters['image'] = $image;
|
||||
}
|
||||
|
||||
if (isset($additionalCodes)) {
|
||||
$parameters['additionalCodes'] = $additionalCodes;
|
||||
}
|
||||
|
||||
if (isset($externalPhones)) {
|
||||
$parameters['externalPhones'] = $externalPhones;
|
||||
}
|
||||
|
||||
if (isset($allowEdit)) {
|
||||
$parameters['allowEdit'] = $allowEdit;
|
||||
}
|
||||
|
||||
if (isset($inputEventSupported)) {
|
||||
$parameters['inputEventSupported'] = $inputEventSupported;
|
||||
}
|
||||
|
||||
if (isset($outputEventSupported)) {
|
||||
$parameters['outputEventSupported'] = $outputEventSupported;
|
||||
}
|
||||
|
||||
if (isset($hangupEventSupported)) {
|
||||
$parameters['hangupEventSupported'] = $hangupEventSupported;
|
||||
}
|
||||
|
||||
if (isset($changeUserStatusUrl)) {
|
||||
$parameters['changeUserStatusUrl'] = $changeUserStatusUrl;
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
"/telephony/setting/$code/edit",
|
||||
Client::METHOD_POST,
|
||||
array('configuration' => json_encode($parameters))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call event
|
||||
|
@ -264,13 +264,17 @@ class RCrmActions
|
||||
|
||||
/**
|
||||
* Unserialize array
|
||||
*
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function unserializeArrayRecursive($string)
|
||||
{
|
||||
if ($string === false || empty($string)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_string($string)) {
|
||||
$string = unserialize($string);
|
||||
}
|
||||
@ -348,7 +352,7 @@ class RCrmActions
|
||||
}
|
||||
}
|
||||
|
||||
private function proxy($api, $methodApi, $method, $params) {
|
||||
private static function proxy($api, $methodApi, $method, $params) {
|
||||
$log = new Logger();
|
||||
$version = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_VERSION, 0);
|
||||
try {
|
||||
@ -428,12 +432,28 @@ class RCrmActions
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (\RetailCrm\Exception\InvalidJsonException $e) {
|
||||
self::eventLog(
|
||||
__CLASS__ . '::' . $method, 'RetailCrm\ApiClient::' . $methodApi . '::InvalidJsonException',
|
||||
$e->getCode() . ': ' . $e->getMessage()
|
||||
);
|
||||
$log->write(array(
|
||||
'api' => $version,
|
||||
'methodApi' => $methodApi,
|
||||
'errorMsg' => $e->getMessage(),
|
||||
'errors' => $e->getCode(),
|
||||
'params' => $params
|
||||
), 'apiErrors');
|
||||
|
||||
if (function_exists('retailCrmApiResult')) {
|
||||
retailCrmApiResult($methodApi, false, 'ArgumentException');
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists('retailCrmApiResult')) {
|
||||
retailCrmApiResult($methodApi, true, $result->getStatusCode());
|
||||
}
|
||||
|
||||
return $result;
|
||||
return isset($result) ? $result : false;
|
||||
}
|
||||
}
|
||||
|
@ -619,7 +619,7 @@ class RetailCrmHistory
|
||||
|
||||
$fUserId = $basket->getFUserId(true);
|
||||
|
||||
if ($fUserId === null) {
|
||||
if (!$fUserId) {
|
||||
$fUserId = Bitrix\Sale\Fuser::getIdByUserId($order['customer']['externalId']);
|
||||
$basket->setFUserId($fUserId);
|
||||
}
|
||||
@ -671,12 +671,20 @@ class RetailCrmHistory
|
||||
|
||||
if (array_key_exists('discountTotal', $product)) {
|
||||
$itemCost = $item->getField('BASE_PRICE');
|
||||
$discount = (double) $item->getField('DISCOUNT_PRICE');
|
||||
|
||||
if (isset($itemCost) && $itemCost >= 0) {
|
||||
if ($discount < 0) {
|
||||
$resultDiscount = $product['discountTotal'] + $discount;
|
||||
} else {
|
||||
$resultDiscount = $product['discountTotal'];
|
||||
}
|
||||
|
||||
$item->setField('CUSTOM_PRICE', 'Y');
|
||||
$item->setField('PRICE', $itemCost - $product['discountTotal']);
|
||||
$item->setField('DISCOUNT_PRICE', $product['discountTotal']);
|
||||
$item->setField('DISCOUNT_NAME', '');
|
||||
$item->setField('DISCOUNT_VALUE', '');
|
||||
$item->setField('DISCOUNT_PRICE', $product['discountTotal'] + $resultDiscount);
|
||||
$item->setField('PRICE', $itemCost - $resultDiscount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -774,7 +782,7 @@ class RetailCrmHistory
|
||||
retailCrmAfterOrderSave($order);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unset($newOrder);
|
||||
}
|
||||
|
||||
|
@ -404,7 +404,6 @@ class RetailCrmICML
|
||||
|
||||
while ($offer = $dbResOffers->GetNext()) {
|
||||
// Link offers to products
|
||||
$offer['PICTURE'] = $this->protocol . $this->serverName . CFile::GetPath($offer["DETAIL_PICTURE"]);
|
||||
$products[$offer['PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'] . '_VALUE']]['offers'][$offer['ID']] = $offer;
|
||||
}
|
||||
unset($offer, $dbResOffers);
|
||||
@ -459,7 +458,13 @@ class RetailCrmICML
|
||||
$offer['BARCODE'] = isset($barcodes[$offer['ID']]) ? $barcodes[$offer['ID']] : '';
|
||||
$offer['PRODUCT_ID'] = $product["ID"];
|
||||
$offer['DETAIL_PAGE_URL'] = $product["DETAIL_PAGE_URL"];
|
||||
$offer['PICTURE'] = $offer["PICTURE"] ? $offer["PICTURE"] : $product["PICTURE"];
|
||||
|
||||
if (CFile::GetPath($offer["DETAIL_PICTURE"])) {
|
||||
$offer['PICTURE'] = $this->protocol . $this->serverName . CFile::GetPath($offer["DETAIL_PICTURE"]);
|
||||
} else {
|
||||
$offer['PICTURE'] = $product["PICTURE"];
|
||||
}
|
||||
|
||||
$offer['PRODUCT_NAME'] = $product["NAME"];
|
||||
$offer['PRODUCT_ACTIVE'] = $product["ACTIVE"];
|
||||
$offer['PRICE'] = $offer['CATALOG_PRICE_' . $basePriceId];
|
||||
|
@ -148,18 +148,31 @@ class RetailCrmOrder
|
||||
if (is_null($pp['PURCHASING_PRICE']) == false) {
|
||||
$item['purchasePrice'] = $pp['PURCHASING_PRICE'];
|
||||
}
|
||||
$item['discountManualAmount'] = (double) $product['DISCOUNT_PRICE'];
|
||||
|
||||
$discount = (double) $product['DISCOUNT_PRICE'];
|
||||
|
||||
if ($discount < 0) {
|
||||
$item['discountManualAmount'] = 0;
|
||||
$initialPrice = (double) $product['PRICE'];
|
||||
} else {
|
||||
$item['discountManualAmount'] = (double) $product['DISCOUNT_PRICE'];
|
||||
$initialPrice = (double) $product['PRICE'] + (double) $product['DISCOUNT_PRICE'];
|
||||
}
|
||||
|
||||
$item['discountManualPercent'] = 0;
|
||||
$item['initialPrice'] = (double) $product['PRICE'] + (double) $product['DISCOUNT_PRICE'];
|
||||
$item['initialPrice'] = $initialPrice;
|
||||
|
||||
$order['items'][] = $item;
|
||||
|
||||
if ($send && $dimensions == 'Y') {
|
||||
$dimensions = RCrmActions::unserializeArrayRecursive($product['DIMENSIONS']);
|
||||
$width += $dimensions['WIDTH'];
|
||||
$height += $dimensions['HEIGHT'];
|
||||
$length += $dimensions['LENGTH'];
|
||||
$weight += $product['WEIGHT'];
|
||||
|
||||
if ($dimensions !== false) {
|
||||
$width += $dimensions['WIDTH'];
|
||||
$height += $dimensions['HEIGHT'];
|
||||
$length += $dimensions['LENGTH'];
|
||||
$weight += $product['WEIGHT'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
- Добавлена выгрузка штрихкодов в ICML
|
||||
- Добавлена выгрузка картинок торговых предложений в ICML
|
||||
- Улучшена передача типа доставки в заказе
|
||||
- Добавлена проверка некоторых настроек при передаче заказа
|
||||
- Добавлен рассчет стоимости товара с учетом наценки
|
||||
- Добавлена выгрузка картинок товара, если отсутствует картинка торгового предложения
|
||||
- Заменены устаревшие методы в API клиенте
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?
|
||||
$arModuleVersion = array(
|
||||
"VERSION" => "2.3.7",
|
||||
"VERSION_DATE" => "2018-06-13 13:15:00"
|
||||
"VERSION" => "2.3.8",
|
||||
"VERSION_DATE" => "2018-07-16 16:00:00"
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user