Skip to content

Commit

Permalink
Исправление присваивания номера заказа к платежу при синхронизации с …
Browse files Browse the repository at this point in the history
…CRM (#343)
  • Loading branch information
Kocmonavtik authored Apr 3, 2024
1 parent 7f69ebf commit cbddd69
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2024-04-03 v.6.5.13
- Исправление присваивания номера заказа к платежу при синхронизации с CRM

## 2024-03-28 v.6.5.12
- Исправлена подстановка домена при генерации каталога

Expand Down
16 changes: 11 additions & 5 deletions intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,12 @@ public static function orderHistory(): bool
}
}

self::orderSave($newOrder);

if ($optionsOrderNumbers === 'Y' && isset($order['number'])) {
$newOrder->setField('ACCOUNT_NUMBER', $order['number']);
}

$orderSumm = 0;

foreach ($basket as $item) {
Expand All @@ -1268,6 +1274,7 @@ public static function orderHistory(): bool
if (!isset($orderCrm)) {
$orderCrm = RCrmActions::apiMethod($api, 'orderGet', __METHOD__, $order['id']);
}

if ($orderCrm) {
self::paymentsUpdate($newOrder, $orderCrm['order'], $newHistoryPayments);
}
Expand Down Expand Up @@ -1344,11 +1351,6 @@ public static function orderHistory(): bool

self::orderSave($newOrder);

if ($optionsOrderNumbers === 'Y' && isset($order['number'])) {
$newOrder->setField('ACCOUNT_NUMBER', $order['number']);
self::orderSave($newOrder);
}

//items loyalty info to HL
if (!empty($editBasketInfo)) {
$newBasket = $newOrder->getBasket();
Expand Down Expand Up @@ -1989,10 +1991,12 @@ public static function paymentsUpdate($order, $paymentsCrm, &$newHistoryPayments
//update data
if ($nowPayment instanceof Payment) {
$nowPayment->setField('SUM', $paymentCrm['amount']);

if ($optionsPayTypes[$paymentCrm['type']] != $nowPayment->getField('PAY_SYSTEM_ID')) {
$nowPayment->setField('PAY_SYSTEM_ID', $optionsPayTypes[$paymentCrm['type']]);
$nowPayment->setField('PAY_SYSTEM_NAME', $arPaySysmems[$optionsPayTypes[$paymentCrm['type']]]);
}

if (isset($optionsPayment[$paymentCrm['status']])) {
$nowPayment->setField('PAID', $optionsPayment[$paymentCrm['status']]);
}
Expand All @@ -2012,6 +2016,7 @@ public static function paymentsUpdate($order, $paymentsCrm, &$newHistoryPayments
$newPayment->setField('EXTERNAL_PAYMENT', 'N');
$newPayment->setField('UPDATED_1C', 'N');
$newPayment->setField('XML_ID', $paymentCrm['id']);
$newPayment->setField('ACCOUNT_NUMBER', $order->getField('ACCOUNT_NUMBER'));

$newPaymentId = $newPayment->getId();

Expand All @@ -2024,6 +2029,7 @@ public static function paymentsUpdate($order, $paymentsCrm, &$newHistoryPayments
$paySumm += $paymentCrm['amount'];
}
}

foreach ($paymentsList as $payment) {
if ($payment->isPaid()) {
$payment->setPaid("N");
Expand Down
2 changes: 1 addition & 1 deletion intaro.retailcrm/description.ru
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Исправлена подстановка домена при генерации каталога
- Исправление присваивания номера заказа к платежу при синхронизации с CRM
4 changes: 2 additions & 2 deletions intaro.retailcrm/install/version.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

$arModuleVersion = [
'VERSION' => '6.5.12',
'VERSION_DATE' => '2024-03-28 17:00:00'
'VERSION' => '6.5.13',
'VERSION_DATE' => '2024-04-03 10:30:00'
];

0 comments on commit cbddd69

Please sign in to comment.