1
0
mirror of synced 2024-11-25 14:56:09 +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', '');
@ -1258,4 +1258,4 @@ class RetailUser extends CUser
}
}
}
}
}

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,7 +743,9 @@ class RetailCrmHistory
RCrmActions::apiMethod($api, 'paymentEditById', __METHOD__, $newHistoryPayments[$orderPayment->getField('XML_ID')]);
}
\Bitrix\Sale\Internals\PaymentTable::update($paymentExternalId, array('XML_ID' => ''));
if (!is_null($paymentExternalId)) {
\Bitrix\Sale\Internals\PaymentTable::update($paymentExternalId, array('XML_ID' => ''));
}
}
}
}
@ -1240,4 +1242,4 @@ class RetailUser extends CUser
}
}
}
}
}