Fix a bug with 100% discount and null payment (#37)
This commit is contained in:
parent
02e6beb385
commit
cf41e3dc20
@ -645,7 +645,7 @@ class RetailCrmHistory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($itemCost) && $itemCost > 0) {
|
if (isset($itemCost) && $itemCost >= 0) {
|
||||||
$item->setField('CUSTOM_PRICE', 'Y');
|
$item->setField('CUSTOM_PRICE', 'Y');
|
||||||
$item->setField('PRICE', $itemCost);
|
$item->setField('PRICE', $itemCost);
|
||||||
$item->setField('DISCOUNT_NAME', '');
|
$item->setField('DISCOUNT_NAME', '');
|
||||||
|
@ -672,7 +672,7 @@ class RetailCrmHistory
|
|||||||
|
|
||||||
if (array_key_exists('discountTotal', $product)) {
|
if (array_key_exists('discountTotal', $product)) {
|
||||||
$itemCost = $item->getField('BASE_PRICE');
|
$itemCost = $item->getField('BASE_PRICE');
|
||||||
if (isset($itemCost) && $itemCost > 0) {
|
if (isset($itemCost) && $itemCost >= 0) {
|
||||||
$item->setField('CUSTOM_PRICE', 'Y');
|
$item->setField('CUSTOM_PRICE', 'Y');
|
||||||
$item->setField('PRICE', $itemCost - $product['discountTotal']);
|
$item->setField('PRICE', $itemCost - $product['discountTotal']);
|
||||||
$item->setField('DISCOUNT_PRICE', $product['discountTotal']);
|
$item->setField('DISCOUNT_PRICE', $product['discountTotal']);
|
||||||
@ -743,10 +743,12 @@ class RetailCrmHistory
|
|||||||
RCrmActions::apiMethod($api, 'paymentEditById', __METHOD__, $newHistoryPayments[$orderPayment->getField('XML_ID')]);
|
RCrmActions::apiMethod($api, 'paymentEditById', __METHOD__, $newHistoryPayments[$orderPayment->getField('XML_ID')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_null($paymentExternalId)) {
|
||||||
\Bitrix\Sale\Internals\PaymentTable::update($paymentExternalId, array('XML_ID' => ''));
|
\Bitrix\Sale\Internals\PaymentTable::update($paymentExternalId, array('XML_ID' => ''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$order['externalId']) {
|
if (!$order['externalId']) {
|
||||||
if(RCrmActions::apiMethod($api, 'ordersFixExternalIds', __METHOD__, array(array('id' => $order['id'], 'externalId' => $newOrder->getId()))) == false){
|
if(RCrmActions::apiMethod($api, 'ordersFixExternalIds', __METHOD__, array(array('id' => $order['id'], 'externalId' => $newOrder->getId()))) == false){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user