1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
discountrestriction.php
См. документацию.
1
<?php
2
namespace
Bitrix\Catalog;
3
4
use Bitrix\Main,
5
Bitrix\Main\Localization\Loc;
6
7
Loc::loadMessages(__FILE__);
8
36
37
class
DiscountRestrictionTable
extends
Main\Entity\DataManager
38
{
44
public
static
function
getTableName
()
45
{
46
return
'b_catalog_discount_cond'
;
47
}
48
54
public
static
function
getMap
()
55
{
56
return
array
(
57
'ID'
=>
new
Main
\
Entity
\
IntegerField
(
'ID'
,
array
(
58
'primary'
=>
true
,
59
'autocomplete'
=>
true
,
60
'title'
=> Loc::getMessage(
'DISCOUNT_RESTRICTIONS_ENTITY_ID_FIELD'
)
61
)),
62
'DISCOUNT_ID'
=>
new
Main
\
Entity
\
IntegerField
(
'DISCOUNT_ID'
,
array
(
63
'required'
=>
true
,
64
'title'
=> Loc::getMessage(
'DISCOUNT_RESTRICTIONS_ENTITY_DISCOUNT_ID_FIELD'
)
65
)),
66
'ACTIVE'
=>
new
Main
\
Entity
\
BooleanField
(
'ACTIVE'
,
array
(
67
'values'
=>
array
(
'N'
,
'Y'
),
68
'title'
=> Loc::getMessage(
'DISCOUNT_RESTRICTIONS_ENTITY_ACTIVE_FIELD'
)
69
)),
70
'USER_GROUP_ID'
=>
new
Main
\
Entity
\
IntegerField
(
'USER_GROUP_ID'
,
array
(
71
'required'
=>
true
,
72
'title'
=> Loc::getMessage(
'DISCOUNT_RESTRICTIONS_ENTITY_USER_GROUP_ID_FIELD'
)
73
)),
74
'PRICE_TYPE_ID'
=>
new
Main
\
Entity
\
IntegerField
(
'PRICE_TYPE_ID'
,
array
(
75
'required'
=>
true
,
76
'title'
=> Loc::getMessage(
'DISCOUNT_RESTRICTIONS_ENTITY_PRICE_TYPE_ID_FIELD'
)
77
)),
78
'DISCOUNT'
=>
new
Main
\
Entity
\ReferenceField(
79
'DISCOUNT'
,
80
'\Bitrix\Catalog\Discount'
,
81
array
(
'=this.DISCOUNT_ID'
=>
'ref.ID'
)
82
)
83
);
84
}
85
93
public
static
function
changeActiveByDiscount
(
$discount
, $active)
94
{
95
$discount
= (int)
$discount
;
96
$active = (string)$active;
97
if
(
$discount
<= 0 || ($active !=
'Y'
&& $active !=
'N'
))
98
return
;
99
$conn =
Main\Application::getConnection
();
100
$helper = $conn->getSqlHelper();
101
$conn->queryExecute(
102
'update '
.$helper->quote(self::getTableName()).
103
' set '
.$helper->quote(
'ACTIVE'
).
' = \''
.$active.
'\'
where
'.
104
$helper->quote('
DISCOUNT_ID
').'
=
'.$discount
105
);
106
unset($helper, $conn);
107
}
108
115
public static function deleteByDiscount($discount)
116
{
117
$discount = (int)$discount;
118
if ($discount <= 0)
119
return;
120
$conn = Main\Application::getConnection();
121
$helper = $conn->getSqlHelper();
122
$conn->queryExecute(
123
'
delete
from
'.$helper->quote(self::getTableName()).'
where
'.$helper->quote('
DISCOUNT_ID
').'
=
'.$discount
124
);
125
unset($helper, $conn);
126
}
127
}
Bitrix\Catalog\DiscountRestrictionTable
Определения
discountrestriction.php:38
Bitrix\Catalog\DiscountRestrictionTable\getMap
static getMap()
Определения
discountrestriction.php:54
Bitrix\Catalog\DiscountRestrictionTable\changeActiveByDiscount
static changeActiveByDiscount($discount, $active)
Определения
discountrestriction.php:93
Bitrix\Catalog\DiscountRestrictionTable\getTableName
static getTableName()
Определения
discountrestriction.php:44
Bitrix\Main\Application\getConnection
static getConnection($name="")
Определения
application.php:638
Bitrix\Main\ORM\Fields\BooleanField
Определения
booleanfield.php:20
Bitrix\Main\ORM\Fields\IntegerField
Определения
integerfield.php:20
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Main
$discount
$discount
Определения
waybill.php:788
bitrix
modules
catalog
lib
discountrestriction.php
Создано системой
1.14.0