1
0
mirror of synced 2024-11-29 00:36:07 +03:00

Fix a bug with 100% discount and null payment (#37)

This commit is contained in:
Dmitry Mamontov 2018-01-23 10:20:53 +03:00 committed by Alex Lushpai
parent 02e6beb385
commit cf41e3dc20
2 changed files with 7 additions and 5 deletions

View File

@ -645,7 +645,7 @@ class RetailCrmHistory
}
}
if (isset($itemCost) && $itemCost > 0) {
if (isset($itemCost) && $itemCost >= 0) {
$item->setField('CUSTOM_PRICE', 'Y');
$item->setField('PRICE', $itemCost);
$item->setField('DISCOUNT_NAME', '');

View File

@ -672,7 +672,7 @@ class RetailCrmHistory
if (array_key_exists('discountTotal', $product)) {
$itemCost = $item->getField('BASE_PRICE');
if (isset($itemCost) && $itemCost > 0) {
if (isset($itemCost) && $itemCost >= 0) {
$item->setField('CUSTOM_PRICE', 'Y');
$item->setField('PRICE', $itemCost - $product['discountTotal']);
$item->setField('DISCOUNT_PRICE', $product['discountTotal']);
@ -743,10 +743,12 @@ class RetailCrmHistory
RCrmActions::apiMethod($api, 'paymentEditById', __METHOD__, $newHistoryPayments[$orderPayment->getField('XML_ID')]);
}
if (!is_null($paymentExternalId)) {
\Bitrix\Sale\Internals\PaymentTable::update($paymentExternalId, array('XML_ID' => ''));
}
}
}
}
if (!$order['externalId']) {
if(RCrmActions::apiMethod($api, 'ordersFixExternalIds', __METHOD__, array(array('id' => $order['id'], 'externalId' => $newOrder->getId()))) == false){