1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
discount_reindex.php
См. документацию.
1<?php
3const STOP_STATISTICS = true;
4const NO_AGENT_CHECK = true;
5const PUBLIC_AJAX_MODE = true;
6
11use Bitrix\Sale;
12
13require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_before.php';
14
15$saleRights = $APPLICATION->GetGroupRight('sale');
16if ($saleRights < 'W')
17{
18 ShowError(Loc::getMessage('SALE_DISCOUNT_REINDEX_ERRORS_RIGHTS'));
19 die();
20}
21
23{
24 ShowError(Loc::getMessage('SALE_DISCOUNT_REINDEX_ERRORS_INCORRECT_SESSION'));
25 die();
26}
27
28if (!Loader::includeModule('sale'))
29{
30 ShowError(Loc::getMessage('SALE_DISCOUNT_REINDEX_ERRORS_MODULE_SALE_ABSENT'));
31 die();
32}
33
34if (!Loader::includeModule('catalog'))
35{
36 ShowError(Loc::getMessage('SALE_DISCOUNT_REINDEX_ERRORS_MODULE_CATALOG_ABSENT'));
37 die();
38}
39
41$request = Main\Context::getCurrent()->getRequest();
42
43if (
44 $request->getRequestMethod() === 'GET'
45 && $request['operation'] === 'Y'
46)
47{
48 $params = [
49 'sessID' => $request['ajaxSessionID'],
50 'maxExecutionTime' => $request['maxExecutionTime'],
51 'maxOperationCounter' => $request['maxOperationCounter'],
52 'counter' => $request['counter'],
53 'operationCounter' => $request['operationCounter'],
54 'lastID' => $request['lastID'],
55 ];
56
57 $discountReindex = new CSaleDiscountReindex(
58 $params['sessID'],
59 $params['maxExecutionTime'],
60 $params['maxOperationCounter']
61 );
62 $discountReindex->initStep($params['counter'], $params['operationCounter'], $params['lastID']);
63 $discountReindex->run();
64 $result = $discountReindex->saveStep();
65
66 if ($result['finishOperation'])
67 {
69 [],
70 [
71 'MODULE_ID' => 'sale',
72 'TAG' => Sale\Discount::ERROR_ID,
73 ]
74 );
75 $notify = $iterator->Fetch();
76 unset($iterator);
77 if (!empty($notify))
78 {
79 \CAdminNotify::Delete($notify['ID']);
80 }
81 unset($notify);
82 }
83
84 header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
85 echo CUtil::PhpToJSObject($result, false, true);
86 require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_admin_after.php';
87}
88else
89{
90 $APPLICATION->SetTitle(Loc::getMessage('SALE_DISCOUNT_REINDEX_PAGE_TITLE'));
91
94
95 require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_after.php';
96
98 [
99 'DIV' => 'discountReindexTab01',
100 'TAB' => Loc::getMessage('SALE_DISCOUNT_REINDEX_TAB'),
101 'ICON' => 'sale',
102 'TITLE' => Loc::getMessage('SALE_DISCOUNT_REINDEX_TAB_TITLE'),
103 ],
104 ];
105 $tabControl = new CAdminTabControl('saleDiscountReindex', $tabList, true, true);
106 Main\Page\Asset::getInstance()->addJs('/bitrix/js/catalog/step_operations.js');
107
108 ?><div id="discount_reindex_result_div" style="margin:0; display: none;"></div>
109 <div id="discount_reindex_error_div" style="margin:0; display: none;">
110 <div class="adm-info-message-wrap adm-info-message-red">
111 <div class="adm-info-message">
112 <div class="adm-info-message-title"><?= Loc::getMessage('SALE_DISCOUNT_REINDEX_ERRORS_TITLE'); ?></div>
113 <div id="discount_reindex_error_cont"></div>
114 <div class="adm-info-message-icon"></div>
115 </div>
116 </div>
117 </div>
118 <form name="discount_reindex_form" action="<?= $APPLICATION->GetCurPage(); ?>" method="GET"><?php
119 $tabControl->Begin();
120 $tabControl->BeginNextTab();
121 ?><tr>
122 <td style="width: 40%;"><?= Loc::getMessage('SALE_DISCOUNT_REINDEX_MAX_EXECUTION_TIME'); ?></td>
123 <td><input type="text" name="max_execution_time" id="max_execution_time" size="3" value="<?= $oneStepTime; ?>"></td>
124 </tr><?php
125 $tabControl->Buttons();
126 ?>
127 <input type="button" id="start_button" value="<?= HtmlFilter::encode(Loc::getMessage('SALE_DISCOUNT_REINDEX_UPDATE_BTN')); ?>"<?= ($discountCounter > 0 ? '' : ' disabled'); ?>>
128 <input type="button" id="stop_button" value="<?= HtmlFilter::encode(Loc::getMessage('SALE_DISCOUNT_REINDEX_STOP_BTN')); ?>" disabled>
129 <?php
130 $tabControl->End();
131 ?></form><?php
132
134 'url' => $APPLICATION->GetCurPage(),
135 'options' => [
136 'ajaxSessionID' => 'saleDiscountReindex',
137 'maxExecutionTime' => $oneStepTime,
138 'maxOperationCounter' => 10,
139 'counter' => $discountCounter,
140 ],
141 'visual' => [
142 'startBtnID' => 'start_button',
143 'stopBtnID' => 'stop_button',
144 'resultContID' => 'discount_reindex_result_div',
145 'errorContID' => 'discount_reindex_error_cont',
146 'errorDivID' => 'discount_reindex_error_div',
147 'timeFieldID' => 'max_execution_time',
148 ],
149 'ajaxParams' => [
150 'operation' => 'Y',
151 ],
152 ];
153?>
154<script>
155 var jsStepOperations = new BX.Catalog.StepOperations(<?= CUtil::PhpToJSObject($jsParams, false, true); ?>);
156</script>
157<?php
158 require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_admin.php';
159}
$saleRights
Определения basket_discount_convert.php:15
global $APPLICATION
Определения include.php:80
const PUBLIC_AJAX_MODE
Определения catalog_reindex.php:6
$jsParams
Определения catalog_reindex.php:168
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
$tabList
Определения catalog_reindex.php:107
$oneStepTime
Определения catalog_reindex.php:103
Определения loader.php:13
static Delete($ID)
Определения admin_notify.php:113
static GetList($arSort=[], $arFilter=[])
Определения admin_notify.php:207
static getDefaultExecutionTime()
Определения step_operations.php:162
static getAllCounter()
Определения step_operations.php:268
$discountCounter
Определения discount_reindex.php:92
Form FILTER_ACTION disabled
Определения options.php:358
const STOP_STATISTICS
Определения froogle_util.php:2
$result
Определения get_property_values.php:14
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
const NO_AGENT_CHECK
Определения cron_frame.php:17
$tabControl
Определения csv_new_setup.php:244
const LANG_CHARSET
Определения include.php:65
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
ShowError($strError, $cls="errortext")
Определения tools.php:4499
die
Определения quickway.php:367
font style
Определения invoice.php:442
font size
Определения invoice.php:442
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$iterator
Определения yandex_run.php:610