• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/discount/discountmanager.php
  • Класс: BitrixCatalogDiscountDiscountManager
  • Вызов: DiscountManager::prepareData
static function prepareData(array $discount, $params = [])
{
	if (empty($discount) || empty($discount['ID']))
		return false;

	$discountId = (int)$discount['ID'];
	if ($discountId <= 0)
		return false;
	if (!isset(self::$discountCache[$discountId]))
	{
		self::$discountCache[$discountId] = false;

		$loadData = self::loadFromDatabase($discountId, $discount);
		if (!empty($loadData))
		{
			$loadData['LAST_LEVEL_DISCOUNT'] = 'N';
			if ($loadData['CURRENCY'] != $params['CURRENCY'])
				CatalogDiscountTable::convertCurrency($loadData, $params['CURRENCY']);
			self::createSaleAction($loadData, $params);
			$loadData['EDIT_PAGE_URL'] = self::getEditUrl([
				'ID' => $discountId, 'TYPE' => $loadData['TYPE']
			]);
			self::$discountCache[$discountId] = $loadData;
		}
	}
	$result = self::$discountCache[$discountId];
	if (empty($result))
		return $result;
	if ($result['USE_COUPONS'] == 'Y')
	{
		if (isset($discount['COUPON']))
			$result['COUPON'] = $discount['COUPON'];
	}

	return $result;
}