Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
unreservestoreproductaction.php
1<?php
2
4
10
12 Application::getDocumentRoot() .'/bitrix/modules/catalog/general/store_docs_type.php'
13);
14
19{
21
25 public function canExecute(): Result
26 {
27 $result = new Result();
28
29 $reservedQuantity = $this->getProductTotalReservedQuantity();
30 if ($reservedQuantity < $this->amount)
31 {
32 $message = Loc::getMessage("CATALOG_STORE_DOCS_ERR_WRONG_RESERVED_AMOUNT", [
33 '#PRODUCT#' => $this->getProductName(),
34 ]);
35 $result->addError(new Error($message));
36 return $result;
37 }
38
39 $reservedQuantity = $this->getStoreReservedQuantity();
40 if ($reservedQuantity < $this->amount)
41 {
42 $message = Loc::getMessage("CATALOG_STORE_DOCS_ERR_INSUFFICIENTLY_AMOUNT", [
43 '#PRODUCT#' => $this->getProductName(),
44 '#STORE#' => $this->getStoreName(),
45 ]);
46 $result->addError(new Error($message));
47 return $result;
48 }
49
50 return $result;
51 }
52
56 protected function getNewProductQuantity(): float
57 {
58 return $this->getProductTotalQuantity() + $this->amount;
59 }
60
64 protected function getNewProductReservedQuantity(): float
65 {
67 }
68
72 protected function getNewStoreReservedQuantity(): float
73 {
75 }
76}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29