1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
writeoffstorebatchaction.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Catalog\Document\Action\Store;
4
5
use Bitrix\Catalog\EO_StoreDocumentElement;
6
use Bitrix\Catalog\Product\Store\BatchManager;
7
use Bitrix\Catalog\StoreDocumentElementTable;
8
use Bitrix\Main\Result;
9
use Bitrix\Catalog\Document\Action;
10
use Bitrix\Catalog\Product\Store\DistributionStrategy\DeductDocument;
11
15
class
WriteOffStoreBatchAction
implements
Action
16
{
17
use
WriteOffAmountValidator
;
18
private
?
EO_StoreDocumentElement
$storeDocumentElement;
19
private
int
$productId;
20
21
private
int
$storeId;
22
private
float
$amount;
23
public
function
__construct
(
24
int
$documentElementId,
25
int
$productId,
26
float
$amount,
27
)
28
{
29
$this->productId = $productId;
30
$this->amount = $amount;
31
32
$this->storeDocumentElement =
StoreDocumentElementTable::getList
([
33
'filter'
=> [
34
'=ID'
=> $documentElementId,
35
],
36
'limit'
=> 1
37
])
38
->fetchObject()
39
;
40
}
41
42
public
function
canExecute
():
Result
43
{
44
$this->productId = $this->storeDocumentElement->getElementId();
45
$this->storeId = $this->storeDocumentElement->getStoreFrom();
46
47
return
$this->
checkStoreAmount
($this->storeDocumentElement);
48
}
49
53
public
function
execute
():
Result
54
{
55
$distributor =
new
DeductDocument
(
56
new
BatchManager
($this->productId),
57
$this->storeDocumentElement
58
);
59
60
return
$distributor->writeOff($this->amount);
61
}
62
}
Bitrix\Catalog\Document\Action\Store\WriteOffStoreBatchAction
Определения
writeoffstorebatchaction.php:16
Bitrix\Catalog\Document\Action\Store\WriteOffStoreBatchAction\execute
execute()
Определения
writeoffstorebatchaction.php:53
Bitrix\Catalog\Document\Action\Store\WriteOffStoreBatchAction\canExecute
canExecute()
Определения
writeoffstorebatchaction.php:42
Bitrix\Catalog\Document\Action\Store\WriteOffStoreBatchAction\__construct
__construct(int $documentElementId, int $productId, float $amount,)
Определения
writeoffstorebatchaction.php:23
Bitrix\Catalog\EO_StoreDocumentElement
Определения
orm.php:6920
Bitrix\Catalog\Product\Store\BatchManager
Определения
batchmanager.php:19
Bitrix\Catalog\Product\Store\DistributionStrategy\DeductDocument
Определения
deductdocument.php:17
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Определения
datamanager.php:431
Bitrix\Main\ORM\Data\Result
Определения
result.php:16
Bitrix\Catalog\Document\Action\Store\WriteOffAmountValidator
trait WriteOffAmountValidator
Определения
writeoffamountvalidator.php:15
Bitrix\Catalog\Document\Action\Store\checkStoreAmount
checkStoreAmount(EO_StoreDocumentElement $storeDocumentElement=null)
Определения
writeoffamountvalidator.php:18
Bitrix\Catalog\Document\Action
bitrix
modules
catalog
lib
document
action
store
writeoffstorebatchaction.php
Создано системой
1.14.0