fix: don't remove payments after changes in retailCRM
This commit is contained in:
parent
366e3e2b1d
commit
5eb64d9c84
@ -1141,7 +1141,8 @@ class RetailCrmHistory
|
|||||||
foreach ($paymentsCrm['payments'] as $paymentCrm) {
|
foreach ($paymentsCrm['payments'] as $paymentCrm) {
|
||||||
if (isset($paymentCrm['externalId']) && !empty($paymentCrm['externalId'])) {
|
if (isset($paymentCrm['externalId']) && !empty($paymentCrm['externalId'])) {
|
||||||
//find the payment
|
//find the payment
|
||||||
$nowPayment = $paymentsList[RCrmActions::getFromPaymentExternalId($paymentCrm['externalId'])];
|
$nowPaymentId = RCrmActions::getFromPaymentExternalId($paymentCrm['externalId']);
|
||||||
|
$nowPayment = $paymentsList[$nowPaymentId];
|
||||||
//update data
|
//update data
|
||||||
if ($nowPayment instanceof \Bitrix\Sale\Payment) {
|
if ($nowPayment instanceof \Bitrix\Sale\Payment) {
|
||||||
$nowPayment->setField('SUM', $paymentCrm['amount']);
|
$nowPayment->setField('SUM', $paymentCrm['amount']);
|
||||||
@ -1153,7 +1154,7 @@ class RetailCrmHistory
|
|||||||
$nowPayment->setField('PAID', $optionsPayment[$paymentCrm['status']]);
|
$nowPayment->setField('PAID', $optionsPayment[$paymentCrm['status']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($paymentsList[$paymentCrm['externalId']]);
|
unset($paymentsList[$nowPaymentId]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$newHistoryPayments[$paymentCrm['id']] = $paymentCrm;
|
$newHistoryPayments[$paymentCrm['id']] = $paymentCrm;
|
||||||
|
Loading…
Reference in New Issue
Block a user