1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
EInvoice.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Rest;
4
5
use Bitrix\Main;
6
use Bitrix\Rest\Engine\Access;
7
8
class
EInvoice
9
{
10
public
const
APP_TAG
=
'e-invoice'
;
11
12
public
static
function
isAvailable
(): bool
13
{
14
return
Access::isAvailable() && in_array(
Main
\Application::getInstance()->getLicense()->getRegion(), [
'de'
,
'it'
,
'pl'
]);
15
}
16
17
public
static
function
getApplicationList
():
array
18
{
19
$cache =
Main\Application::getInstance
()->getCache();
20
$cacheId = self::APP_TAG .
'_marketplace'
;
21
$cacheTtl = 60 * 60 * 24;
// 24 hour
22
$cachePath =
'/rest/einvoice/'
;
23
$region
=
Main\Application::getInstance
()->getLicense()->getRegion();
24
$tags = [self::APP_TAG,
$region
];
25
26
if
($cache->initCache($cacheTtl, $cacheId, $cachePath))
27
{
28
$result
= $cache->getVars();
29
}
30
else
31
{
32
$result
=
Marketplace\Client::getByTag
($tags)[
'ITEMS'
] ?? [];
33
$cache->startDataCache();
34
$cache->endDataCache(
$result
);
35
}
36
37
return
$result
;
38
}
39
40
public
static
function
getInstalledApplications
():
array
41
{
42
$applicationList =
self::getApplicationList
();
43
$codes = [];
44
45
foreach
($applicationList as
$application
)
46
{
47
if
(isset(
$application
[
'CODE'
]))
48
{
49
$codes[] =
$application
[
'CODE'
];
50
}
51
}
52
53
if
(empty($codes))
54
{
55
return
[];
56
}
57
58
$result
= AppTable::query()
59
->whereIn(
'CODE'
, $codes)
60
->setSelect([
61
'*'
,
62
'MENU_NAME'
=>
'LANG.MENU_NAME'
,
63
'MENU_NAME_DEFAULT'
=>
'LANG_DEFAULT.MENU_NAME'
,
64
'MENU_NAME_LICENSE'
=>
'LANG_LICENSE.MENU_NAME'
,
65
])
66
->exec();
67
68
return
$result
->fetchAll();
69
}
70
}
Bitrix\Main\Application\getInstance
static getInstance()
Определения
application.php:98
Bitrix\Rest\EInvoice
Определения
EInvoice.php:9
Bitrix\Rest\EInvoice\APP_TAG
const APP_TAG
Определения
EInvoice.php:10
Bitrix\Rest\EInvoice\getInstalledApplications
static getInstalledApplications()
Определения
EInvoice.php:40
Bitrix\Rest\EInvoice\isAvailable
static isAvailable()
Определения
EInvoice.php:12
Bitrix\Rest\EInvoice\getApplicationList
static getApplicationList()
Определения
EInvoice.php:17
Bitrix\Rest\Marketplace\Client\getByTag
static getByTag($tag, $page=false, $pageSize=false)
Определения
client.php:259
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$region
$region
Определения
.description.php:13
$application
$application
Определения
bitrix.php:23
Bitrix\Main
bitrix
modules
rest
lib
EInvoice.php
Создано системой
1.14.0