...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_product_row.php
- Класс: \CAllCrmProductRow
- Вызов: CAllCrmProductRow::UpdateTotalInfo
static function UpdateTotalInfo($ownerType, $ownerID, $totalInfo = array()) { $result = array(); if (!is_array($totalInfo)) $totalInfo = array(); $taxMode = isset($totalInfo['TAX_MODE']) ? intval($totalInfo['TAX_MODE']) : 0; if ($taxMode !== self::TAX_MODE && $taxMode !== self::LD_TAX_MODE) $taxMode = CCrmTax::isVatMode() ? self::TAX_MODE : self::LD_TAX_MODE; $taxList = null; if (is_array(($totalInfo['TAX_LIST'] ?? null))) $taxList = $totalInfo['TAX_LIST']; else { $owner = null; if (!isset($totalInfo['CURRENCY']) || !isset($totalInfo['PERSON_TYPE_ID'])) { $owner = self::getOwnerData($ownerType, $ownerID); } // Determine person type $personTypeID = 0; $arPersonTypes = CCrmPaySystem::getPersonTypeIDs(); if (isset($arPersonTypes['COMPANY']) && isset($arPersonTypes['CONTACT'])) { if (!isset($totalInfo['PERSON_TYPE_ID'])) { if (intval($owner['COMPANY_ID']) > 0) $personTypeID = intval($arPersonTypes['COMPANY']); elseif (intval($owner['CONTACT_ID']) > 0) $personTypeID = intval($arPersonTypes['CONTACT']); } else $personTypeID = intval($totalInfo['PERSON_TYPE_ID']); if ($personTypeID !== intval($arPersonTypes['COMPANY']) && $personTypeID !== intval($arPersonTypes['CONTACT'])) { $personTypeID = 0; } } $currencyID = ''; if (isset($totalInfo['CURRENCY_ID'])) $currencyID = $totalInfo['CURRENCY_ID']; if (empty($currencyID) && !empty($owner['CURRENCY_ID'])) $currencyID = $owner['CURRENCY_ID']; if (empty($currencyID)) $currencyID = CCrmCurrency::GetBaseCurrencyID(); $locationID = 0; if (isset($totalInfo['LOCATION_ID'])) $locationID = $totalInfo['LOCATION_ID']; else if (isset($owner['LOCATION_ID'])) $locationID = $owner['LOCATION_ID']; $enableSaleDiscount = false; $siteID = ''; if (!defined("SITE_ID")) { $obSite = CSite::GetList("def", "desc", array("ACTIVE" => "Y")); if ($obSite && $arSite = $obSite->Fetch()) $siteID= $arSite["LID"]; unset($obSite, $arSite); } else { $siteID = SITE_ID; } $arRows = self::LoadRows($ownerType, $ownerID, true); $calculateOptions = array(); if ($taxMode === self::LD_TAX_MODE) $calculateOptions['LOCATION_ID'] = $locationID; $arResult = CCrmSaleHelper::Calculate($arRows, $currencyID, $personTypeID, $enableSaleDiscount, $siteID, $calculateOptions); if (is_array(($arResult['TAX_LIST'] ?? null))) { $taxList = $arResult['TAX_LIST']; } } $settings = CCrmProductRow::LoadSettings($ownerType, $ownerID); $settings["TAX_MODE"] = $taxMode; if (is_array($taxList)) $settings['TAX_LIST'] = $taxList; CCrmProductRow::SaveSettings($ownerType, $ownerID, $settings); return $result; }