1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
location.php
См. документацию.
1<?php
2namespace Bitrix\Sale\Services\Company\Restrictions;
3
4use Bitrix\Main\Localization\Loc;
5use Bitrix\Sale\Internals\CollectableEntity;
6use Bitrix\Sale\Internals\CompanyLocationTable;
7use Bitrix\Sale\Internals\Entity;
8use Bitrix\Sale\Location\Tree\NodeNotFoundException;
9use Bitrix\Sale\Order;
10use Bitrix\Sale\Services\Base;
11
12Loc::loadMessages(__FILE__);
13
19{
20 public static $easeSort = 200;
21
25 public static function getClassTitle()
26 {
27 return Loc::getMessage("SALE_COMPANY_RULES_BY_LOCATION_TITLE");
28 }
29
33 public static function getClassDescription()
34 {
35 return Loc::getMessage("SALE_COMPANY_RULES_BY_LOCATION_DESC");
36 }
37
44 public static function check($params, array $restrictionParams, $serviceId = 0)
45 {
46 if ((int)$serviceId <= 0)
47 return true;
48
49 if (!$params)
50 return false;
51
52 try
53 {
54 return CompanyLocationTable::checkConnectionExists(
55 intval($serviceId),
56 $params,
57 array(
58 'LOCATION_LINK_TYPE' => 'AUTO'
59 )
60 );
61 }
62 catch (NodeNotFoundException $e)
63 {
64 return false;
65 }
66 }
67
73 protected static function extractParams(Entity $entity)
74 {
75 if ($entity instanceof CollectableEntity)
76 {
78 $order = $entity->getCollection()->getOrder();
79 }
80 elseif ($entity instanceof Order)
81 {
84 }
85
86 if (!$order)
87 return '';
88
89 if(!$props = $order->getPropertyCollection())
90 return '';
91
92 if(!$locationProp = $props->getDeliveryLocation())
93 return '';
94
95 if(!$locationCode = $locationProp->getValue())
96 return '';
97
98 return $locationCode;
99 }
100
106 protected static function prepareParamsForSaving(array $params = array(), $companyId = 0)
107 {
108 if($companyId > 0)
109 {
110 $arLocation = array();
111
113 {
114 if($params["LOCATION"]['L'] <> '')
115 {
116 $LOCATION1 = explode(':', $params["LOCATION"]['L']);
117 }
118
119 if($params["LOCATION"]['G'] <> '')
120 {
121 $LOCATION2 = explode(':', $params["LOCATION"]['G']);
122 }
123 }
124
125 if (isset($LOCATION1) && is_array($LOCATION1) && count($LOCATION1) > 0)
126 {
127 $arLocation["L"] = array();
128 $locationCount = count($LOCATION1);
129
130 for ($i = 0; $i<$locationCount; $i++)
131 if($LOCATION1[$i] <> '')
132 {
133 $arLocation["L"][] = $LOCATION1[$i];
134 }
135 }
136
137 if (isset($LOCATION2) && is_array($LOCATION2) && count($LOCATION2) > 0)
138 {
139 $arLocation["G"] = array();
140 $locationCount = count($LOCATION2);
141
142 for ($i = 0; $i<$locationCount; $i++)
143 if($LOCATION2[$i] <> '')
144 {
145 $arLocation["G"][] = $LOCATION2[$i];
146 }
147
148 }
149
150 CompanyLocationTable::resetMultipleForOwner($companyId, $arLocation);
151 }
152
153 return array();
154 }
155
160 public static function getParamsStructure($entityId = 0)
161 {
162
163 $result = array(
164 "LOCATION" => array(
165 "TYPE" => "COMPANY_LOCATION_MULTI"
166 )
167 );
168
169 if($entityId > 0 )
170 $result["LOCATION"]["COMPANY_ID"] = $entityId;
171
172 return $result;
173 }
174
180 public static function save(array $fields, $restrictionId = 0)
181 {
182 $fields["PARAMS"] = self::prepareParamsForSaving($fields["PARAMS"], $fields["SERVICE_ID"]);
183 return parent::save($fields, $restrictionId);
184 }
185
191 public static function delete($restrictionId, $entityId = 0)
192 {
193 CompanyLocationTable::resetMultipleForOwner($entityId);
194 return parent::delete($restrictionId);
195 }
196}
static prepareParamsForSaving(array $params=array(), $companyId=0)
Определения location.php:106
static check($params, array $restrictionParams, $serviceId=0)
Определения location.php:44
static save(array $fields, $restrictionId=0)
Определения location.php:180
static getParamsStructure($entityId=0)
Определения location.php:160
static isLocationProEnabled()
Определения location.php:40
</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
$entityId
Определения payment.php:4
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$i
Определения factura.php:643
</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
$props
Определения template.php:269
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$arLocation['REGION_NAME']
Определения options.php:2800
$fields
Определения yandex_run.php:501