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 @@ 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) { @@ -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); } @@ -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(); @@ -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']]); } @@ -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(); @@ -2024,6 +2029,7 @@ public static function paymentsUpdate($order, $paymentsCrm, &$newHistoryPayments $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' ];