This commit is contained in:
root
2025-11-13 19:52:28 +03:00
parent 8aeeb05b7d
commit 807dec3b6c
4646 changed files with 163445 additions and 626017 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace Bitrix\UI\Integration\HumanResources;
use Bitrix\HumanResources;
use Bitrix\Main\Loader;
Loader::requireModule('humanresources');
class DepartmentQueries
{
private HumanResources\Service\Container $hrServiceLocator;
public static function getInstance(): self
{
return new self();
}
private function __construct()
{
$this->hrServiceLocator = HumanResources\Service\Container::instance();
}
public function getDepartmentByAccessCode(string $accessCode): ?HumanResources\Item\Node
{
return $this->hrServiceLocator::getNodeRepository()->getByAccessCode($accessCode);
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace Bitrix\UI\Integration\HumanResources;
use Bitrix\HumanResources\Config\Storage;
use Bitrix\HumanResources\Type\AccessCodeType;
use Bitrix\Main\Loader;
use COption;
final class HumanResources
{
public const IS_CONVERTED_OPTION_NAME = 'entity_editor_config_access_codes_is_converted';
public static function getInstance(): self
{
return new self();
}
private function __construct()
{
}
public function buildAccessCode(string $value, int $nodeId): ?string
{
if ($this->isUsed())
{
return AccessCodeType::tryFrom($value)?->buildAccessCode($nodeId);
}
return null;
}
public function isUsed(): bool
{
return Loader::includeModule('humanresources') && Storage::instance()->isCompanyStructureConverted(false);
}
private function isEntityEditorConfigAccessCodesConverted(): bool
{
return COption::GetOptionString('ui', self::IS_CONVERTED_OPTION_NAME, 'Y') === 'Y';
}
public function isAccessCodesCanBeUsed(): bool
{
return $this->isUsed() && $this->isEntityEditorConfigAccessCodesConverted();
}
}