Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/rest/lib/ |
Upload File : |
<?php namespace Bitrix\Rest; use Bitrix\Main; use Bitrix\Rest\Engine\Access; class EInvoice { public const APP_TAG = 'e-invoice'; public static function isAvailable(): bool { return Access::isAvailable() && in_array(Main\Application::getInstance()->getLicense()->getRegion(), ['de', 'it', 'pl']); } public static function getApplicationList(): array { $cache = Main\Application::getInstance()->getCache(); $cacheId = self::APP_TAG . '_marketplace'; $cacheTtl = 60 * 60 * 24; // 24 hour $cachePath = '/rest/einvoice/'; $region = Main\Application::getInstance()->getLicense()->getRegion(); $tags = [self::APP_TAG, $region]; if ($cache->initCache($cacheTtl, $cacheId, $cachePath)) { $result = $cache->getVars(); } else { $result = Marketplace\Client::getByTag($tags)['ITEMS'] ?? []; $cache->startDataCache(); $cache->endDataCache($result); } return $result; } public static function getInstalledApplications(): array { $applicationList = self::getApplicationList(); $codes = []; foreach ($applicationList as $application) { if (isset($application['CODE'])) { $codes[] = $application['CODE']; } } if (empty($codes)) { return []; } $result = AppTable::query() ->whereIn('CODE', $codes) ->setSelect([ '*', 'MENU_NAME' => 'LANG.MENU_NAME', 'MENU_NAME_DEFAULT' => 'LANG_DEFAULT.MENU_NAME', 'MENU_NAME_LICENSE' => 'LANG_LICENSE.MENU_NAME', ]) ->exec(); return $result->fetchAll(); } }