1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
discount.php
См. документацию.
1<?php
2
5
6require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/catalog/general/discount.php');
7
9{
10 public static function _Add(&$arFields)
11 {
12 global $DB;
13
15 return false;
16
17 $arInsert = $DB->PrepareInsert("b_catalog_discount", $arFields);
18
19 $strSql = "INSERT INTO b_catalog_discount(".$arInsert[0].") VALUES(".$arInsert[1].")";
20 $DB->Query($strSql);
21
22 $ID = (int)$DB->LastID();
23
24 if (isset($arFields['HANDLERS']))
25 self::updateDiscountHandlers($ID, $arFields['HANDLERS'], false);
26
27 return $ID;
28 }
29
30 public static function _Update($ID, &$arFields)
31 {
32 global $DB;
33 global $APPLICATION;
34
35 $ID = (int)$ID;
36 if ($ID <= 0)
37 return false;
38
40 return false;
41
42 if (isset($arFields['VALUE']) != isset($arFields['VALUE_TYPE']))
43 {
44 $rsDiscounts = CCatalogDiscount::GetList(array(),array('ID' => $ID), false, array('nTopCount' => 1), array('ID', 'VALUE', 'VALUE_TYPE'));
45 if ($arDiscount = $rsDiscounts->Fetch())
46 {
47 if (!isset($arFields['VALUE']))
48 $arFields['VALUE'] = doubleval($arDiscount['VALUE']);
49 if (!isset($arFields['VALUE_TYPE']))
50 $arFields['VALUE_TYPE'] = $arDiscount['VALUE_TYPE'];
51 if (self::TYPE_PERCENT == $arFields['VALUE_TYPE'] && 100 < $arFields['VALUE'])
52 {
53 $APPLICATION->ThrowException(GetMessage("BT_MOD_CATALOG_DISC_ERR_BAD_VALUE"), "VALUE");
54 return false;
55 }
56 }
57 else
58 {
59 $APPLICATION->ThrowException(str_replace('#ID#', $ID, GetMessage("BT_MOD_CATALOG_DISC_ERR_BAD_ID")), "ID");
60 return false;
61 }
62 }
63
64 $strUpdate = $DB->PrepareUpdate("b_catalog_discount", $arFields);
65 if (!empty($strUpdate))
66 {
67 $strSql = "UPDATE b_catalog_discount SET ".$strUpdate." WHERE ID = ".$ID." AND TYPE = ".self::ENTITY_ID;
68 $DB->Query($strSql);
69
70 if (isset($arFields['HANDLERS']))
71 self::updateDiscountHandlers($ID, $arFields['HANDLERS'], true);
72 }
73
74 return $ID;
75 }
76
77 public static function Delete($ID)
78 {
79 global $DB;
80
81 $ID = (int)$ID;
82 if ($ID <= 0)
83 return false;
84
85 foreach (GetModuleEvents("catalog", "OnBeforeDiscountDelete", true) as $arEvent)
86 {
87 if (false === ExecuteModuleEventEx($arEvent, array($ID)))
88 return false;
89 }
90
91 $DB->Query("delete from b_catalog_discount2iblock where DISCOUNT_ID = ".$ID);
92 $DB->Query("delete from b_catalog_discount2section where DISCOUNT_ID = ".$ID);
93 $DB->Query("delete from b_catalog_discount2product where DISCOUNT_ID = ".$ID);
98
99 $DB->Query("delete from b_catalog_discount where ID = ".$ID." and TYPE = ".self::ENTITY_ID);
100
101 foreach (GetModuleEvents("catalog", "OnDiscountDelete", true) as $arEvent)
102 {
103 ExecuteModuleEventEx($arEvent, array($ID));
104 }
105
106 return true;
107 }
108
113 public static function GetByID($ID)
114 {
115 global $DB;
116
117 $ID = (int)$ID;
118 if ($ID <= 0)
119 return false;
120
121 $strSql =
122 "SELECT CD.ID, CD.SITE_ID, CD.ACTIVE, CD.NAME, CD.MAX_USES, ".
123 "CD.COUNT_USES, CD.COUPON, CD.SORT, CD.MAX_DISCOUNT, CD.VALUE_TYPE, ".
124 "CD.VALUE, CD.CURRENCY, CD.MIN_ORDER_SUM, CD.NOTES, CD.RENEWAL, ".
125 $DB->DateToCharFunction("CD.TIMESTAMP_X", "FULL")." as TIMESTAMP_X, ".
126 $DB->DateToCharFunction("CD.ACTIVE_FROM", "FULL")." as ACTIVE_FROM, ".
127 $DB->DateToCharFunction("CD.ACTIVE_TO", "FULL")." as ACTIVE_TO, ".
128 "CD.CREATED_BY, CD.MODIFIED_BY, ".$DB->DateToCharFunction('CD.DATE_CREATE', 'FULL').' as DATE_CREATE, '.
129 "CD.PRIORITY, CD.LAST_DISCOUNT, CD.VERSION, CD.CONDITIONS, CD.UNPACK, CD.SALE_ID ".
130 "FROM b_catalog_discount CD WHERE CD.ID = ".$ID." AND CD.TYPE = ".self::ENTITY_ID;
131
132 $db_res = $DB->Query($strSql);
133 if ($res = $db_res->Fetch())
134 return $res;
135
136 return false;
137 }
138
150 public static function PrepareSection4Where($val, $key, $operation, $negative, $field, $arField, $arFilter)
151 {
152 $val = (int)$val;
153 if ($val <= 0)
154 return false;
155
156 $dbSection = CIBlockSection::GetByID($val);
157 if ($arSection = $dbSection->Fetch())
158 {
159 $arIDs = array(0);
160 $dbSectionTree = CIBlockSection::GetList(
161 array("LEFT_MARGIN" => "DESC"),
162 array(
163 "IBLOCK_ID" => $arSection["IBLOCK_ID"],
164 "ACTIVE" => "Y",
165 "GLOBAL_ACTIVE" => "Y",
166 "IBLOCK_ACTIVE" => "Y",
167 ">=LEFT_BORDER" => $arSection["LEFT_MARGIN"],
168 "<=RIGHT_BORDER" => $arSection["RIGHT_MARGIN"]
169 )
170 );
171 while ($arSectionTree = $dbSectionTree->Fetch())
172 {
173 $arIDs[] = intval($arSectionTree["ID"]);
174 }
175
176 return "(CDS.SECTION_ID ".(($negative == "Y") ? "NOT " : "")."IN (".implode(',',$arIDs)."))";
177 }
178
179 return false;
180 }
181
190 public static function GetList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
191 {
192 global $DB;
193
195 "ID" => array("FIELD" => "CD.ID", "TYPE" => "int"),
196 "XML_ID" => array("FIELD" => "CD.XML_ID", "TYPE" => "string"),
197 "SITE_ID" => array("FIELD" => "CD.SITE_ID", "TYPE" => "string"),
198 "TYPE" => array("FIELD" => "CD.TYPE", "TYPE" => "int"),
199 "ACTIVE" => array("FIELD" => "CD.ACTIVE", "TYPE" => "char"),
200 "ACTIVE_FROM" => array("FIELD" => "CD.ACTIVE_FROM", "TYPE" => "datetime"),
201 "ACTIVE_TO" => array("FIELD" => "CD.ACTIVE_TO", "TYPE" => "datetime"),
202 "RENEWAL" => array("FIELD" => "CD.RENEWAL", "TYPE" => "char"),
203 "NAME" => array("FIELD" => "CD.NAME", "TYPE" => "string"),
204 "MAX_USES" => array("FIELD" => "CD.MAX_USES", "TYPE" => "int"),
205 "COUNT_USES" => array("FIELD" => "CD.COUNT_USES", "TYPE" => "int"),
206 "SORT" => array("FIELD" => "CD.SORT", "TYPE" => "int"),
207 "MAX_DISCOUNT" => array("FIELD" => "CD.MAX_DISCOUNT", "TYPE" => "double"),
208 "VALUE_TYPE" => array("FIELD" => "CD.VALUE_TYPE", "TYPE" => "char"),
209 "VALUE" => array("FIELD" => "CD.VALUE", "TYPE" => "double"),
210 "CURRENCY" => array("FIELD" => "CD.CURRENCY", "TYPE" => "string"),
211 "MIN_ORDER_SUM" => array("FIELD" => "CD.MIN_ORDER_SUM", "TYPE" => "double"),
212 "TIMESTAMP_X" => array("FIELD" => "CD.TIMESTAMP_X", "TYPE" => "datetime"),
213 "MODIFIED_BY" => array("FIELD" => "CD.MODIFIED_BY", "TYPE" => "int"),
214 "DATE_CREATE" => array("FIELD" => "CD.DATE_CREATE", "TYPE" => "datetime"),
215 "CREATED_BY" => array("FIELD" => "CD.CREATED_BY", "TYPE" => "int"),
216 "NOTES" => array("FIELD" => "CD.NOTES", "TYPE" => "string"),
217 "PRIORITY" => array("FIELD" => "CD.PRIORITY", "TYPE" => "int"),
218 "LAST_DISCOUNT" => array("FIELD" => "CD.LAST_DISCOUNT", "TYPE" => "char"),
219 "VERSION" => array("FIELD" => "CD.VERSION", "TYPE" => "int"),
220 "CONDITIONS" => array("FIELD" => "CD.CONDITIONS", "TYPE" => "string"),
221 "UNPACK" => array("FIELD" => "CD.UNPACK", "TYPE" => "string"),
222 "SALE_ID" => array("FIELD" => "CD.SALE_ID", "TYPE" => "int"),
223 "USE_COUPONS" => array("FIELD" => "CD.USE_COUPONS", "TYPE" => "char"),
224
225 "PRODUCT_ID" => array("FIELD" => "CDP.PRODUCT_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_catalog_discount2product CDP ON (CD.ID = CDP.DISCOUNT_ID)"),
226 "SECTION_ID" => array("FIELD" => "CDS.SECTION_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_catalog_discount2section CDS ON (CD.ID = CDS.DISCOUNT_ID)", "WHERE" => array("CCatalogDiscount", "PrepareSection4Where")),
227 "SECTION_LIST" => array("FIELD" => "CDSL.SECTION_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_catalog_discount2section CDSL ON (CD.ID = CDSL.DISCOUNT_ID)"),
228 "IBLOCK_ID" => array("FIELD" => "CDI.IBLOCK_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_catalog_discount2iblock CDI ON (CD.ID = CDI.DISCOUNT_ID)"),
229 "GROUP_ID" => array("FIELD" => "CDC.USER_GROUP_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_catalog_discount_cond CDC ON (CD.ID = CDC.DISCOUNT_ID)"),
230 "USER_GROUP_ID" => array("FIELD" => "CDC.USER_GROUP_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_catalog_discount_cond CDC ON (CD.ID = CDC.DISCOUNT_ID)"),
231 "CATALOG_GROUP_ID" => array("FIELD" => "CDC.PRICE_TYPE_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_catalog_discount_cond CDC ON (CD.ID = CDC.DISCOUNT_ID)"),
232 "PRICE_TYPE_ID" => array("FIELD" => "CDC.PRICE_TYPE_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_catalog_discount_cond CDC ON (CD.ID = CDC.DISCOUNT_ID)"),
233
234 "COUPON" => array("FIELD" => "CDCP.COUPON", "TYPE" => "string", "FROM" => "LEFT JOIN b_catalog_discount_coupon CDCP ON (CD.ID = CDCP.DISCOUNT_ID)"),
235 "COUPON_ACTIVE" => array("FIELD" => "CDCP.ACTIVE", "TYPE" => "char", "FROM" => "LEFT JOIN b_catalog_discount_coupon CDCP ON (CD.ID = CDCP.DISCOUNT_ID)"),
236 "COUPON_ONE_TIME" => array("FIELD" => "CDCP.ONE_TIME", "TYPE" => "char", "FROM" => "LEFT JOIN b_catalog_discount_coupon CDCP ON (CD.ID = CDCP.DISCOUNT_ID)"),
237 );
238
239 if (!is_array($arFilter))
240 $arFilter = array();
241 if (!empty($arFilter))
242 {
243 $filterKeys = array_keys($arFilter);
244 foreach ($filterKeys as &$oneKey)
245 {
246 if (
247 preg_match('/^\!?\+.{0,2}(GROUP_ID|USER_GROUP_ID|CATALOG_GROUP_ID|PRICE_TYPE_ID)$/', $oneKey) == 1
248 )
249 {
250 if (is_array($arFilter[$oneKey]))
251 {
252 $arFilter[$oneKey][] = -1;
253 }
254 else
255 {
256 $arFilter[$oneKey] = array($arFilter[$oneKey], -1);
257 }
258 }
259 }
260 unset($oneKey, $filterKeys);
261 }
262 $arFilter['TYPE'] = self::ENTITY_ID;
263
264 $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
265
266 $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
267
268 if (empty($arGroupBy) && is_array($arGroupBy))
269 {
270 $strSql = "SELECT ".$arSqls["SELECT"]." FROM b_catalog_discount CD ".$arSqls["FROM"];
271 if (!empty($arSqls["WHERE"]))
272 $strSql .= " WHERE ".$arSqls["WHERE"];
273 if (!empty($arSqls["GROUPBY"]))
274 $strSql .= " GROUP BY ".$arSqls["GROUPBY"];
275
276 $dbRes = $DB->Query($strSql);
277 if ($arRes = $dbRes->Fetch())
278 return $arRes["CNT"];
279 else
280 return false;
281 }
282
283 $strSql = "SELECT ".$arSqls["SELECT"]." FROM b_catalog_discount CD ".$arSqls["FROM"];
284 if (!empty($arSqls["WHERE"]))
285 $strSql .= " WHERE ".$arSqls["WHERE"];
286 if (!empty($arSqls["GROUPBY"]))
287 $strSql .= " GROUP BY ".$arSqls["GROUPBY"];
288 if (!empty($arSqls["ORDERBY"]))
289 $strSql .= " ORDER BY ".$arSqls["ORDERBY"];
290
291 $intTopCount = 0;
292 $boolNavStartParams = (!empty($arNavStartParams) && is_array($arNavStartParams));
293 if ($boolNavStartParams && array_key_exists('nTopCount', $arNavStartParams))
294 {
295 $intTopCount = intval($arNavStartParams["nTopCount"]);
296 }
297 if ($boolNavStartParams && 0 >= $intTopCount)
298 {
299 $strSql_tmp = "SELECT COUNT('x') as CNT FROM b_catalog_discount CD ".$arSqls["FROM"];
300 if (!empty($arSqls["WHERE"]))
301 $strSql_tmp .= " WHERE ".$arSqls["WHERE"];
302 if (!empty($arSqls["GROUPBY"]))
303 $strSql_tmp .= " GROUP BY ".$arSqls["GROUPBY"];
304
305 $dbRes = $DB->Query($strSql_tmp);
306 $cnt = 0;
307 if (empty($arSqls["GROUPBY"]))
308 {
309 if ($arRes = $dbRes->Fetch())
310 $cnt = $arRes["CNT"];
311 }
312 else
313 {
314 $cnt = $dbRes->SelectedRowsCount();
315 }
316
317 $dbRes = new CDBResult();
318
319 $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
320 }
321 else
322 {
323 if ($boolNavStartParams && 0 < $intTopCount)
324 {
325 $strSql .= " LIMIT ".$intTopCount;
326 }
327 $dbRes = $DB->Query($strSql);
328 }
329
330 return $dbRes;
331 }
332
341 public static function GetDiscountGroupsList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
342 {
343 return self::__GetDiscountEntityList($arOrder, $arFilter, $arGroupBy, $arNavStartParams, $arSelectFields);
344 }
345
354 public static function GetDiscountCatsList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
355 {
356 return self::__GetDiscountEntityList($arOrder, $arFilter, $arGroupBy, $arNavStartParams, $arSelectFields);
357 }
358
369 public static function GetDiscountProductsList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
370 {
371 global $DB;
372
374 "ID" => array("FIELD" => "DG.ID", "TYPE" => "int"),
375 "DISCOUNT_ID" => array("FIELD" => "DG.DISCOUNT_ID", "TYPE" => "int"),
376 "PRODUCT_ID" => array("FIELD" => "DG.PRODUCT_ID", "TYPE" => "int")
377 );
378
379 $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
380
381 $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
382
383 if (empty($arGroupBy) && is_array($arGroupBy))
384 {
385 $strSql = "SELECT ".$arSqls["SELECT"]." FROM b_catalog_discount2product DG ".$arSqls["FROM"];
386 if (!empty($arSqls["WHERE"]))
387 $strSql .= " WHERE ".$arSqls["WHERE"];
388 if (!empty($arSqls["GROUPBY"]))
389 $strSql .= " GROUP BY ".$arSqls["GROUPBY"];
390
391 $dbRes = $DB->Query($strSql);
392 if ($arRes = $dbRes->Fetch())
393 return $arRes["CNT"];
394 else
395 return false;
396 }
397
398 $strSql = "SELECT ".$arSqls["SELECT"]." FROM b_catalog_discount2product DG ".$arSqls["FROM"];
399 if (!empty($arSqls["WHERE"]))
400 $strSql .= " WHERE ".$arSqls["WHERE"];
401 if (!empty($arSqls["GROUPBY"]))
402 $strSql .= " GROUP BY ".$arSqls["GROUPBY"];
403 if (!empty($arSqls["ORDERBY"]))
404 $strSql .= " ORDER BY ".$arSqls["ORDERBY"];
405
406 $intTopCount = 0;
407 $boolNavStartParams = (!empty($arNavStartParams) && is_array($arNavStartParams));
408 if ($boolNavStartParams && array_key_exists('nTopCount', $arNavStartParams))
409 {
410 $intTopCount = intval($arNavStartParams["nTopCount"]);
411 }
412 if ($boolNavStartParams && 0 >= $intTopCount)
413 {
414 $strSql_tmp = "SELECT COUNT('x') as CNT FROM b_catalog_discount2product DG ".$arSqls["FROM"];
415 if (!empty($arSqls["WHERE"]))
416 $strSql_tmp .= " WHERE ".$arSqls["WHERE"];
417 if (!empty($arSqls["GROUPBY"]))
418 $strSql_tmp .= " GROUP BY ".$arSqls["GROUPBY"];
419
420 $dbRes = $DB->Query($strSql_tmp);
421 $cnt = 0;
422 if (empty($arSqls["GROUPBY"]))
423 {
424 if ($arRes = $dbRes->Fetch())
425 $cnt = $arRes["CNT"];
426 }
427 else
428 {
429 $cnt = $dbRes->SelectedRowsCount();
430 }
431
432 $dbRes = new CDBResult();
433
434 $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
435 }
436 else
437 {
438 if ($boolNavStartParams && 0 < $intTopCount)
439 {
440 $strSql .= " LIMIT ".$intTopCount;
441 }
442 $dbRes = $DB->Query($strSql);
443 }
444
445 return $dbRes;
446 }
447
458 public static function GetDiscountSectionsList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
459 {
460 global $DB;
461
463 "ID" => array("FIELD" => "DG.ID", "TYPE" => "int"),
464 "DISCOUNT_ID" => array("FIELD" => "DG.DISCOUNT_ID", "TYPE" => "int"),
465 "SECTION_ID" => array("FIELD" => "DG.SECTION_ID", "TYPE" => "int")
466 );
467
468 $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
469
470 $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
471
472 if (empty($arGroupBy) && is_array($arGroupBy))
473 {
474 $strSql = "SELECT ".$arSqls["SELECT"]." FROM b_catalog_discount2section DG ".$arSqls["FROM"];
475 if (!empty($arSqls["WHERE"]))
476 $strSql .= " WHERE ".$arSqls["WHERE"];
477 if (!empty($arSqls["GROUPBY"]))
478 $strSql .= " GROUP BY ".$arSqls["GROUPBY"];
479
480 $dbRes = $DB->Query($strSql);
481 if ($arRes = $dbRes->Fetch())
482 return $arRes["CNT"];
483 else
484 return false;
485 }
486
487 $strSql = "SELECT ".$arSqls["SELECT"]." FROM b_catalog_discount2section DG ".$arSqls["FROM"];
488 if (!empty($arSqls["WHERE"]))
489 $strSql .= " WHERE ".$arSqls["WHERE"];
490 if (!empty($arSqls["GROUPBY"]))
491 $strSql .= " GROUP BY ".$arSqls["GROUPBY"];
492 if (!empty($arSqls["ORDERBY"]))
493 $strSql .= " ORDER BY ".$arSqls["ORDERBY"];
494
495 $intTopCount = 0;
496 $boolNavStartParams = (!empty($arNavStartParams) && is_array($arNavStartParams));
497 if ($boolNavStartParams && array_key_exists('nTopCount', $arNavStartParams))
498 {
499 $intTopCount = intval($arNavStartParams["nTopCount"]);
500 }
501 if ($boolNavStartParams && 0 >= $intTopCount)
502 {
503 $strSql_tmp = "SELECT COUNT('x') as CNT FROM b_catalog_discount2section DG ".$arSqls["FROM"];
504 if (!empty($arSqls["WHERE"]))
505 $strSql_tmp .= " WHERE ".$arSqls["WHERE"];
506 if (!empty($arSqls["GROUPBY"]))
507 $strSql_tmp .= " GROUP BY ".$arSqls["GROUPBY"];
508
509 $dbRes = $DB->Query($strSql_tmp);
510 $cnt = 0;
511 if (empty($arSqls["GROUPBY"]))
512 {
513 if ($arRes = $dbRes->Fetch())
514 $cnt = $arRes["CNT"];
515 }
516 else
517 {
518 $cnt = $dbRes->SelectedRowsCount();
519 }
520
521 $dbRes = new CDBResult();
522
523 $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
524 }
525 else
526 {
527 if ($boolNavStartParams && 0 < $intTopCount)
528 {
529 $strSql .= " LIMIT ".$intTopCount;
530 }
531 $dbRes = $DB->Query($strSql);
532 }
533
534 return $dbRes;
535 }
536
547 public static function GetDiscountIBlocksList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
548 {
549 global $DB;
550
552 "ID" => array("FIELD" => "DG.ID", "TYPE" => "int"),
553 "DISCOUNT_ID" => array("FIELD" => "DG.DISCOUNT_ID", "TYPE" => "int"),
554 "IBLOCK_ID" => array("FIELD" => "DG.IBLOCK_ID", "TYPE" => "int")
555 );
556
557 $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
558
559 $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
560
561 if (empty($arGroupBy) && is_array($arGroupBy))
562 {
563 $strSql = "SELECT ".$arSqls["SELECT"]." FROM b_catalog_discount2iblock DG ".$arSqls["FROM"];
564 if (!empty($arSqls["WHERE"]))
565 $strSql .= " WHERE ".$arSqls["WHERE"];
566 if (!empty($arSqls["GROUPBY"]))
567 $strSql .= " GROUP BY ".$arSqls["GROUPBY"];
568
569 $dbRes = $DB->Query($strSql);
570 if ($arRes = $dbRes->Fetch())
571 return $arRes["CNT"];
572 else
573 return false;
574 }
575
576 $strSql = "SELECT ".$arSqls["SELECT"]." FROM b_catalog_discount2iblock DG ".$arSqls["FROM"];
577 if (!empty($arSqls["WHERE"]))
578 $strSql .= " WHERE ".$arSqls["WHERE"];
579 if (!empty($arSqls["GROUPBY"]))
580 $strSql .= " GROUP BY ".$arSqls["GROUPBY"];
581 if (!empty($arSqls["ORDERBY"]))
582 $strSql .= " ORDER BY ".$arSqls["ORDERBY"];
583
584 $intTopCount = 0;
585 $boolNavStartParams = (!empty($arNavStartParams) && is_array($arNavStartParams));
586 if ($boolNavStartParams && array_key_exists('nTopCount', $arNavStartParams))
587 {
588 $intTopCount = intval($arNavStartParams["nTopCount"]);
589 }
590 if ($boolNavStartParams && 0 >= $intTopCount)
591 {
592 $strSql_tmp = "SELECT COUNT('x') as CNT FROM b_catalog_discount2iblock DG ".$arSqls["FROM"];
593 if (!empty($arSqls["WHERE"]))
594 $strSql_tmp .= " WHERE ".$arSqls["WHERE"];
595 if (!empty($arSqls["GROUPBY"]))
596 $strSql_tmp .= " GROUP BY ".$arSqls["GROUPBY"];
597
598 $dbRes = $DB->Query($strSql_tmp);
599 $cnt = 0;
600 if (empty($arSqls["GROUPBY"]))
601 {
602 if ($arRes = $dbRes->Fetch())
603 $cnt = $arRes["CNT"];
604 }
605 else
606 {
607 $cnt = $dbRes->SelectedRowsCount();
608 }
609
610 $dbRes = new CDBResult();
611
612 $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
613 }
614 else
615 {
616 if ($boolNavStartParams && 0 < $intTopCount)
617 {
618 $strSql .= " LIMIT ".$intTopCount;
619 }
620 $dbRes = $DB->Query($strSql);
621 }
622
623 return $dbRes;
624 }
625
634 protected static function __GetDiscountEntityList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
635 {
636 global $DB;
637
639 "ID" => array("FIELD" => "DC.ID", "TYPE" => "int"),
640 "DISCOUNT_ID" => array("FIELD" => "DC.DISCOUNT_ID", "TYPE" => "int"),
641 "CATALOG_GROUP_ID" => array("FIELD" => "DC.PRICE_TYPE_ID", "TYPE" => "int"),
642 "PRICE_TYPE_ID" => array("FIELD" => "DC.PRICE_TYPE_ID", "TYPE" => "int"),
643 "USER_GROUP_ID" => array("FIELD" => "DC.USER_GROUP_ID", "TYPE" => "int"),
644 "GROUP_ID" => array("FIELD" => "DC.USER_GROUP_ID", "TYPE" => "int"),
645 );
646
647 $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
648
649 $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
650
651 if (empty($arGroupBy) && is_array($arGroupBy))
652 {
653 $strSql = "SELECT ".$arSqls["SELECT"]." FROM b_catalog_discount_cond DC ".$arSqls["FROM"];
654 if (!empty($arSqls["WHERE"]))
655 $strSql .= " WHERE ".$arSqls["WHERE"];
656 if (!empty($arSqls["GROUPBY"]))
657 $strSql .= " GROUP BY ".$arSqls["GROUPBY"];
658
659 $dbRes = $DB->Query($strSql);
660 if ($arRes = $dbRes->Fetch())
661 return $arRes["CNT"];
662 else
663 return false;
664 }
665
666 $strSql = "SELECT ".$arSqls["SELECT"]." FROM b_catalog_discount_cond DC ".$arSqls["FROM"];
667 if (!empty($arSqls["WHERE"]))
668 $strSql .= " WHERE ".$arSqls["WHERE"];
669 if (!empty($arSqls["GROUPBY"]))
670 $strSql .= " GROUP BY ".$arSqls["GROUPBY"];
671 if (!empty($arSqls["ORDERBY"]))
672 $strSql .= " ORDER BY ".$arSqls["ORDERBY"];
673
674 $intTopCount = 0;
675 $boolNavStartParams = (!empty($arNavStartParams) && is_array($arNavStartParams));
676 if ($boolNavStartParams && array_key_exists('nTopCount', $arNavStartParams))
677 {
678 $intTopCount = intval($arNavStartParams["nTopCount"]);
679 }
680 if ($boolNavStartParams && 0 >= $intTopCount)
681 {
682 $strSql_tmp = "SELECT COUNT('x') as CNT FROM b_catalog_discount_cond DC ".$arSqls["FROM"];
683 if (!empty($arSqls["WHERE"]))
684 $strSql_tmp .= " WHERE ".$arSqls["WHERE"];
685 if (!empty($arSqls["GROUPBY"]))
686 $strSql_tmp .= " GROUP BY ".$arSqls["GROUPBY"];
687
688 $dbRes = $DB->Query($strSql_tmp);
689 $cnt = 0;
690 if (empty($arSqls["GROUPBY"]))
691 {
692 if ($arRes = $dbRes->Fetch())
693 $cnt = $arRes["CNT"];
694 }
695 else
696 {
697 $cnt = $dbRes->SelectedRowsCount();
698 }
699
700 $dbRes = new CDBResult();
701
702 $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
703 }
704 else
705 {
706 if ($boolNavStartParams && 0 < $intTopCount)
707 {
708 $strSql .= " LIMIT ".$intTopCount;
709 }
710 $dbRes = $DB->Query($strSql);
711 }
712
713 return $dbRes;
714 }
715
723 public static function SaveFilterOptions()
724 {
725 COption::SetOptionString("catalog", "do_use_discount_product", 'Y');
726
727 COption::SetOptionString("catalog", "do_use_discount_section", 'Y');
728
729 COption::SetOptionString("catalog", "do_use_discount_iblock", 'Y');
730
731 self::__SaveFilterForEntity(array('ENTITY_ID' => 'PRICE_TYPE_ID', 'OPTION_ID' => 'do_use_discount_cat_group'));
732 self::__SaveFilterForEntity(array('ENTITY_ID' => 'USER_GROUP_ID', 'OPTION_ID' => 'do_use_discount_group'));
733 }
734
741 protected static function __SaveFilterForEntity($arParams)
742 {
743 global $DB;
744
745 if (!is_array($arParams) || empty($arParams))
746 return;
747 $strFilter = 'N';
748 $arDiscList = array();
749 $strQuery = str_replace('#ENTITY_ID#', $arParams['ENTITY_ID'], "SELECT DISCOUNT_ID FROM b_catalog_discount_cond WHERE #ENTITY_ID# != -1");
750 $rsDiscounts = $DB->Query($strQuery);
751 while ($arDiscount = $rsDiscounts->Fetch())
752 {
753 $arDiscList[] = intval($arDiscount['DISCOUNT_ID']);
754 }
755 if (!empty($arDiscList))
756 {
757 $arDiscList = array_unique($arDiscList);
758 $strQuery = "SELECT 'x' FROM b_catalog_discount D WHERE ID IN (".implode(',', $arDiscList).") AND D.ACTIVE = 'Y' AND (D.ACTIVE_TO > ".$DB->CurrentTimeFunction()." OR D.ACTIVE_TO IS NULL) LIMIT 0, 1";
759 $rsDiscounts = $DB->Query($strQuery);
760 if ($arDiscount= $rsDiscounts->Fetch())
761 $strFilter = 'Y';
762 }
763 COption::SetOptionString("catalog", $arParams['OPTION_ID'], $strFilter);
764 }
765
766 protected static function __UpdateSubdiscount($intDiscountID, &$arConditions, $active = '')
767 {
768 global $DB;
769
770 $arMsg = array();
771 $boolResult = true;
772
773 $intDiscountID = (int)$intDiscountID;
774 if ($intDiscountID <= 0)
775 {
776 $arMsg[] = array('id' => 'ID', "text" => GetMessage('BT_MOD_CATALOG_DISC_ERR_DISCOUNT_ID_ABSENT'));
777 $boolResult = false;
778 }
779 if (empty($arConditions) || !is_array($arConditions))
780 {
781 $arMsg[] = array('id' => 'SUBDISCOUNT', "text" => GetMessage('BT_MOD_CATALOG_DISC_ERR_SUBDISCOUNT_ROWS_ABSENT'));
782 $boolResult = false;
783 }
784
785 $active = (string)$active;
786 if ($active !== 'Y' && $active !== 'N')
787 {
788 $strQuery = 'select ID, ACTIVE from b_catalog_discount where ID = '.$intDiscountID;
789 $rsActive = $DB->Query($strQuery);
790 if ($activeFromDatabase = $rsActive->Fetch())
791 {
792 $active = $activeFromDatabase['ACTIVE'];
793 }
794 else
795 {
796 $arMsg[] = array('id' => 'ID', "text" => GetMessage('BT_MOD_CATALOG_DISC_ERR_DISCOUNT_ID_ABSENT'));
797 $boolResult = false;
798 }
799 }
800
801 $arEmptyRow = array(
802 'DISCOUNT_ID' => $intDiscountID,
803 'ACTIVE' => $active,
804 'USER_GROUP_ID' => -1,
805 'PRICE_TYPE_ID' => -1,
806 );
807
808 if ($boolResult)
809 {
810 $strQuery = 'DELETE from b_catalog_discount_cond where DISCOUNT_ID = '.$intDiscountID;
811 $DB->Query($strQuery);
812
813 foreach ($arConditions as $arOneCondition)
814 {
815 $arRow = $arEmptyRow;
816 if (!empty($arOneCondition['EQUAL']) && is_array($arOneCondition['EQUAL']))
817 {
818 foreach ($arOneCondition['EQUAL'] as $strKey => $intOneEntity)
819 {
820 $arRow[$strKey] = $intOneEntity;
821 }
822 }
823 $arInsert = $DB->PrepareInsert("b_catalog_discount_cond", $arRow);
824 $strInserCond = "INSERT INTO b_catalog_discount_cond(".$arInsert[0].") VALUES(".$arInsert[1].")";
825 $DB->Query($strInserCond);
826 }
827 if (isset($arOneCondition))
828 unset($arOneCondition);
829 }
830
831 return $boolResult;
832 }
833
834 protected static function __GetDiscountID($arFilter)
835 {
836 global $DB;
837
838 $arResult = array();
839 $boolRest = array_key_exists('RESTRICTIONS', $arFilter);
840
842 "DISCOUNT_ID" => array("FIELD" => "DC.DISCOUNT_ID", "TYPE" => "int"),
843 "ACTIVE" => array("FIELD" => "DC.ACTIVE", "TYPE" => "char"),
844 "USER_GROUP_ID" => array("FIELD" => "DC.USER_GROUP_ID", "TYPE" => "int"),
845 "PRICE_TYPE_ID" => array("FIELD" => "DC.PRICE_TYPE_ID", "TYPE" => "int"),
846 );
847
848 if (!isset($arFilter['USER_GROUP_ID']))
849 $arFilter['USER_GROUP_ID'] = array();
850 elseif (!is_array($arFilter['USER_GROUP_ID']))
851 $arFilter['USER_GROUP_ID'] = array($arFilter['USER_GROUP_ID']);
852 if (!empty($arFilter['USER_GROUP_ID']))
853 {
854 if (!in_array(-1, $arFilter['USER_GROUP_ID']))
855 $arFilter['USER_GROUP_ID'][] = -1;
856 }
857 else
858 {
859 unset($arFilter['USER_GROUP_ID']);
860 }
861
862 if (!isset($arFilter['PRICE_TYPE_ID']))
863 $arFilter['PRICE_TYPE_ID'] = array();
864 elseif (!is_array($arFilter['PRICE_TYPE_ID']))
865 $arFilter['PRICE_TYPE_ID'] = array($arFilter['PRICE_TYPE_ID']);
866 if (!empty($arFilter['PRICE_TYPE_ID']))
867 {
868 if (!in_array(-1, $arFilter['PRICE_TYPE_ID']))
869 $arFilter['PRICE_TYPE_ID'][] = -1;
870 }
871 else
872 {
873 unset($arFilter['PRICE_TYPE_ID']);
874 }
875
876 $active = 'Y';
877 if (array_key_exists('ACTIVE', $arFilter))
878 {
879 if ($arFilter['ACTIVE'] === null)
880 $active = '';
881 elseif ($arFilter['ACTIVE'] == 'Y' || $arFilter['ACTIVE'] == 'N')
882 $active = $arFilter['ACTIVE'];
883 unset($arFilter['ACTIVE']);
884 }
885 if ($active != '')
886 $arFilter['ACTIVE'] = $active;
887
888 if (array_key_exists('DISCOUNT_ID', $arFilter))
889 unset($arFilter['DISCOUNT_ID']);
890
891 $arSelectFields = array('DISCOUNT_ID');
892 if ($boolRest)
893 {
894 $arSelectFields[] = 'USER_GROUP_ID';
895 $arSelectFields[] = 'PRICE_TYPE_ID';
896 unset($arFilter['RESTRICTIONS']);
897 }
898
899 $arSqls = CCatalog::PrepareSql($arFields, array('DISCOUNT_ID' => 'ASC'), $arFilter, false, $arSelectFields);
900
901 $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
902 if (empty($arSqls["WHERE"]))
903 $arSqls["WHERE"] = "1=1";
904
905 $strQuery = "SELECT ".$arSqls["SELECT"]." FROM b_catalog_discount_cond DC WHERE ".$arSqls["WHERE"];
906
907 $arDiscountID = array();
908 $rsDiscounts = $DB->Query($strQuery);
909 if ($boolRest)
910 {
911 $arRestrictions = array();
912 while ($arDiscount = $rsDiscounts->Fetch())
913 {
914 $arDiscount['DISCOUNT_ID'] = (int)$arDiscount['DISCOUNT_ID'];
915 $arDiscountID[$arDiscount['DISCOUNT_ID']] = true;
916 if (!isset($arRestrictions[$arDiscount['DISCOUNT_ID']]))
917 {
918 $arRestrictions[$arDiscount['DISCOUNT_ID']] = array(
919 'USER_GROUP' => array(),
920 'PRICE_TYPE' => array(),
921 );
922 }
923 $arDiscount['USER_GROUP_ID'] = (int)$arDiscount['USER_GROUP_ID'];
924 $arDiscount['PRICE_TYPE_ID'] = (int)$arDiscount['PRICE_TYPE_ID'];
925 $arRestrictions[$arDiscount['DISCOUNT_ID']]['USER_GROUP'][$arDiscount['USER_GROUP_ID']] = true;
926 $arRestrictions[$arDiscount['DISCOUNT_ID']]['PRICE_TYPE'][$arDiscount['PRICE_TYPE_ID']] = true;
927 }
928 if (!empty($arDiscountID))
929 {
930 $arDiscountID = array_keys($arDiscountID);
931 foreach ($arRestrictions as $intKey => $arOneRestrictions)
932 {
933 if (array_key_exists(-1, $arOneRestrictions['USER_GROUP']))
934 $arOneRestrictions['USER_GROUP'] = array();
935 if (array_key_exists(-1, $arOneRestrictions['PRICE_TYPE']))
936 $arOneRestrictions['PRICE_TYPE'] = array();
937 $arRestrictions[$intKey] = $arOneRestrictions;
938 }
939 }
941 'DISCOUNTS' => $arDiscountID,
942 'RESTRICTIONS' => $arRestrictions,
943 );
944 }
945 else
946 {
947 while ($arDiscount = $rsDiscounts->Fetch())
948 {
949 $arDiscount['DISCOUNT_ID'] = (int)$arDiscount['DISCOUNT_ID'];
950 $arDiscountID[$arDiscount['DISCOUNT_ID']] = true;
951 }
952 if (!empty($arDiscountID))
953 $arResult = array_keys($arDiscountID);
954 }
955 return $arResult;
956 }
957
958 protected static function __UpdateOldEntities($ID, &$arFields, $boolUpdate)
959 {
960 $ID = intval($ID);
961 if (0 >= $ID)
962 return;
964 array(
965 'ENTITY_ID' => 'IBLOCK_IDS',
966 'TABLE_ID' => 'b_catalog_discount2iblock',
967 'FIELD_ID' => 'IBLOCK_ID',
968 ),
969 $boolUpdate
970 );
972 array(
973 'ENTITY_ID' => 'SECTION_IDS',
974 'TABLE_ID' => 'b_catalog_discount2section',
975 'FIELD_ID' => 'SECTION_ID',
976 ),
977 $boolUpdate
978 );
980 array(
981 'ENTITY_ID' => 'PRODUCT_IDS',
982 'TABLE_ID' => 'b_catalog_discount2product',
983 'FIELD_ID' => 'PRODUCT_ID',
984 ),
985 $boolUpdate
986 );
987 }
988
989 protected static function __FillArrays($intDiscountID, &$arFields, $strEntityID)
990 {
991 $boolResult = false;
992 $intDiscountID = intval($intDiscountID);
993 if (0 >= $intDiscountID)
994 return $boolResult;
995 $strEntityID = trim(strval($strEntityID));
996 if (!empty($strEntityID) && ('GROUP_IDS' == $strEntityID || 'CATALOG_GROUP_IDS' == $strEntityID))
997 {
998 $boolCheck = false;
999 $strEntityResult = ('GROUP_IDS' == $strEntityID ? 'USER_GROUP_ID' : 'PRICE_TYPE_ID');
1000 $arValues = array();
1001 $rsDiscounts = self::__GetDiscountEntityList(
1002 array(),
1003 array('DISCOUNT_ID' => $intDiscountID),
1004 false,
1005 false,
1006 array('ID', 'DISCOUNT_ID', $strEntityResult)
1007 );
1008 while ($arDiscount = $rsDiscounts->Fetch())
1009 {
1010 $boolCheck = true;
1011 $intValue = intval($arDiscount[$strEntityResult]);
1012 if (0 < $intValue)
1013 $arValues[$intValue] = true;
1014 }
1015 if ($boolCheck)
1016 {
1017 $arFields[$strEntityID] = (!empty($arValues) ? array_keys($arValues) : array());
1018 $boolResult = true;
1019 }
1020 }
1021 return $boolResult;
1022 }
1023
1024 protected static function updateDiscountHandlers($discountID, $handlers, $update)
1025 {
1026 global $DB;
1027
1028 $discountID = (int)$discountID;
1029 if ($discountID <= 0 || empty($handlers) || !is_array($handlers))
1030 {
1031 return;
1032 }
1033 if (isset($handlers['MODULES']))
1034 {
1035 if ($update)
1036 {
1037 $sqlQuery = 'delete from b_catalog_discount_module where DISCOUNT_ID = '.$discountID;
1038 $DB->Query($sqlQuery);
1039 }
1040 if (!empty($handlers['MODULES']))
1041 {
1042 foreach ($handlers['MODULES'] as &$oneModuleID)
1043 {
1044 $fields = array(
1045 'DISCOUNT_ID' => $discountID,
1046 'MODULE_ID' => $oneModuleID
1047 );
1048 $insert = $DB->PrepareInsert('b_catalog_discount_module', $fields);
1049 $sqlQuery = "insert into b_catalog_discount_module(".$insert[0].") values(".$insert[1].")";
1050 $DB->Query($sqlQuery);
1051 }
1052 unset($oneModuleID);
1053 }
1054 }
1055 }
1056
1057 protected static function getDiscountHandlers($discountList)
1058 {
1059 global $DB;
1060
1061 $defaultRes = array(
1062 'MODULES' => array(),
1063 'EXT_FILES' => array()
1064 );
1065 $result = array();
1067 if (!empty($discountList))
1068 {
1069 $result = array_fill_keys($discountList, $defaultRes);
1070 $discountRows = array_chunk($discountList, 500);
1071 foreach ($discountRows as &$oneRow)
1072 {
1073 $sqlQuery = 'select * from b_catalog_discount_module where DISCOUNT_ID IN ('.implode(', ', $oneRow).')';
1074 $resQuery = $DB->Query($sqlQuery);
1075 while ($row = $resQuery->Fetch())
1076 {
1077 $row['DISCOUNT_ID'] = (int)$row['DISCOUNT_ID'];
1078 $result[$row['DISCOUNT_ID']]['MODULES'][] = $row['MODULE_ID'];
1079 }
1080 if (isset($row))
1081 unset($row);
1082 unset($resQuery, $sqlQuery);
1083 }
1084 unset($oneRow, $discountRows);
1085 }
1086
1087 return $result;
1088 }
1089}
$arParams
Определения access_dialog.php:21
$db_res
Определения options_user_settings.php:8
global $APPLICATION
Определения include.php:80
$arResult
Определения generate_coupon.php:16
static deleteByDiscount($discount)
Определения discountcoupon.php:284
static deleteByDiscount($discount)
Определения discountentity.php:162
static deleteByDiscount($discount)
Определения discountmodule.php:88
static deleteByDiscount($discount)
Определения discountrestriction.php:115
static normalizeArrayValuesByInt(&$map, $sorted=true)
Определения collection.php:150
Определения discount.php:17
static CheckFields($ACTION, &$arFields, $ID=0)
Определения discount.php:201
static __UpdateOldOneEntity($intID, &$arFields, $arParams, $boolUpdate)
Определения discount.php:3792
static PrepareSql(&$arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields)
Определения catalog.php:389
Определения discount.php:9
static SaveFilterOptions()
Определения discount.php:723
static GetDiscountProductsList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения discount.php:369
static GetDiscountIBlocksList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения discount.php:547
static __SaveFilterForEntity($arParams)
Определения discount.php:741
static _Add(&$arFields)
Определения discount.php:10
static __GetDiscountEntityList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения discount.php:634
static GetDiscountCatsList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения discount.php:354
static __UpdateSubdiscount($intDiscountID, &$arConditions, $active='')
Определения discount.php:766
static Delete($ID)
Определения discount.php:77
static GetDiscountSectionsList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения discount.php:458
static GetByID($ID)
Определения discount.php:113
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения discount.php:190
static GetDiscountGroupsList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения discount.php:341
static getDiscountHandlers($discountList)
Определения discount.php:1057
static PrepareSection4Where($val, $key, $operation, $negative, $field, $arField, $arFilter)
Определения discount.php:150
static _Update($ID, &$arFields)
Определения discount.php:30
static updateDiscountHandlers($discountID, $handlers, $update)
Определения discount.php:1024
static __GetDiscountID($arFilter)
Определения discount.php:834
static __UpdateOldEntities($ID, &$arFields, $boolUpdate)
Определения discount.php:958
static __FillArrays($intDiscountID, &$arFields, $strEntityID)
Определения discount.php:989
$arValues
Определения component_props.php:25
$arFields
Определения dblapprove.php:5
</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
$result
Определения get_property_values.php:14
if($ajaxMode) $ID
Определения get_user.php:27
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $DB
Определения cron_frame.php:29
ExecuteModuleEventEx($arEvent, $arParams=[])
Определения tools.php:5214
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
Определения tools.php:5177
GetMessage($name, $aReplace=null)
Определения tools.php:3397
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
$val
Определения options.php:1793
$arRes
Определения options.php:104
$arFilter
Определения user_search.php:106
$dbRes
Определения yandex_detail.php:168
$fields
Определения yandex_run.php:501