diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v4.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v4.php index ee63a434..ea9b9b9e 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v4.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v4.php @@ -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 } } } -} \ No newline at end of file +} diff --git a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php index b091c42a..59b9f840 100644 --- a/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php +++ b/intaro.retailcrm/classes/general/history/RetailCrmHistory_v5.php @@ -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 } } } -} \ No newline at end of file +}