From 12ae53cfea4b2d490869c020ec812f506af4c8b5 Mon Sep 17 00:00:00 2001 From: gorokh Date: Wed, 13 Jan 2021 17:51:36 +0300 Subject: [PATCH] fixed #168 --- .../general/history/RetailCrmHistory_v5.php | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php index f291b92a..234eac90 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php @@ -1178,20 +1178,16 @@ class RetailCrmHistory continue; } - $paymentExternalId = $orderPayment->getId(); + $newHistoryPayments[$orderPayment->getField('XML_ID')]['externalId'] = $paymentExternalId; + RCrmActions::apiMethod( + $api, + 'paymentEditById', + __METHOD__, + $newHistoryPayments[$orderPayment->getField('XML_ID')] + ); - if ($paymentExternalId) { - $newHistoryPayments[$orderPayment->getField('XML_ID')]['externalId'] = $paymentExternalId; - RCrmActions::apiMethod( - $api, - 'paymentEditById', - __METHOD__, - $newHistoryPayments[$orderPayment->getField('XML_ID')] - ); - - if ($paymentId) { - \Bitrix\Sale\Internals\PaymentTable::update($paymentId, array('XML_ID' => '')); - } + if ($paymentId) { + \Bitrix\Sale\Internals\PaymentTable::update($paymentId, array('XML_ID' => '')); } } }