1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
generate_coupon.php
См. документацию.
1
<?
2
define(
"STOP_STATISTICS"
,
true
);
3
define(
"BX_SECURITY_SHOW_MESSAGE"
,
true
);
4
define(
'NO_AGENT_CHECK'
,
true
);
5
6
use
Bitrix\Main\Localization\Loc
;
7
use
Bitrix\Main\Loader
;
8
use
Bitrix\Sale\Internals
;
9
10
require(
$_SERVER
[
'DOCUMENT_ROOT'
].
'/bitrix/modules/main/include/prolog_admin_before.php'
);
11
12
Loc::loadMessages(__FILE__);
13
14
global
$USER
;
15
16
$result
=
array
(
17
'STATUS'
=>
'OK'
,
18
'MESSAGE'
=>
''
,
19
'COUPON'
=>
''
,
20
);
21
22
if
(
$result
[
'STATUS'
] ==
'OK'
)
23
{
24
if
(!isset(
$USER
) || !(
$USER
instanceof CUser))
25
{
26
$result
[
'STATUS'
] =
'ERROR'
;
27
$result
[
'MESSAGE'
] = Loc::getMessage(
'BX_SALE_TOOLS_GEN_CPN_ERR_USER'
);
28
}
29
elseif
(!
$USER
->IsAuthorized())
30
{
31
$result
[
'STATUS'
] =
'ERROR'
;
32
$result
[
'MESSAGE'
] = Loc::getMessage(
'BX_SALE_TOOLS_GEN_CPN_ERR_AUTH'
);
33
}
34
}
35
36
if
(
$result
[
'STATUS'
] ==
'OK'
)
37
{
38
if
(!
check_bitrix_sessid
())
39
{
40
$result
[
'STATUS'
] =
'ERROR'
;
41
$result
[
'MESSAGE'
] = Loc::getMessage(
'BX_SALE_TOOLS_GEN_CPN_ERR_SESSION'
);
42
}
43
}
44
45
if
(
$result
[
'STATUS'
] ==
'OK'
)
46
{
47
if
(!Loader::includeModule(
'sale'
))
48
{
49
$result
[
'STATUS'
] =
'ERROR'
;
50
$result
[
'MESSAGE'
] = Loc::getMessage(
'BX_SALE_TOOLS_GEN_CPN_ERR_MODULE'
);
51
}
52
}
53
54
if
(
$result
[
'STATUS'
] ==
'OK'
)
55
{
56
$result
[
'COUPON'
] = Internals\DiscountCouponTable::generateCoupon(
true
);
57
}
58
59
echo
CUtil::PhpToJSObject
(
$result
);
Bitrix\Main\Loader
Определения
loader.php:13
Bitrix\Main\Localization\Loc
Определения
loc.php:12
CUtil\PhpToJSObject
static PhpToJSObject($arData, $bWS=false, $bSkipTilda=false, $bExtType=false)
Определения
util.php:66
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$_SERVER
$_SERVER["DOCUMENT_ROOT"]
Определения
cron_frame.php:9
$USER
global $USER
Определения
csv_new_run.php:40
check_bitrix_sessid
check_bitrix_sessid($varname='sessid')
Определения
tools.php:4686
Bitrix\Sale\Internals
Определения
accountnumber.php:3
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
bitrix
modules
sale
tools
generate_coupon.php
Создано системой
1.14.0