Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
returnstorebatchaction.php
1
<?php
2
3
namespace
Bitrix\Catalog\Document\Action\Store
;
4
5
use
Bitrix\Catalog\Document\Action
;
6
use Bitrix\Catalog\EO_StoreDocumentElement;
7
use
Bitrix\Catalog\Product\Store\BatchManager
;
8
use
Bitrix\Catalog\Product\Store\DistributionStrategy\DeductDocument
;
9
use
Bitrix\Catalog\StoreDocumentElementTable
;
10
use
Bitrix\Main\Result
;
11
15
class
ReturnStoreBatchAction
implements
Action
16
{
17
use
WriteOffAmountValidator
;
18
19
protected
int
$productId
;
20
protected
?EO_StoreDocumentElement
$storeDocumentElement
;
21
public
function
__construct
(
int
$documentElementId)
22
{
23
$this->storeDocumentElement =
StoreDocumentElementTable::getList
([
24
'filter'
=> [
25
'=ID'
=> $documentElementId,
26
],
27
'select'
=> [
'*'
,
'DOCUMENT'
],
28
'limit'
=> 1
29
])
30
->fetchObject()
31
;
32
33
if
($this->storeDocumentElement)
34
{
35
$this->productId = $this->storeDocumentElement->getElementId();
36
}
37
}
38
42
public
function
canExecute
():
Result
43
{
44
return
new
Result
();
45
}
46
50
public
function
execute
():
Result
51
{
52
if
(!$this->storeDocumentElement)
53
{
54
return
new
Result
();
55
}
56
57
$distributor =
new
DeductDocument
(
58
new
BatchManager
($this->
getProductId
()),
59
$this->storeDocumentElement
60
);
61
62
return
$distributor->return();
63
}
64
}
Bitrix\Catalog\Document\Action\Store\ReturnStoreBatchAction
Definition
returnstorebatchaction.php:16
Bitrix\Catalog\Document\Action\Store\ReturnStoreBatchAction\$storeDocumentElement
EO_StoreDocumentElement $storeDocumentElement
Definition
returnstorebatchaction.php:20
Bitrix\Catalog\Document\Action\Store\ReturnStoreBatchAction\execute
execute()
Definition
returnstorebatchaction.php:50
Bitrix\Catalog\Document\Action\Store\ReturnStoreBatchAction\$productId
int $productId
Definition
returnstorebatchaction.php:19
Bitrix\Catalog\Document\Action\Store\ReturnStoreBatchAction\canExecute
canExecute()
Definition
returnstorebatchaction.php:42
Bitrix\Catalog\Document\Action\Store\ReturnStoreBatchAction\__construct
__construct(int $documentElementId)
Definition
returnstorebatchaction.php:21
Bitrix\Catalog\Product\Store\BatchManager
Definition
batchmanager.php:19
Bitrix\Catalog\Product\Store\DistributionStrategy\DeductDocument
Definition
deductdocument.php:17
Bitrix\Catalog\StoreDocumentElementTable
Definition
storedocumentelementtable.php:50
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Definition
datamanager.php:441
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\Result
Definition
result.php:14
Bitrix\Catalog\Document\Action
Definition
action.php:11
Bitrix\Catalog\Document\Action\Store
Definition
basestorequantityaction.php:3
Bitrix\Catalog\Document\Action\Store\WriteOffAmountValidator
trait WriteOffAmountValidator
Definition
writeoffamountvalidator.php:15
Bitrix\Catalog\Document\Action
Bitrix\Catalog\Document\Action\getProductId
getProductId()
Definition
productandstoreinfo.php:41
modules
catalog
lib
document
action
store
returnstorebatchaction.php
Создано системой
1.10.0