1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
paysystem.php
См. документацию.
1<?php
2namespace Bitrix\Sale\Cashbox\Restrictions;
3
4use Bitrix\Main\Localization\Loc;
5use Bitrix\Sale\Internals\Entity;
6use Bitrix\Sale\Payment;
7use Bitrix\Sale;
8use Bitrix\Sale\Services\Base\Restriction;
9
10Loc::loadMessages(__FILE__);
11
17{
18 public static $easeSort = 200;
19 protected static $preparedData = array();
20
24 public static function getClassTitle()
25 {
26 return Loc::getMessage("SALE_CASHBOX_RSTR_BY_PS_TITLE");
27 }
28
32 public static function getClassDescription()
33 {
34 return Loc::getMessage("SALE_CASHBOX_RSTR_BY_PS_DESC");
35 }
36
43 public static function check($params, array $restrictionParams, $serviceId = 0)
44 {
45 if (is_array($restrictionParams) && isset($restrictionParams['PAY_SYSTEMS']))
46 {
47 $diff = array_diff($params, $restrictionParams['PAY_SYSTEMS']);
48 return empty($diff);
49 }
50
51 return true;
52 }
53
58 protected static function extractParams(Entity $entity)
59 {
60 $result = array();
61
62 if ($entity instanceof Sale\Order)
63 {
64 $collection = $entity->getPaymentCollection();
65 if ($collection)
66 {
68 foreach ($collection as $item)
69 $result[] = $item->getPaymentSystemId();
70 }
71 }
72 elseif ($entity instanceof Sale\Shipment)
73 {
75 $shipmentCollection = $entity->getCollection();
76 if (!$shipmentCollection)
77 return $result;
78
79 $order = $shipmentCollection->getOrder();
80 if (!$order)
81 return $result;
82
83 $paymentCollection = $order->getPaymentCollection();
85 return $result;
86
88 foreach ($paymentCollection as $item)
89 $result[] = $item->getPaymentSystemId();
90 }
91 elseif ($entity instanceof Payment)
92 {
93 $result[] = $entity->getPaymentSystemId();
94 }
95
96 return $result;
97 }
98
102 protected static function getPaySystemsList()
103 {
104 static $result = null;
105
106 if($result !== null)
107 return $result;
108
109 $result = array();
110
112 'select' => array("ID", "NAME", "ACTIVE"),
113 'filter' => array("ACTIVE" => "Y"),
114 'order' => array("SORT"=>"ASC", "NAME"=>"ASC")
115 ));
116
117 while ($arPayType = $dbResultList->fetch())
118 $result[$arPayType["ID"]] = $arPayType["NAME"];
119
120 return $result;
121 }
122
127 public static function getParamsStructure($entityId = 0)
128 {
129 $result = array(
130 "PAY_SYSTEMS" => array(
131 "TYPE" => "ENUM",
132 'MULTIPLE' => 'Y',
133 "LABEL" => Loc::getMessage("SALE_CASHBOX_RSTR_BY_PS"),
134 "OPTIONS" => self::getPaySystemsList()
135 )
136 );
137
138 return $result;
139 }
140
145 public static function getSeverity($mode)
146 {
148 }
149
150}
static check($params, array $restrictionParams, $serviceId=0)
Определения paysystem.php:43
static getParamsStructure($entityId=0)
Определения paysystem.php:127
static getSeverity($mode)
Определения paysystem.php:145
static getList(array $params=array())
Определения manager.php:84
</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
Определения ufield.php:9
$order
Определения payment.php:8
$paymentCollection
Определения payment.php:11
$entityId
Определения payment.php:4
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799