1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
tools.php
См. документацию.
1<?
6
7define("NO_KEEP_STATISTIC", true);
8define("NO_AGENT_STATISTIC", true);
9define("NO_AGENT_CHECK", true);
10define("NOT_CHECK_PERMISSIONS", true);
11
12require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
13
15
16$result = array("ERROR" => "");
17
18if (!\Bitrix\Main\Loader::includeModule('sale'))
19 $result["ERROR"] = "Error! Can't include module \"Sale\"";
20
21$saleModulePermissions = $APPLICATION->GetGroupRight("sale");
22
23if($result["ERROR"] == '' && $saleModulePermissions >= "U" && check_bitrix_sessid())
24{
25 $action = isset($_REQUEST['action']) ? trim($_REQUEST['action']): '';
27
28 switch ($action)
29 {
30 case "get_ruspost_shipping_points_list":
31
32 $result = '';
33 $options = '<option value="">'.\Bitrix\Main\Localization\Loc::getMessage('SALE_DLVRS_ADDT_SP_NOT_SELECTED').'</option>';
34 $deliveryId = isset($_REQUEST['deliveryId']) ? (int)$_REQUEST['deliveryId'] : 0;
35 $spSelected = isset($_REQUEST['spSelected']) ? trim($_REQUEST['spSelected']) : '';
36 $pointsResult = \Sale\Handlers\Delivery\Additional\RusPost\Helper::getEnabledShippingPointsListResult($deliveryId);
37
38 if($pointsResult->isSuccess())
39 {
40 $shippingPoints = $pointsResult->getData();
41
42 if(!empty($shippingPoints))
43 {
44 foreach($shippingPoints as $sPoint)
45 {
46 if($sPoint['enabled'] == 1)
47 {
48 $options .= '<option value="'.$sPoint['operator-postcode'].'"'.
49 ($spSelected == $sPoint['operator-postcode'] ? ' selected ' : '').'>'.
50 $sPoint['operator-postcode'].' '.$sPoint['ops-address'].
51 '</option>';
52 }
53 }
54 }
55
56 $result = '<select style="width: 450px;" id="sale-delivery-ruspost-shipment-points">'.$options.'</select>';
57 }
58 else
59 {
60 $result = '<div style="color: red;">'.implode("\n<br>", $pointsResult->getErrorMessages()).'</div>';
61 }
62
63 die($result);
64 break;
65
66 case "locations_compare":
67
68 $stage = isset($_REQUEST['stage']) ? trim($_REQUEST['stage']): 'start';
69 $step = isset($_REQUEST['step']) ? trim($_REQUEST['step']): '';
70 $timeout = isset($_REQUEST['timeout']) ? trim($_REQUEST['timeout']): 24;
71 $progress = isset($_REQUEST['progress']) ? trim($_REQUEST['progress']): 0;
72
73 if($stage == '')
74 {
75 $result["ERROR"] = "Error! Wrong stage!";
76 break;
77 }
78
80 require_once($documentRoot.'/bitrix/modules/sale/handlers/delivery/additional/handler.php');
81 $res = \Sale\Handlers\Delivery\Additional\Location::compare($stage, $step, $progress, $timeout);
82
83 if($res->isSuccess())
84 {
85 $data = $res->getData();
86 $result['action'] = $action;
87 $result['stage'] = $data['STAGE'];
88
89 if(!empty($data['STEP']))
90 $result['step'] = $data['STEP'];
91
92 if(!empty($data['MESSAGE']))
93 $result['message'] = $data['MESSAGE'];
94
95 if(!empty($data['PROGRESS']))
96 $result['progress'] = $data['PROGRESS'];
97 }
98 else
99 {
100 $result["ERROR"] = implode(',<br>\n', $res->getErrorMessages());
101 }
102
103 break;
104 default:
105 $result["ERROR"] = "Error! Wrong action!";
106 break;
107 }
108}
109else
110{
111 if($result["ERROR"] == '')
112 $result["ERROR"] = "Error! Access denied";
113}
114
115if($result["ERROR"] <> '')
116 $result["RESULT"] = "ERROR";
117else
118 $result["RESULT"] = "OK";
119
120$result = json_encode($result);
121header('Content-Type: application/json');
122die($result);
global $APPLICATION
Определения include.php:80
static getDocumentRoot()
Определения application.php:736
static loadMessages($file)
Определения loc.php:65
static getHandlersList()
Определения manager.php:636
$options
Определения commerceml2.php:49
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
$result
Определения get_property_values.php:14
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
foreach(['Bitrix\\Main'=> '/lib', 'Psr\\Container'=> '/vendor/psr/container/src', 'Psr\\Log'=> '/vendor/psr/log/src', 'Psr\\Http\\Message'=> '/vendor/psr/http-message/src', 'Psr\\Http\\Client'=> '/vendor/psr/http-client/src', 'Http\\Promise'=> '/vendor/php-http/promise/src', 'PHPMailer\\PHPMailer'=> '/vendor/phpmailer/phpmailer/src', 'GeoIp2'=> '/vendor/geoip2/geoip2/src', 'MaxMind\\Db'=> '/vendor/maxmind-db/reader/src/MaxMind/Db', 'PhpParser'=> '/vendor/nikic/php-parser/lib/PhpParser', 'Recurr'=> '/vendor/simshaun/recurr/src/Recurr',] as $namespace=> $namespacePath) $documentRoot
Определения autoload.php:27
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
die
Определения quickway.php:367
$saleModulePermissions
Определения tools.php:21
$action
Определения file_dialog.php:21