Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
globalvar.php
1<?php
2
4
6{
7 protected static function getTableEntity(): string
8 {
9 return \Bitrix\Bizproc\Workflow\Type\Entity\GlobalVarTable::class;
10 }
11
12 protected static function getCacheId(): string
13 {
14 return 'variable';
15 }
16
17 public static function getObjectNameForExpressions(): string
18 {
19 return 'GlobalVar';
20 }
21
22 public static function getVisibilityFullNames(array $parameterDocumentType): array
23 {
24 $runtime = \CBPRuntime::GetRuntime();
25 $runtime->StartRuntime();
26 $documentService = $runtime->GetService("DocumentService");
27
28 [$moduleId, $entity, $documentType] = \CBPHelper::ParseDocumentId($parameterDocumentType);
29 $documentCaption = $documentService->getDocumentTypeCaption($parameterDocumentType);
30
31 $names = [];
32 $names['GLOBAL'] = \Bitrix\Main\Localization\Loc::getMessage(
33 'BIZPROC_LIB_WF_TYPE_GLOBAL_VAR_VISIBILITY_FULL_GLOBAL'
34 );
35
36 switch (mb_strtoupper($moduleId))
37 {
38 case 'RPA':
39 $moduleVisibility = \Bitrix\Main\Localization\Loc::getMessage(
40 'BIZPROC_LIB_WF_TYPE_GLOBAL_VAR_VISIBILITY_FULL_MODULE',
41 ['#MODULE#' => mb_strtoupper($moduleId)]
42 );
43 $documentVisibility = \Bitrix\Main\Localization\Loc::getMessage(
44 'BIZPROC_LIB_WF_TYPE_GLOBAL_VAR_VISIBILITY_FULL_DOCUMENT_PROCESS',
45 ['#PROCESS#' => $documentCaption]
46 );
47 break;
48 case 'CRM':
49 $moduleVisibility = \Bitrix\Main\Localization\Loc::getMessage(
50 'BIZPROC_LIB_WF_TYPE_GLOBAL_VAR_VISIBILITY_FULL_MODULE',
51 ['#MODULE#' => mb_strtoupper($moduleId)]
52 );
53 $documentVisibility = \Bitrix\Main\Localization\Loc::getMessage(
54 'BIZPROC_LIB_WF_TYPE_GLOBAL_VAR_VISIBILITY_FULL_DOCUMENT_SECTION',
55 ['#SECTION#' => $documentCaption]
56 );
57 break;
58 default:
59 $moduleVisibility = '';
60 $documentVisibility = '';
61 }
62
63 if (!$moduleVisibility)
64 {
65 return $names;
66 }
67
68 $names[mb_strtoupper($moduleId)] = $moduleVisibility;
69 $names[mb_strtoupper($moduleId) . '_' . mb_strtoupper($documentType)] = $documentVisibility;
70
71 return $names;
72 }
73
80 public static function saveAll(array $all): bool
81 {
82 $diff = array_diff(array_keys(static::getAll()), array_keys($all));
83
84 foreach ($all as $id => $property)
85 {
86 if (!isset($property['Changed']) || \CBPHelper::getBool($property['Changed']) === true)
87 {
88 static::upsert($id, $property);
89 }
90 }
91
92 if ($diff)
93 {
94 foreach ($diff as $toDelete)
95 {
96 static::delete($toDelete);
97 }
98 }
99
100 static::clearStaticCache(self::getCacheId());
101
102 return true;
103 }
104}
static getVisibilityFullNames(array $parameterDocumentType)
Definition globalvar.php:22