1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
basket_discount_convert.php
См. документацию.
1<?
3define('STOP_STATISTICS', true);
4define('NO_AGENT_CHECK', true);
5define('PUBLIC_AJAX_MODE', true);
6
10
11require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_admin_before.php');
12
13Loc::loadMessages(__FILE__);
14
15$saleRights = $APPLICATION->GetGroupRight('sale');
16if ($saleRights < 'W')
17{
18 ShowError(Loc::getMessage('SALE_BASKET_DISCOUNT_CONVERT_ERRORS_RIGHTS'));
19 die();
20}
21
23{
24 ShowError(Loc::getMessage('SALE_BASKET_DISCOUNT_CONVERT_ERRORS_INCORRECT_SESSION'));
25 die();
26}
27
28if (!Loader::includeModule('sale'))
29{
30 ShowError(Loc::getMessage('SALE_BASKET_DISCOUNT_CONVERT_ERRORS_MODULE_SALE_ABSENT'));
31 die();
32}
33
34if (!Loader::includeModule('catalog'))
35{
36 ShowError(Loc::getMessage('SALE_BASKET_DISCOUNT_CONVERT_ERRORS_MODULE_CATALOG_ABSENT'));
37 die();
38}
39
41$request = Main\Context::getCurrent()->getRequest();
42
43if (
44 $request->getRequestMethod() == 'GET'
45 && ($request['operation'] == 'Y' || $request['getCount'] == 'Y' || $request['clearTags'] == 'Y')
46)
47{
48 $filter = array();
50
51 $result = array();
52 if ($request['operation'] == 'Y')
53 {
54 $params = array(
55 'sessID' => $request['ajaxSessionID'],
56 'maxExecutionTime' => $request['maxExecutionTime'],
57 'maxOperationCounter' => $request['maxOperationCounter'],
58 'counter' => $request['counter'],
59 'operationCounter' => $request['operationCounter'],
60 'lastID' => $request['lastID']
61 );
62
63 $basketDiscount = new CSaleBasketDiscountConvert(
64 $params['sessID'],
65 $params['maxExecutionTime'],
66 $params['maxOperationCounter']
67 );
68 $basketDiscount->initStep($params['counter'], $params['operationCounter'], $params['lastID']);
69 $basketDiscount->setFilter($filter);
70 $basketDiscount->run();
71 $result = $basketDiscount->saveStep();
72 }
73
74 if ($request['getCount'] == 'Y')
75 {
76 $result = array(
78 );
79 }
80
81 if ($request['clearTags'] == 'Y')
82 {
83 $adminNotifyIterator = CAdminNotify::GetList(array(), array('MODULE_ID' => 'sale', 'TAG' => 'BASKET_DISCOUNT_CONVERTED'));
84 if ($adminNotifyIterator)
85 {
86 if ($adminNotify = $adminNotifyIterator->Fetch())
87 CAdminNotify::Delete($adminNotify['ID']);
88 unset($adminNotify);
89 }
90 unset($adminNotifyIterator);
91 }
92 header('Content-Type: application/x-javascript; charset='.LANG_CHARSET);
93 echo CUtil::PhpToJSObject($result, false, true);
94 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin_after.php');
95}
96else
97{
98 $APPLICATION->SetTitle(Loc::getMessage('SALE_BASKET_DISCOUNT_CONVERT_PAGE_TITLE'));
99
102
104 {
105 $adminNotifyIterator = CAdminNotify::GetList(array(), array('MODULE_ID' => 'sale', 'TAG' => 'BASKET_DISCOUNT_CONVERTED'));
106 if ($adminNotifyIterator)
107 {
108 if ($adminNotify = $adminNotifyIterator->Fetch())
109 CAdminNotify::Delete($adminNotify['ID']);
110 unset($adminNotify);
111 }
112 unset($adminNotifyIterator);
113 }
114
115 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_admin_after.php');
116
118 array('DIV' => 'basketDiscountTab01', 'TAB' => Loc::getMessage('SALE_BASKET_DISCOUNT_TAB'), 'ICON' => 'sale', 'TITLE' => Loc::getMessage('SALE_BASKET_DISCOUNT_TAB_TITLE'))
119 );
120 $tabControl = new CAdminTabControl('basketDiscountConvert', $tabList, true, true);
121 CJSCore::Init(array('date'));
122 Main\Page\Asset::getInstance()->addJs('/bitrix/js/catalog/step_operations.js');
123 Main\Page\Asset::getInstance()->addJs('/bitrix/js/sale/admin/step_operations.js');
124
126 $startDate->add('-3M');
127 $startDate->setTime(0,0,0);
128
129 ?><div id="basket_discount_empty_orders" style="display: <?=($ordersCounter == 0 ? 'block' : 'none'); ?>;"><?
130 ShowNote(Loc::getMessage('SALE_BASKET_DISCOUNT_MESS_ORDERS_ABSENT'));
131 ?></div>
132 <div id="basket_discount_result_div" style="margin:0; display: none;"></div>
133 <div id="basket_discount_error_div" style="margin:0; display: none;">
134 <div class="adm-info-message-wrap adm-info-message-red">
135 <div class="adm-info-message">
136 <div class="adm-info-message-title"><? echo Loc::getMessage('SALE_BASKET_DISCOUNT_ERRORS_TITLE'); ?></div>
137 <div id="basket_discount_error_cont"></div>
138 <div class="adm-info-message-icon"></div>
139 </div>
140 </div>
141 </div>
142 <form name="basket_discount_form" action="<? echo $APPLICATION->GetCurPage(); ?>" method="GET"><?
143 $tabControl->Begin();
144 $tabControl->BeginNextTab();
145 ?><tr>
146 <td width="40%"><? echo Loc::getMessage('SALE_BASKET_DISCOUNT_MAX_EXECUTION_TIME')?></td>
147 <td><input type="text" name="max_execution_time" id="max_execution_time" size="3" value="<?echo $oneStepTime; ?>"></td>
148 </tr>
149 <tr class="heading">
150 <td colspan="2"><? echo Loc::getMessage('SALE_BASKET_DISCOUNT_FILTER'); ?></td>
151 </tr>
152 <tr>
153 <td width="40%"><? echo Loc::getMessage('SALE_BASKET_DISCOUNT_FILTER_TYPE') ?></td>
154 <td>
155 <select name="filter_type" id="filter_type">
156 <option value="all" selected><? echo Loc::getMessage('SALE_BASKET_DISCOUNT_FILTER_TYPE_ALL'); ?></option>
157 <option value="id"><? echo Loc::getMessage('SALE_BASKET_DISCOUNT_FILTER_TYPE_ID'); ?></option>
158 <option value="date" selected><? echo Loc::getMessage('SALE_BASKET_DISCOUNT_FILTER_TYPE_DATE'); ?></option>
159 </select>
160 </td>
161 </tr>
162 <tr id="tr_filter_id" style="display: none;">
163 <td width="40%"><? echo Loc::getMessage('SALE_BASKET_DISCOUNT_FILTER_ORDER_ID_RANGE') ?></td>
164 <td><?
165 echo Loc::getMessage('SALE_BASKET_DISCOUNT_FILTER_RANGE_FROM');
166 ?>&nbsp;<input type="text" name="order_id_from" id="order_id_from" size="5">&nbsp;<?
167 echo Loc::getMessage('SALE_BASKET_DISCOUNT_FILTER_RANGE_TO');
168 ?>&nbsp;<input type="text" name="order_id_to" id="order_id_to" size="5">
169 </td>
170 </tr>
171 <tr id="tr_filter_date" style="display: table-row;">
172 <td width="40%"><? echo Loc::getMessage('SALE_BASKET_DISCOUNT_FILTER_DATE_RANGE') ?></td>
173 <td><?
174 $calendar = new CAdminCalendar;
175 echo $calendar->CalendarPeriodCustom(
176 'order_date_from', 'order_date_to',
177 $startDate->toString(), '',
178 false, 19, true
179 );
180 ?></td>
181 </tr>
182 <?
183 $tabControl->Buttons();
184 ?>
185 <input type="button" id="start_button" value="<? echo Loc::getMessage('SALE_BASKET_DISCOUNT_UPDATE_BTN')?>" disabled>
186 <input type="button" id="stop_button" value="<? echo Loc::getMessage('SALE_BASKET_DISCOUNT_STOP_BTN')?>" disabled>
187 <?
188 $tabControl->End();
189 ?></form><?
191 'url' => $APPLICATION->GetCurPage(),
192 'options' => array(
193 'ajaxSessionID' => 'basketDiscountConv',
194 'maxExecutionTime' => $oneStepTime,
195 'maxOperationCounter' => 10,
196 'counter' => $ordersCounter
197 ),
198 'visual' => array(
199 'startBtnID' => 'start_button',
200 'stopBtnID' => 'stop_button',
201 'resultContID' => 'basket_discount_result_div',
202 'errorContID' => 'basket_discount_error_cont',
203 'errorDivID' => 'basket_discount_error_div',
204 'timeFieldID' => 'max_execution_time',
205 'emptyOrdersId' => 'basket_discount_empty_orders'
206 ),
207 'ajaxParams' => array(
208 'operation' => 'Y'
209 ),
210 'filter' => array(
211 'filter_type',
212 'order_id_from',
213 'order_id_to',
214 'order_date_from_calendar_from',
215 'order_date_to_calendar_to'
216 )
217 );
218 ?>
219<script>
220 var jsBasketDiscountConverter = new BX.Sale.Admin.StepOperations.StepOperationsFilter(<? echo CUtil::PhpToJSObject($jsParams, false, true); ?>);
221 BX.ready(function(){
222 var filterType = BX('filter_type'),
223 filterId = BX('tr_filter_id'),
224 filterDate = BX('tr_filter_date');
225 if (!!filterType)
226 {
227 BX.bind(filterType, 'change', function(){
228 BX.style(filterId, 'display', (filterType.value == 'id' ? 'table-row' : 'none'));
229 BX.style(filterDate, 'display', (filterType.value == 'date' ? 'table-row' : 'none'));
230 });
231 }
232 });
233</script>
234 <?
235 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin.php');
236}
return select
Определения access_edit.php:440
<?=$taskID?> selected
Определения access_edit.php:348
$ordersCounter
Определения basket_discount_convert.php:100
$startDate
Определения basket_discount_convert.php:125
$saleRights
Определения basket_discount_convert.php:15
global $APPLICATION
Определения include.php:80
$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 CalendarPeriodCustom($sFromName, $sToName, $sFromVal="", $sToVal="", $bSelectShow=false, $size=10, $bTime=false, $arPeriod=false, $periodValue='')
Определения admin_calendar.php:125
static Delete($ID)
Определения admin_notify.php:113
static GetList($arSort=[], $arFilter=[])
Определения admin_notify.php:207
static getDefaultExecutionTime()
Определения step_operations.php:162
static Init($arExt=array(), $bReturn=false)
Определения jscore.php:66
static getAllCounter()
Определения step_operations.php:85
static getFilterCounter($filter)
Определения step_operations.php:94
static checkFilter(Main\HttpRequest $request)
Определения step_operations.php:108
& nbsp
Определения epilog_main_admin.php:38
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
Определения file_new.php:677
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Form FILTER_ACTION disabled
Определения options.php:358
$result
Определения get_property_values.php:14
$filter
Определения iblock_catalog_list.php:54
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
$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
ShowNote($strNote, $cls="notetext")
Определения tools.php:4477
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