8namespace Bitrix\Sale\Location;
11use Bitrix\Main\Entity;
12use Bitrix\Main\Localization\Loc;
14use Bitrix\Sale\Location\Name;
15use Bitrix\Sale\Location\Util\Assert;
16use Bitrix\Sale\Result;
18Loc::loadMessages(__FILE__);
45 return 'b_sale_loc_type';
56 $addResult =
new Entity\AddResult();
57 $addResult->addError(
new Main\
Error(Loc::getMessage(
'SALE_LOCATION_TYPE_ENTITY_CODE_FIELD_EXIST_ERROR')));
61 if(isset(
$data[
'NAME']))
67 if((
string)
$data[
'DISPLAY_SORT'] ==
'' && (
string)
$data[
'SORT'] !=
'')
72 $addResult = parent::add(
$data);
75 if($addResult->isSuccess())
77 $primary = $addResult->getId();
89 $primary = Assert::expectIntegerPositive($primary,
'$primary');
91 if(isset(
$data[
'CODE']))
95 '=CODE' =>
$data[
'CODE'],
102 $updResult =
new Entity\UpdateResult();
103 $updResult->addError(
new Main\
Error(Loc::getMessage(
'SALE_LOCATION_TYPE_ENTITY_CODE_FIELD_EXIST_ERROR')));
110 if(isset(
$data[
'NAME']))
113 unset(
$data[
'NAME']);
116 $updResult = parent::update($primary,
$data);
119 if($updResult->isSuccess())
129 public static function delete($primary)
131 $primary = Assert::expectIntegerPositive($primary,
'$primary');
133 $delResult = parent::delete($primary);
136 if($delResult->isSuccess())
147 'data_type' =>
'integer',
149 'autocomplete' =>
true,
152 'data_type' =>
'string',
154 'title' => Loc::getMessage(
'SALE_LOCATION_TYPE_ENTITY_CODE_FIELD')
157 'data_type' =>
'integer',
158 'title' => Loc::getMessage(
'SALE_LOCATION_TYPE_ENTITY_DEPTH_LEVEL_FIELD')
161 'DISPLAY_SORT' =>
array(
162 'data_type' =>
'integer',
163 'title' => Loc::getMessage(
'SALE_LOCATION_TYPE_ENTITY_DISPLAY_SORT_FIELD')
168 'data_type' =>
'Bitrix\Sale\Location\Name\Type',
169 'reference' =>
array(
170 '=this.ID' =>
'ref.TYPE_ID'
174 'data_type' =>
'Bitrix\Sale\Location\Location',
175 'reference' =>
array(
176 '=this.ID' =>
'ref.TYPE_ID'
static deleteMultipleForOwner($primaryOwner)
static addMultipleForOwner($primaryOwner, $names=array())
static updateMultipleForOwner($primaryOwner, $names)
static update($primary, array $data)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)