1
0
mirror of synced 2024-11-22 05:16:09 +03:00

fixed RetailCrmHistory_v5

This commit is contained in:
Frosin 2019-09-10 13:23:51 +03:00
parent 7fe717b76a
commit 36bed88ef3

View File

@ -769,7 +769,10 @@ class RetailCrmHistory
if (array_key_exists($orderPayment->getField('XML_ID'), $newHistoryPayments)) { if (array_key_exists($orderPayment->getField('XML_ID'), $newHistoryPayments)) {
$paymentId = $orderPayment->getId(); $paymentId = $orderPayment->getId();
$paymentExternalId = RCrmActions::generatePaymentExternalId($paymentId); $paymentExternalId = RCrmActions::generatePaymentExternalId($paymentId);
if (is_null($paymentId)) {
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'paymentsUpdate', 'Save payment error, order=' . $order['number']);
continue;
}
if ($paymentExternalId) { if ($paymentExternalId) {
$newHistoryPayments[$orderPayment->getField('XML_ID')]['externalId'] = $paymentExternalId; $newHistoryPayments[$orderPayment->getField('XML_ID')]['externalId'] = $paymentExternalId;
RCrmActions::apiMethod($api, 'paymentEditById', __METHOD__, $newHistoryPayments[$orderPayment->getField('XML_ID')]); RCrmActions::apiMethod($api, 'paymentEditById', __METHOD__, $newHistoryPayments[$orderPayment->getField('XML_ID')]);
@ -1161,7 +1164,7 @@ class RetailCrmHistory
unset($paymentsList[$nowPaymentId]); unset($paymentsList[$nowPaymentId]);
} }
} else { } elseif (array_key_exists($paymentCrm['type'], $optionsPayTypes)) {
$newHistoryPayments[$paymentCrm['id']] = $paymentCrm; $newHistoryPayments[$paymentCrm['id']] = $paymentCrm;
$newPayment = $paymentColl->createItem(); $newPayment = $paymentColl->createItem();
$newPayment->setField('SUM', $paymentCrm['amount']); $newPayment->setField('SUM', $paymentCrm['amount']);
@ -1178,7 +1181,9 @@ class RetailCrmHistory
$newPaymentId = $newPayment->getId(); $newPaymentId = $newPayment->getId();
unset($paymentsList[$newPaymentId]); unset($paymentsList[$newPaymentId]);
} } else {
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'paymentsUpdate', 'Save payment error, incorrect type: ' . $paymentCrm['type']);
}
if ($optionsPayment[$paymentCrm['status']] == 'Y') { if ($optionsPayment[$paymentCrm['status']] == 'Y') {
$paySumm += $paymentCrm['amount']; $paySumm += $paymentCrm['amount'];