From cbddd69001011c7781c4109b062e4cadefc36522 Mon Sep 17 00:00:00 2001 From: Kocmonavtik <61938582+Kocmonavtik@users.noreply.github.com> Date: Wed, 3 Apr 2024 10:59:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B8=D1=81=D0=B2=D0=B0?= =?UTF-8?q?=D0=B8=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=BE=D0=BC=D0=B5?= =?UTF-8?q?=D1=80=D0=B0=20=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D0=B0=20=D0=BA=20?= =?UTF-8?q?=D0=BF=D0=BB=D0=B0=D1=82=D0=B5=D0=B6=D1=83=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=20=D1=81=D0=B8=D0=BD=D1=85=D1=80=D0=BE=D0=BD=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D1=81=20CRM=20(#343)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ .../general/history/RetailCrmHistory_v5.php | 16 +++++++++++----- intaro.retailcrm/description.ru | 2 +- intaro.retailcrm/install/version.php | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1184ecd1..69c8359c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2024-04-03 v.6.5.13 +- Исправление присваивания номера заказа к платежу при синхронизации с CRM + ## 2024-03-28 v.6.5.12 - Исправлена подстановка домена при генерации каталога diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php index 805d5963..feb7c056 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php @@ -1245,6 +1245,12 @@ class RetailCrmHistory } } + self::orderSave($newOrder); + + if ($optionsOrderNumbers === 'Y' && isset($order['number'])) { + $newOrder->setField('ACCOUNT_NUMBER', $order['number']); + } + $orderSumm = 0; foreach ($basket as $item) { @@ -1268,6 +1274,7 @@ class RetailCrmHistory if (!isset($orderCrm)) { $orderCrm = RCrmActions::apiMethod($api, 'orderGet', __METHOD__, $order['id']); } + if ($orderCrm) { self::paymentsUpdate($newOrder, $orderCrm['order'], $newHistoryPayments); } @@ -1344,11 +1351,6 @@ class RetailCrmHistory 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(); @@ -1989,10 +1991,12 @@ class RetailCrmHistory //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']]); } @@ -2012,6 +2016,7 @@ class RetailCrmHistory $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(); @@ -2024,6 +2029,7 @@ class RetailCrmHistory $paySumm += $paymentCrm['amount']; } } + foreach ($paymentsList as $payment) { if ($payment->isPaid()) { $payment->setPaid("N"); diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index e880878d..532fc4c2 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1 +1 @@ -- Исправлена подстановка домена при генерации каталога +- Исправление присваивания номера заказа к платежу при синхронизации с CRM diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index 33e20df8..d716fcc7 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ '6.5.12', - 'VERSION_DATE' => '2024-03-28 17:00:00' + 'VERSION' => '6.5.13', + 'VERSION_DATE' => '2024-04-03 10:30:00' ];