Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
bypersontype.php
1<?php
2
4
11
12Loc::loadMessages(__FILE__);
13
14class ByPersonType extends Base
15{
22 public static function check($personTypeId, array $params, $deliveryId = 0)
23 {
24 if (is_array($params) && isset($params['PERSON_TYPE_ID']))
25 {
26 return in_array($personTypeId, $params['PERSON_TYPE_ID']);
27 }
28
29 return true;
30 }
31
36 public static function extractParams(Entity $entity)
37 {
38 if ($entity instanceof CollectableEntity)
39 {
41 $collection = $entity->getCollection();
42
44 $order = $collection->getOrder();
45 }
46 elseif ($entity instanceof Order)
47 {
49 $order = $entity;
50 }
51
52 if (!$order)
53 return false;
54
55 $personTypeId = $order->getPersonTypeId();
56 return $personTypeId;
57 }
58
62 public static function getClassTitle()
63 {
64 return Loc::getMessage('SALE_DLVR_RSTR_BY_PERSON_TYPE');
65 }
66
70 public static function getClassDescription()
71 {
72 return Loc::getMessage('SALE_DLVR_RSTR_BY_PERSON_TYPE_DESC');
73 }
74
79 public static function getParamsStructure($deliveryId = 0)
80 {
81 $personTypeList = array();
82
83 $dbRes = \Bitrix\Sale\PersonType::getList();
84
85 while ($personType = $dbRes->fetch())
86 $personTypeList[$personType["ID"]] = $personType["NAME"]." (".$personType["ID"].")";
87
88 return array(
89 "PERSON_TYPE_ID" => array(
90 "TYPE" => "ENUM",
91 'MULTIPLE' => 'Y',
92 "LABEL" => Loc::getMessage("SALE_DLVR_RSTR_BY_PERSON_TYPE_NAME"),
93 "OPTIONS" => $personTypeList
94 )
95 );
96 }
97
102 public static function getSeverity($mode)
103 {
105 }
106}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static check($personTypeId, array $params, $deliveryId=0)