Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
writeoffamountvalidator.php
1<?php
2
4
5use Bitrix\Catalog\Document\Action\ProductAndStoreInfo;
6use Bitrix\Catalog\EO_StoreDocumentElement;
10
15{
16 use ProductAndStoreInfo;
17
18 protected function checkStoreAmount(EO_StoreDocumentElement $storeDocumentElement = null): Result
19 {
20 $result = new Result();
21
22 if (empty($storeDocumentElement))
23 {
24 $result->addError(new Error(Loc::getMessage("CATALOG_STORE_EMPTY_DOC_ELEMENT")));
25
26 return $result;
27 }
28
29 if ($this->getStoreProductAmount() - $storeDocumentElement->getAmount() < 0)
30 {
31 $message = Loc::getMessage(
32 "CATALOG_STORE_DOCS_ERR_INSUFFICIENTLY_AMOUNT_EXT",
33 [
34 "#STORE#" => $this->getStoreName(),
35 "#PRODUCT#" => $this->getProductName(),
36 ]
37 );
38
39 $result->addError(new Error($message));
40 }
41
42 return $result;
43 }
44}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
checkStoreAmount(EO_StoreDocumentElement $storeDocumentElement=null)