12use Bitrix\Crm\Service\Container;
13use Bitrix\Crm\Category\DealCategory;
84 $permission = parent::getPermission($permissionId);
90 $permissionId = (int)$permissionId;
91 if (in_array($permissionId, $storePermissions,
true))
93 $permission[
'type'] = Permission\PermissionDictionary::TYPE_MULTIVARIABLES;
94 $permission[
'enableSearch'] =
true;
96 $permission[
'hintTitle'] =
Loc::getMessage(
'CATALOG_STORE_VIEW_DESCRIPTION_HINT');
98 elseif ($permissionId === self::CATALOG_RESERVE_DEAL)
100 $permission[
'type'] = Permission\PermissionDictionary::TYPE_MULTIVARIABLES;
102 $permission[
'showAvatars'] =
false;
103 $permission[
'compactView'] =
true;
104 $permission[
'hintTitle'] =
Loc::getMessage(
'CATALOG_RESERVE_DEAL_DESCRIPTION_HINT');
107 $permissionId === self::CATALOG_PRODUCT_EDIT_ENTITY_PRICE
108 || $permissionId === self::CATALOG_PRODUCT_SET_DISCOUNT
111 $permission[
'type'] = Permission\PermissionDictionary::TYPE_MULTIVARIABLES;
113 $permission[
'showAvatars'] =
false;
114 $permission[
'compactView'] =
true;
116 elseif ($permissionId === self::CATALOG_STORE_ANALYTIC_VIEW)
118 $permission[
'type'] = Permission\PermissionDictionary::TYPE_MULTIVARIABLES;
120 $permission[
'showAvatars'] =
false;
121 $permission[
'compactView'] =
true;
124 if ($permission[
'type'] ===
Permission\PermissionDictionary::TYPE_MULTIVARIABLES)
126 $permission[
'allSelectedCode'] = static::VALUE_VARIATION_ALL;
134 $permission = static::getPermission($permissionId);
135 if ($permission[
'type'] === static::TYPE_MULTIVARIABLES)
137 return static::VALUE_VARIATION_ALL;
140 return static::VALUE_YES;
147 if ($documents ===
null)
159 foreach ($documents as $document)
161 foreach ($permissions as $permissionId)
178 'title' => self::getName($permissionId) .
'_' . $documentCode,
179 'hint' => self::HINT_PREFIX . self::getName($permissionId) .
'_' . $documentCode,
181 foreach ($fields as $field => $langMessage)
186 $permission[$field] = $fieldValue;
195 return "{$permissionId}_{$documentCode}";
200 if (static::$stores !==
null)
202 return static::$stores;
206 $stores = StoreTable::getList([
207 'select' => [
'ID',
'TITLE',
'ADDRESS'],
213 while ($store =
$stores->fetch())
215 $title = $store[
'TITLE'];
218 $title = $store[
'ADDRESS'];
221 'id' => $store[
'ID'],
222 'title' => htmlspecialcharsbx($title),
223 'entityId' =>
'store',
227 static::$stores = $items;
229 return static::$stores;
234 if (static::$dealCategories !==
null)
236 return static::$dealCategories;
239 if (!Loader::includeModule(
'crm'))
241 static::$dealCategories = [];
243 return static::$dealCategories;
252 'title' => htmlspecialcharsbx($dealCategory),
257 static::$dealCategories = $items;
259 return static::$dealCategories;
276 if (static::$priceEntities !==
null)
278 return static::$priceEntities;
281 static::$priceEntities = [];
282 if (!Loader::includeModule(
'crm'))
284 return static::$priceEntities;
288 \CCrmOwnerType::Deal =>
'deal',
289 \CCrmOwnerType::Lead =>
'lead',
290 \CCrmOwnerType::SmartInvoice =>
'invoice',
291 \CCrmOwnerType::Quote =>
'quote',
292 \CCrmOwnerType::Order =>
'order',
295 foreach ($items as $crmItem => $entityId)
297 static::$priceEntities[] = [
299 'title' => \CCrmOwnerType::GetDescription($crmItem),
300 'entityId' => $entityId,
304 static::$priceEntities = array_merge(static::$priceEntities, self::getDynamicTypeVariables());
306 return static::$priceEntities;
309 private static function getDynamicTypeVariables(): array
311 if (static::$dynamicTypes !==
null)
313 return static::$dynamicTypes;
316 if (!Loader::includeModule(
'crm'))
318 static::$dynamicTypes = [];
320 return static::$dynamicTypes;
324 $types = Container::getInstance()
325 ->getDynamicTypesMap()
330 foreach ($types as $type)
333 'id' => $type->getEntityTypeId(),
334 'title' => $type->getTitle(),
339 static::$dynamicTypes = $items;
341 return static::$dynamicTypes;
345 if (static::$storeAnalitycs !==
null)
347 return static::$storeAnalitycs;
351 if (Loader::includeModule(
'report'))
354 foreach ($dashboards as $dashboard)
357 'id' => $dashboard->getAccessBoardId(),
358 'title' => $dashboard->getBoardTitle(),
363 static::$storeAnalitycs = $items;
365 return static::$storeAnalitycs;
const VALUE_VARIATION_ALL
const CATALOG_STORE_RESERVE
const CATALOG_STORE_DOCUMENT_ALLOW_NEGATION_PRODUCT_QUANTITY
const CATALOG_PRODUCT_PUBLIC_VISIBILITY
const CATALOG_PRODUCT_PRICE_EXTRA_EDIT
static getDealCategoryVariables()
const CATALOG_STORE_MODIFY
const CATALOG_MEASURE_MODIFY
const CATALOG_SETTINGS_PRODUCT_CARD_SET_PROFILE_FOR_USERS
const CATALOG_PRODUCT_SET_DISCOUNT
const CATALOG_PRODUCT_READ
static getDefaultPermissionValue($permissionId)
const CATALOG_IMPORT_EXECUTION
const CATALOG_PRODUCT_EDIT_CATALOG_PRICE
const CATALOG_SETTINGS_SELL_NEGATIVE_COMMODITIES
const CATALOG_SETTINGS_PRODUCT_CARD_EDIT
static getStoreDocumentPermissionId($permissionId, $documentCode)
static getStoreDocumentPermissionRules(array $permissions, array $documents=null)
const CATALOG_STORE_DOCUMENT_CONDUCT
static getStoreAnalyticVariables()
const CATALOG_RESERVE_DEAL
const CATALOG_STORE_DOCUMENT_CANCEL
const CATALOG_RESERVE_SETTINGS
const CATALOG_STORE_ANALYTIC_VIEW
const CATALOG_PRODUCT_ADD
const CATALOG_EXPORT_EXECUTION
const CATALOG_SETTINGS_ACCESS
const CATALOG_IMPORT_EDIT
static getPermission($permissionId)
const CATALOG_PRODUCT_EDIT_ENTITY_PRICE
static getPriceSelectorVariables()
static getStoreVariables()
const CATALOG_INVENTORY_MANAGEMENT_ACCESS
const CATALOG_EXPORT_EDIT
const CATALOG_PRODUCT_EDIT
static getAvailableStoreDocuments()
static getStoreDocumentPermission($permissionId, $documentCode)
const CATALOG_PRODUCT_PURCHASING_PRICE_VIEW
const CATALOG_STORE_DOCUMENT_VIEW
const CATALOG_STORE_DOCUMENT
const CATALOG_STORE_DOCUMENT_MODIFY
const CATALOG_SETTINGS_EDIT_RIGHTS
const CATALOG_PRODUCT_VIEW
const CATALOG_PRICE_GROUP_MODIFY
const CATALOG_PRODUCT_DELETE
const CATALOG_STORE_DOCUMENT_DELETE
const CATALOG_SETTINGS_STORE_DOCUMENT_CARD_EDIT
static getCatalogDashboardList()
const TYPE_STORE_ADJUSTMENT
static getMessage($code, $replace=null, $language=null)