1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
bytradebinding.php
См. документацию.
1<?php
2namespace Bitrix\Sale\Delivery\Restrictions;
3
4use Bitrix\Main\Localization\Loc;
5use Bitrix\Sale;
6use Bitrix\Sale\TradeBindingEntity;
7
8Loc::loadMessages(__FILE__);
9
14class ByTradeBinding extends Base
15{
19 public static function getClassTitle()
20 {
21 return Loc::getMessage('SALE_SRV_RSTR_BY_TRADE_BINDING_NAME');
22 }
23
27 public static function getClassDescription()
28 {
29 return Loc::getMessage('SALE_SRV_RSTR_BY_TRADE_BINDING_DESC');
30 }
31
41 public static function getParamsStructure($entityId = 0)
42 {
43 $result = array(
44 "TRADE_BINDING" => array(
45 "TYPE" => "ENUM",
46 'MULTIPLE' => 'Y',
47 "LABEL" => Loc::getMessage("SALE_SRV_RSTR_BY_TRADE_BINDING_LIST"),
48 "OPTIONS" => self::getTradePlatformList()
49 )
50 );
51
52 return $result;
53 }
54
61 protected static function getTradePlatformList()
62 {
63 $result = [];
64
65 $dbRes = Sale\TradingPlatformTable::getList(['select' => ['CODE', 'CLASS']]);
66 while ($data = $dbRes->fetch())
67 {
69 $platformClassName = $data['CLASS'];
70
71 if (!empty($platformClassName) && class_exists($platformClassName))
72 {
73 $platform = $platformClassName::getInstanceByCode($data['CODE']);
74 if ($platform
76 )
77 {
78 $result[$platform->getId()] = $platform->getRealName();
79 }
80 }
81 }
82
83 return $result;
84 }
85
95 protected static function extractParams(Sale\Internals\Entity $entity)
96 {
97 $result = [];
98
99 $order = static::getOrder($entity);
100
101 if ($order === null)
102 {
103 return $result;
104 }
105
106 $collection = $order->getTradeBindingCollection();
107
109 foreach ($collection as $entity)
110 {
111 $tradeBinding = $entity->getTradePlatform();
112 if (
113 $tradeBinding
114 && !in_array($tradeBinding->getId(), $result)
115 )
116 {
117 $result[] = $tradeBinding->getId();
118 }
119 }
120
121 return $result;
122 }
123
128 protected static function getOrder(Sale\Internals\Entity $entity)
129 {
130 if ($entity instanceof Sale\Shipment)
131 {
133 $collection = $entity->getCollection();
134
136 return $collection->getOrder();
137 }
138 elseif ($entity instanceof Sale\Order)
139 {
141 return $entity;
142 }
143
144 return null;
145 }
146
153 public static function check($params, array $restrictionParams, $serviceId = 0)
154 {
155 if (is_array($restrictionParams) && isset($restrictionParams['TRADE_BINDING']))
156 {
157 $diff = array_diff($params, $restrictionParams['TRADE_BINDING']);
158 return empty($diff);
159 }
160
161 return true;
162 }
163
172 public static function isAvailable()
173 {
174 return count(static::getTradePlatformList()) > 0;
175 }
176
177}
static check($params, array $restrictionParams, $serviceId=0)
Определения bytradebinding.php:153
static getParamsStructure($entityId=0)
Определения bytradebinding.php:41
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$entity
$platform
Определения settings.php:7
Order
Определения order.php:6
$order
Определения payment.php:8
$entityId
Определения payment.php:4
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$dbRes
Определения yandex_detail.php:168