Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
pool.php
1
<?php
2
namespace
Bitrix\Sale\Internals
;
3
4
use
Bitrix\Sale
;
5
6
class
Pool
7
{
9
protected
$quantities
= array();
10
12
protected
$items
= array();
13
14
public
function
__construct
()
15
{
16
}
17
24
public
function
get
($code)
25
{
26
if
(
27
isset($this->quantities[$code])
28
&& is_array($this->quantities[$code])
29
)
30
{
31
return
array_sum($this->quantities[$code]);
32
}
33
34
return
null
;
35
}
36
43
public
function
getByStore
($code, $storeId)
44
{
45
if
(isset($this->quantities[$code][$storeId]))
46
{
47
return
$this->quantities[$code][$storeId];
48
}
49
50
return
0;
51
}
52
57
public
function
set
($code, $quantity)
58
{
59
$storeId = Sale\Configuration::getDefaultStoreId();
60
61
if
(!isset($this->quantities[$code][$storeId]))
62
{
63
$this->quantities[$code][$storeId] = 0;
64
}
65
66
$this->quantities[$code][$storeId] = $quantity;
67
}
68
73
public
function
setByStore
($code, $storeId, $quantity)
74
{
75
if
(!isset($this->quantities[$code][$storeId]))
76
{
77
$this->quantities[$code][$storeId] = 0;
78
}
79
80
$this->quantities[$code][$storeId] = $quantity;
81
}
82
86
public
function
delete
($code)
87
{
88
if
(isset($this->quantities[$code]))
89
{
90
unset($this->quantities[$code]);
91
}
92
}
93
97
public
function
deleteByStore
($code, $storeId)
98
{
99
if
(isset($this->quantities[$code][$storeId]))
100
{
101
unset($this->quantities[$code][$storeId]);
102
}
103
}
104
109
public
function
addItem
($code, $item)
110
{
111
if
(!array_key_exists($code, $this->items))
112
{
113
$this->items[$code] = $item;
114
}
115
}
116
120
public
function
getQuantities
()
121
{
122
$result = [];
123
foreach
($this->quantities as $code => $item)
124
{
125
$result[$code] = array_sum($item);
126
}
127
128
return
$result;
129
}
130
134
public
function
getQuantitiesWithStore
()
135
{
136
return
$this->quantities;
137
}
138
142
public
function
getItems
()
143
{
144
return
$this->items;
145
}
146
}
Bitrix\Sale\Cashbox\Internals\Pool
Definition
pool.php:9
Bitrix\Sale\Internals\Pool\__construct
__construct()
Definition
pool.php:14
Bitrix\Sale\Internals\Pool\deleteByStore
deleteByStore($code, $storeId)
Definition
pool.php:97
Bitrix\Sale\Internals\Pool\getQuantities
getQuantities()
Definition
pool.php:120
Bitrix\Sale\Internals\Pool\getByStore
getByStore($code, $storeId)
Definition
pool.php:43
Bitrix\Sale\Internals\Pool\$quantities
$quantities
Definition
pool.php:9
Bitrix\Sale\Internals\Pool\addItem
addItem($code, $item)
Definition
pool.php:109
Bitrix\Sale\Internals\Pool\$items
$items
Definition
pool.php:12
Bitrix\Sale\Internals\Pool\setByStore
setByStore($code, $storeId, $quantity)
Definition
pool.php:73
Bitrix\Sale\Internals\Pool\getItems
getItems()
Definition
pool.php:142
Bitrix\Sale\Internals\Pool\getQuantitiesWithStore
getQuantitiesWithStore()
Definition
pool.php:134
Bitrix\Sale\Internals
Definition
accountnumber.php:3
Bitrix\Sale
modules
sale
lib
internals
pool.php
Создано системой
1.10.0