diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php index 1e5f6def..b397592d 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php @@ -1141,7 +1141,8 @@ class RetailCrmHistory foreach ($paymentsCrm['payments'] as $paymentCrm) { if (isset($paymentCrm['externalId']) && !empty($paymentCrm['externalId'])) { //find the payment - $nowPayment = $paymentsList[RCrmActions::getFromPaymentExternalId($paymentCrm['externalId'])]; + $nowPaymentId = RCrmActions::getFromPaymentExternalId($paymentCrm['externalId']); + $nowPayment = $paymentsList[$nowPaymentId]; //update data if ($nowPayment instanceof \Bitrix\Sale\Payment) { $nowPayment->setField('SUM', $paymentCrm['amount']); @@ -1153,7 +1154,7 @@ class RetailCrmHistory $nowPayment->setField('PAID', $optionsPayment[$paymentCrm['status']]); } - unset($paymentsList[$paymentCrm['externalId']]); + unset($paymentsList[$nowPaymentId]); } } else { $newHistoryPayments[$paymentCrm['id']] = $paymentCrm;