Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
currency.php
1<?php
3
12
13Loc::loadMessages(__FILE__);
14
19class Currency extends Base\Restriction
20{
25 protected static function extractParams(Internals\Entity $entity)
26 {
27 if ($entity instanceof Internals\CollectableEntity)
28 {
30 $collection = $entity->getCollection();
31
33 $order = $collection->getOrder();
34 }
35 elseif ($entity instanceof Sale\Order)
36 {
38 $order = $entity;
39 }
40
41 if (!$order)
42 return false;
43
44 return $order->getCurrency();
45 }
46
50 public static function getClassTitle()
51 {
52 return Loc::getMessage('SALE_COMPANY_RULES_BY_CURRENCY_TITLE');
53 }
54
58 public static function getClassDescription()
59 {
60 return Loc::getMessage('SALE_COMPANY_RULES_BY_CURRENCY_DESC');
61 }
62
67 public static function getParamsStructure($entityId = 0)
68 {
69 return array(
70 "CURRENCY" => array(
71 "TYPE" => "ENUM",
72 'MULTIPLE' => 'Y',
73 "LABEL" => Loc::getMessage("SALE_COMPANY_RULES_BY_CURRENCY"),
74 "OPTIONS" => CurrencyManager::getCurrencyList()
75 )
76 );
77 }
78
85 public static function check($params, array $restrictionParams, $serviceId = 0)
86 {
87 if (isset($restrictionParams) && is_array($restrictionParams['CURRENCY']))
88 return in_array($params, $restrictionParams['CURRENCY']);
89
90 return true;
91 }
92}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static extractParams(Entity $entity)
static check($params, array $restrictionParams, $serviceId=0)
Definition currency.php:85