1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
orderprocessing.php
См. документацию.
1
<?php
2
namespace
Bitrix\Sale\Internals;
3
4
use Bitrix\Main;
5
use Bitrix\Main\Entity\DataManager;
6
use Bitrix\Main\Application;
7
24
class
OrderProcessingTable
extends
DataManager
25
{
26
protected
array
$orderProcessedCache
= [];
27
28
public
static
function
getTableName
(): string
29
{
30
return
"b_sale_order_processing"
;
31
}
32
33
public
static
function
getMap
():
array
34
{
35
return
[
36
'ORDER_ID'
=> [
37
'primary'
=>
true
,
38
'data_type'
=>
'integer'
,
39
],
40
'PRODUCTS_ADDED'
=> [
41
'data_type'
=>
'boolean'
,
42
'values'
=> [
'N'
,
'Y'
],
43
],
44
'PRODUCTS_REMOVED'
=> [
45
'data_type'
=>
'boolean'
,
46
'values'
=> [
'N'
,
'Y'
],
47
],
48
'ORDER'
=> [
49
'data_type'
=>
"Bitrix\\Sale\\OrderTable"
,
50
'reference'
=> [
'=this.ORDER_ID'
=>
'ref.ID'
],
51
],
52
];
53
}
54
62
public
static
function
hasAddedProducts
(
$orderId
= 0): bool
63
{
64
$orderId
= (int)
$orderId
;
65
$row = static::getRow([
66
'filter'
=> [
67
'=ORDER_ID'
=>
$orderId
,
68
],
69
]);
70
71
return
($row[
'PRODUCTS_ADDED'
] ??
null
) ===
'Y'
;
72
}
73
81
public
static
function
hasRemovedProducts
(
$orderId
= 0): bool
82
{
83
$orderId
= (int)
$orderId
;
84
$row = static::getRow([
85
'filter'
=> [
86
'=ORDER_ID'
=>
$orderId
,
87
],
88
]);
89
90
return
($row[
'PRODUCTS_REMOVED'
] ??
null
) ===
'Y'
;
91
}
92
100
public
static
function
markProductsAdded
(
$orderId
= 0): void
101
{
102
$orderId
= (int)
$orderId
;
103
if
(
$orderId
<= 0)
104
{
105
return
;
106
}
107
$row = static::getRow([
108
'filter'
=> [
109
'=ORDER_ID'
=>
$orderId
,
110
],
111
]);
112
if
($row)
113
{
114
static::update(
$orderId
, [
'PRODUCTS_ADDED'
=>
'Y'
]);
115
}
116
else
117
{
118
static::add([
119
'ORDER_ID'
=>
$orderId
,
120
'PRODUCTS_ADDED'
=>
'Y'
,
121
]);
122
}
123
}
124
132
public
static
function
markProductsAddedByList
(
array
$orderIds): void
133
{
134
Main\Type\Collection::normalizeArrayValuesByInt
($orderIds);
135
if
(empty($orderIds))
136
{
137
return
;
138
}
139
140
$connection
=
\Bitrix\Main\Application::getConnection
();
141
$sqlUpdate =
"UPDATE "
. static::getTableName() .
" SET PRODUCTS_ADDED = 'Y' WHERE ORDER_ID IN ("
.implode(
','
, $orderIds).
")"
;
142
$connection
->queryExecute($sqlUpdate);
143
}
144
152
public
static
function
markProductsRemoved
(
$orderId
= 0): void
153
{
154
$orderId
= (int)
$orderId
;
155
if
(
$orderId
<= 0)
156
{
157
return
;
158
}
159
$row = static::getRow([
160
'filter'
=> [
161
'=ORDER_ID'
=>
$orderId
,
162
],
163
]);
164
if
($row)
165
{
166
static::update(
$orderId
, [
'PRODUCTS_REMOVED'
=>
'Y'
]);
167
}
168
else
169
{
170
static::add([
171
'ORDER_ID'
=>
$orderId
,
172
'PRODUCTS_REMOVED'
=>
'Y'
,
173
]);
174
}
175
}
176
182
public
static
function
deleteByOrderId
(
$orderId
)
183
{
184
$orderId
= (int)
$orderId
;
185
if
(
$orderId
<= 0)
186
{
187
return
false
;
188
}
189
190
$con
=
\Bitrix\Main\Application::getConnection
();
191
$con
->queryExecute(
"DELETE FROM "
. static::getTableName() .
" WHERE ORDER_ID="
.
$orderId
);
192
193
return
true
;
194
}
195
200
public
static
function
clear
()
201
{
202
$connection
= Application::getConnection();
203
$sql =
"DELETE FROM "
. static::getTableName() .
"
204
WHERE ORDER_ID NOT IN (SELECT ID FROM b_sale_order)"
;
205
$connection
->queryExecute($sql);
206
}
207
}
$connection
$connection
Определения
actionsdefinitions.php:38
$con
$con
Определения
admin_tab.php:7
Bitrix\Main\Application\getConnection
static getConnection($name="")
Определения
application.php:638
Bitrix\Main\ORM\Data\DataManager
Определения
datamanager.php:35
Bitrix\Main\Type\Collection\normalizeArrayValuesByInt
static normalizeArrayValuesByInt(&$map, $sorted=true)
Определения
collection.php:150
Bitrix\Sale\Internals\OrderProcessingTable
Определения
orderprocessing.php:25
Bitrix\Sale\Internals\OrderProcessingTable\markProductsAddedByList
static markProductsAddedByList(array $orderIds)
Определения
orderprocessing.php:132
Bitrix\Sale\Internals\OrderProcessingTable\$orderProcessedCache
array $orderProcessedCache
Определения
orderprocessing.php:26
Bitrix\Sale\Internals\OrderProcessingTable\getMap
static getMap()
Определения
orderprocessing.php:33
Bitrix\Sale\Internals\OrderProcessingTable\hasRemovedProducts
static hasRemovedProducts($orderId=0)
Определения
orderprocessing.php:81
Bitrix\Sale\Internals\OrderProcessingTable\clear
static clear()
Определения
orderprocessing.php:200
Bitrix\Sale\Internals\OrderProcessingTable\deleteByOrderId
static deleteByOrderId($orderId)
Определения
orderprocessing.php:182
Bitrix\Sale\Internals\OrderProcessingTable\hasAddedProducts
static hasAddedProducts($orderId=0)
Определения
orderprocessing.php:62
Bitrix\Sale\Internals\OrderProcessingTable\markProductsAdded
static markProductsAdded($orderId=0)
Определения
orderprocessing.php:100
Bitrix\Sale\Internals\OrderProcessingTable\markProductsRemoved
static markProductsRemoved($orderId=0)
Определения
orderprocessing.php:152
Bitrix\Sale\Internals\OrderProcessingTable\getTableName
static getTableName()
Определения
orderprocessing.php:28
$orderId
$orderId
Определения
payment.php:5
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
modules
sale
lib
internals
orderprocessing.php
Создано системой
1.14.0