26 protected static function getAllAvailable(array $parameterDocumentType = []): array
28 $cacheId = static::getCacheId();
30 if (!isset(static::$allSortByVisibilityCache[$cacheId]))
32 $all = static::getAllRows();
33 $allSortByVisibility = [];
34 foreach ($all as $id => $property)
36 $visibility = $property[
'Visibility'];
37 $allSortByVisibility[$visibility][$id] = $property;
40 static::$allSortByVisibilityCache[$cacheId] = $allSortByVisibility;
43 $global = static::$allSortByVisibilityCache[$cacheId][
'GLOBAL'] ?? [];
45 if (!$parameterDocumentType)
52 [$moduleId, $entity, $documentType] = \CBPHelper::ParseDocumentId($parameterDocumentType);
54 catch (\CBPArgumentNullException $e)
59 $module = static::$allSortByVisibilityCache[$cacheId][mb_strtoupper($moduleId)] ?? [];
61 static::$allSortByVisibilityCache[$cacheId][mb_strtoupper($moduleId) .
'_' . mb_strtoupper($documentType)]
65 return array_merge($global, $module, $document);
70 $cacheId = static::getCacheId();
72 if (!isset(static::$allCache[$cacheId]))
75 $table = static::getTableEntity();
76 if (method_exists($table,
'getList') && method_exists($table,
'convertToProperty'))
78 $rows = $table::getList();
80 foreach ($rows as $row)
82 $all[$row[
'ID']] = $table::convertToProperty($row);
86 static::$allCache[$cacheId] = $all;
89 return static::$allCache[$cacheId];
158 public static function canUserRead(array $documentType,
int $userId): bool
160 $user = new \CBPWorkflowTemplateUser($userId);
161 if ($user->isAdmin())
166 $canCreateAutomation = \CBPDocument::CanUserOperateDocumentType(
167 \CBPCanUserOperateOperation::CreateAutomation,
171 if ($canCreateAutomation)
176 return \CBPDocument::CanUserOperateDocumentType(
177 \CBPCanUserOperateOperation::CreateWorkflow,
195 [$moduleId, $entity, $documentType] = \CBPHelper::ParseDocumentId($parameterDocumentType);
196 if (in_array(mb_strtoupper($moduleId), [
'CRM',
'RPA']))
198 return [
'GLOBAL', mb_strtoupper($moduleId), mb_strtoupper($moduleId) .
'_' . mb_strtoupper($documentType)];
206 $runtime = \CBPRuntime::GetRuntime();
207 $runtime->StartRuntime();
208 $documentService = $runtime->GetService(
"DocumentService");
211 [$moduleId, $entity, $documentType] = \CBPHelper::ParseDocumentId($parameterDocumentType);
212 $documentCaption = $documentService->getDocumentTypeCaption($parameterDocumentType);
216 'BIZPROC_LIB_WF_TYPE_GLOBAL_FIELD_VISIBILITY_SHORT_GLOBAL'
219 switch (mb_strtoupper($moduleId))
223 $moduleVisibility = mb_strtoupper($moduleId);
224 $documentVisibility = $documentCaption;
227 $moduleVisibility =
'';
228 $documentVisibility =
'';
232 if (!$moduleVisibility)
237 $names[mb_strtoupper($moduleId)] = $moduleVisibility;
238 $names[mb_strtoupper($moduleId) .
'_' . mb_strtoupper($documentType)] = $documentVisibility;