1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
onecappmanager.php
См. документацию.
1<?php
2
3namespace Bitrix\Catalog\Store\EnableWizard;
4
5use Bitrix\Main\Application;
6use Bitrix\Main\Config\Option;
7use Bitrix\Main\Loader;
8use Bitrix\Rest\AppTable;
9use Bitrix\Crm\Integration\Market\Router;
10
12{
13 private const APP_CODE = 'bitrix.1ctotal';
14 private const INSTALL_TYPE = '1c_store_management';
15 private const MIN_APP_VERSION = 5;
16
17 public static function isAppInstalled(): bool
18 {
19 $app = self::getAppInfo();
20 if (!$app)
21 {
22 return false;
23 }
24
25 $minVersion = (int)Option::get('catalog', 'bitrix_1ctotal_app_min_version', self::MIN_APP_VERSION);
26
27 return $app['INSTALLED'] === 'Y' && (int)$app['VERSION'] >= $minVersion;
28 }
29
30 public static function getStatusUrl(): array
31 {
32 if (self::isAppInstalled())
33 {
34 $app = self::getAppInfo();
35
36 return [
37 'type' => 'app',
38 'value' => isset($app['ID']) ? (int)$app['ID'] : 0,
39 ];
40 }
41
42 return [
43 'type' => 'install',
44 'value' => self::getInstallUrl(),
45 ];
46 }
47
48 public static function getInstallUrl(): string
49 {
50 if (!Loader::includeModule('crm'))
51 {
52 return '';
53 }
54
55 return Application::getInstance()->getRouter()->url(
56 Router::getApplicationPath(self::APP_CODE),
57 [
58 'install' => 'Y',
59 'install_type' => self::INSTALL_TYPE,
60 ]
61 );
62 }
63
64 public static function onRestAppInstall($params): void
65 {
66 $localAppServer = Option::get('catalog', 'bitrix_1ctotal_app_local_server');
67 if (!$localAppServer)
68 {
69 return;
70 }
71
72 if (!is_array($params) || !isset($params['APP_ID']))
73 {
74 return;
75 }
76
77 $appId = (int)$params['APP_ID'];
78 if (!$appId)
79 {
80 return;
81 }
82
83 if (!Loader::includeModule('rest'))
84 {
85 return;
86 }
87
88 $appInfo = AppTable::getById($appId)->fetch();
89 if (!$appInfo || $appInfo['CODE'] !== self::APP_CODE)
90 {
91 return;
92 }
93
94 AppTable::update(
95 $appId,
96 [
97 'INSTALLED' => AppTable::INSTALLED,
98 'URL' => $localAppServer . '/app/1ctotal/v4/index.php',
99 'URL_INSTALL' => $localAppServer . '/app/1ctotal/v4/install.php',
100 ]
101 );
102 }
103
104 private static function getAppInfo(): ?array
105 {
106 if (!Loader::includeModule('rest'))
107 {
108 return null;
109 }
110
111 $app = AppTable::getByClientId(self::APP_CODE);
112 if (!is_array($app))
113 {
114 return null;
115 }
116
117 return $app;
118 }
119}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$app
Определения proxy.php:8
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799