1
0
mirror of synced 2024-11-22 05:16:09 +03:00
* Add PRICE_DELIVERY for history exchange
* Fix bug with LocationTable fqn
* Fix bug with ProductType
* Changed options for prices and corps
* CustomersUpload: finding uniq clients by externalId
* Restore shipment before deleting

Co-authored-by: Sergey Chazov <oitv18@gmail.com>
This commit is contained in:
Alex Lushpai 2022-02-04 15:16:14 +03:00 committed by GitHub
parent a1d6e00d18
commit e3e0d41ff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 82 additions and 60 deletions

View File

@ -1,3 +1,12 @@
## 2022-02-03 v.5.8.5
* Исправление ошибка восстановления отсутствующей отгрузки во время выгрузки истории из системы
* Исправлена ошибка обработки магазинов с кодами, содержащими ".", в настройках модуля
* Исправлен баг выгрузки заказов, связанный с неверным указанием namespace для LocationTable
* При обмене данными итоговая стоимость доставки теперь указывается принудительно
* Исправлена ошибка генерации icml для проиндексированных каталогов с простыми товарами
* Исправлена ошибка выгрузки клиентов, при которой одни и те же клиенты могли попасть в лист выгрузки повторно
* Исправления в документации
## 2021-10-15 v.5.8.4
* Исправление некорректной генерации каталога при повторных запусках генерации

View File

