Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
returnstorebatchaction.php
1<?php
2
4
6use Bitrix\Catalog\EO_StoreDocumentElement;
11
16{
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}
static getList(array $parameters=array())