@ -6,7 +6,7 @@
Bitrix module
=============
Bitrix module for interaction with [RetailCRM](http://www.retailcrm.ru)
Bitrix module for interaction with [RetailCRM](https://www.retailcrm.ru)
Module allows:
@ -19,4 +19,4 @@ Installation
You should install module through [Bitrix.Marketplace](http://marketplace.1c-bitrix.ru/solutions/intaro.retailcrm/).
[Setup guide](https://docs.retailcrm.ru/ru/Users/Integration/SiteModules/1CBitrix)
[Setup guide](https://docs.retailcrm.ru/Users/Integration/SiteModules/1CBitrix)

View File

@ -1623,24 +1623,28 @@ class RetailCrmHistory
$shipmentColl = $order->getShipmentCollection();
if ($delivery) {
if (!$update) {
//В коллекции всегда есть одна скрытая системная доставка, к которой относятся нераспределенные товары
//Поэтому, если есть только системная доставка, то нужно создать новую
if (!$update || $shipmentColl->count() === 1) {
$shipment = $shipmentColl->createItem($delivery);
$shipment->setFields(array(
'BASE_PRICE_DELIVERY' => $orderCrm['delivery']['cost'],
'CURRENCY' => $order->getCurrency(),
'DELIVERY_NAME' => $delivery->getName(),
$shipment->setFields([
'BASE_PRICE_DELIVERY' => $orderCrm['delivery']['cost'],
'PRICE_DELIVERY' => $orderCrm['delivery']['cost'],
'CURRENCY' => $order->getCurrency(),
'DELIVERY_NAME' => $delivery->getName(),
'CUSTOM_PRICE_DELIVERY' => 'Y'
));
]);
} else {
foreach ($shipmentColl as $shipment) {
if (!$shipment->isSystem()) {
$shipment->setFields(array(
'BASE_PRICE_DELIVERY' => $orderCrm['delivery']['cost'],
'CURRENCY' => $order->getCurrency(),
'DELIVERY_ID' => $deliveryId,
'DELIVERY_NAME' => $delivery->getName(),
$shipment->setFields([
'BASE_PRICE_DELIVERY' => $orderCrm['delivery']['cost'],
'PRICE_DELIVERY' => $orderCrm['delivery']['cost'],
'CURRENCY' => $order->getCurrency(),
'DELIVERY_ID' => $deliveryId,
'DELIVERY_NAME' => $delivery->getName(),
'CUSTOM_PRICE_DELIVERY' => 'Y'
));
]);
}
}
}

View File

@ -11,6 +11,7 @@ use Bitrix\Sale\Order;
use RetailCrm\ApiClient;
use Intaro\RetailCrm\Service\ManagerService;
use RetailCrm\Response\ApiResponse;
use \Bitrix\Sale\Location\Name\LocationTable as LocationTableName;
IncludeModuleLangFile(__FILE__);
@ -135,12 +136,12 @@ class RetailCrmOrder
}
}
$location = LocationTable::getList([
$location = LocationTableName::getList([
'filter' => ['=LOCATION_ID' => $arLoc['CITY_ID'], 'LANGUAGE_ID' => 'ru']
])->fetch();
if (count($countrys) > 0) {
$countryOrder = LocationTable::getList([
$countryOrder = LocationTableName::getList([
'filter' => ['=LOCATION_ID' => $arLoc['COUNTRY_ID'], 'LANGUAGE_ID' => 'ru']
])->fetch();
if(isset($countrys[$countryOrder['NAME']])){
@ -457,14 +458,14 @@ class RetailCrmOrder
$resCustomersCorporate[$arCustomerCorporate['nickName']] = $arCustomerCorporate;
}
$email = $arCustomer['email'] ?? '';
if (!in_array($email, $resCustomersAdded)) {
$resCustomersAdded[] = $email;
if (
array_key_exists('externalId', $arCustomer)
&& !in_array($arCustomer['externalId'], $resCustomersAdded, true)
) {
$resCustomersAdded[] = $arCustomer['externalId'];
$resCustomers[$order['LID']][] = $arCustomer;
}
$resCustomers[$order['LID']][] = $arCustomer;
$ordersPack[$order['LID']][] = $arOrders;
$recOrders[] = $orderId;
}

View File

@ -1 +1 @@
- Исправление некорректной генерации каталога при повторных запусках генерации
- Исправления ошибок в выгрузке заказов и генерации каталога

View File

@ -1,6 +1,6 @@
<?php
$arModuleVersion = [
'VERSION' => '5.8.4',
'VERSION_DATE' => '2021-10-15 12:00:00',
'VERSION' => '5.8.5',
'VERSION_DATE' => '2022-02-03 12:00:00',
];

View File

@ -251,7 +251,7 @@ class IcmlDirector
do {
//Если каталог проиндексирован, у товара есть Тип и это простой товар, то просто записываем его
if ($product->productType = ProductTable::TYPE_PRODUCT) {
if ($product->productType === ProductTable::TYPE_PRODUCT) {
$this->icmlWriter->writeOffers([$product]);
break;
}

View File

@ -225,7 +225,7 @@ class XmlOfferBuilder
{
$this->xmlOffer->id = $item['ID'];
$this->xmlOffer->productId = $item['ID'];
$this->xmlOffer->productType = $item['CATALOG_TYPE'];
$this->xmlOffer->productType = (int) $item['CATALOG_TYPE'];
$this->xmlOffer->quantity = $item['CATALOG_QUANTITY'] ?? '';
$this->xmlOffer->url = $item['DETAIL_PAGE_URL']
? $this->defaultServerName . $item['DETAIL_PAGE_URL']

View File

@ -125,7 +125,7 @@ class XmlOffer
* \Bitrix\Catalog\ProductTable::TYPE_SKU товар с торговыми предложениями
* \Bitrix\Catalog\ProductTable::TYPE_OFFER торговое предложение
*
* @var mixed
* @var int
*/
public $productType;

View File

@ -414,8 +414,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
function maskPrice($var){
return preg_match("/^shops-price/", $var);
}
$bitrixPriceShopsArr = str_replace('shops-price-', '', array_filter(array_keys($_POST), 'maskPrice'));
$bitrixPriceShopsArr = array_values(array_filter($_POST, 'maskPrice', ARRAY_FILTER_USE_KEY));
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
foreach($arResult['bitrixIblocksExportList'] as $bitrixIblocks){
if(htmlspecialchars(trim($_POST['iblocks-prices-' . $bitrixIblocks['ID']])) === 'Y'){
@ -486,10 +486,12 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$cc = 'Y';
$bitrixCorpName = htmlspecialchars(trim($_POST['nickName-corporate']));
$bitrixCorpAdres = htmlspecialchars(trim($_POST['adres-corporate']));
function maskCorp($var) {
return preg_match("/^shops-corporate/", $var);
}
$bitrixCorpShopsArr = str_replace('shops-corporate-', '', array_filter(array_keys($_POST), 'maskCorp'));
$bitrixCorpShopsArr = array_values(array_filter($_POST, 'maskCorp', ARRAY_FILTER_USE_KEY));
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmCc", "add");
} else {
@ -1394,7 +1396,10 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<?php foreach ($arResult['sitesList'] as $sitesList): ?>
<tr class="prices" align="center" <?php if($optionPricesUpload !== 'Y') echo 'style="display: none;"'; ?>>
<td colspan="2" class="option-other-center">
<label><input class="addr" type="checkbox" name="shops-price-<?echo $sitesList['code'];?>" value="Y" <?php if(in_array($sitesList['code'], $optionPriceShops)) echo "checked"; ?>> <?php echo $sitesList['name'].' ('.$sitesList['code'].')'; ?></label>
<label><input class="addr" type="checkbox" name="shops-price-<? echo $sitesList['code']; ?>" value="<? echo $sitesList['code']; ?>" <?php if (in_array($sitesList['code'], $optionPriceShops)) {
echo "checked";
} ?>> <?php echo $sitesList['name'] . ' (' . $sitesList['code'] . ')'; ?>
</label>
</td>
</tr>
<?php endforeach;?>
@ -1541,7 +1546,10 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<td width="50%" class="" name="<?php ?>" align="center">
<?php foreach ($arResult['sitesList'] as $sitesList): ?>
<td colspan="2" class="option-other-center">
<label><input class="addr" type="checkbox" name="shops-corporate-<?echo $sitesList['code'];?>" value="Y" <?php if(in_array($sitesList['code'], $optionCorpShops)) echo "checked"; ?>> <?php echo $sitesList['name'].' ('.$sitesList['code'].')'; ?></label>
<label><input class="addr" type="checkbox" name="shops-corporate-<? echo $sitesList['code']; ?>" value="<? echo $sitesList['code']; ?>" <?php if (in_array($sitesList['code'], $optionCorpShops)) {
echo "checked";
} ?>> <?php echo $sitesList['name'] . ' (' . $sitesList['code'] . ')'; ?>
</label>
</td>
<?php endforeach;?>
</td>