128 $result = static::getDocumentFields();
129 foreach (static::getElementFields() as $field =>
$description)
140 static::getDocumentCommonFields(),
141 static::getDocumentSpecificFields()
148 'ID' => [
'required' =>
'Y'],
149 'TITLE' => [
'required' =>
'N'],
150 'DOC_TYPE' => [
'required' =>
'Y'],
151 'SITE_ID' => [
'required' =>
'Y'],
152 'DATE_MODIFY' => [
'required' =>
'Y'],
153 'DATE_CREATE' => [
'required' =>
'Y'],
154 'CREATED_BY' => [
'required' =>
'Y'],
155 'MODIFIED_BY' => [
'required' =>
'Y'],
156 'STATUS' => [
'required' =>
'Y'],
157 'WAS_CANCELLED' => [
'required' =>
'Y'],
158 'DATE_STATUS' => [
'required' =>
'Y'],
159 'STATUS_BY' => [
'required' =>
'Y'],
160 'COMMENTARY' => [
'required' =>
'N'],
161 'RESPONSIBLE_ID' => [
'required' =>
'Y'],
187 $documentId = (int)$documentId;
193 $contractorId = (int)$contractorId;
194 if (!static::checkParamsForConduction($documentId,
$userId,
$currency, $contractorId))
199 $document = static::load($documentId, [
'CURRENCY' =>
$currency]);
200 if ($document ===
null || !static::checkConductDocument($document))
205 $actions = static::getDocumentActions(self::ACTION_CONDUCTION, $document,
$userId);
206 if (empty($actions) || !static::checkDocumentActions($actions))
211 return static::executeActions($actions);
224 $documentId = (int)$documentId;
227 if (!static::checkParamsForCancellation($documentId,
$userId))
232 $document = static::load($documentId);
233 if ($document ===
null || !static::checkCancellationDocument($document))
238 $actions = static::getDocumentActions(self::ACTION_CANCEL, $document,
$userId);
239 if (empty($actions) || !static::checkDocumentActions($actions))
244 return static::executeActions($actions);
278 if (!static::checkDocumentProducts(
$result))
286 if (!static::checkDocumentBarcodes(
$result))
292 if (!static::checkBarcodes(
$result))
314 '=ID' => $documentId,
315 '=DOC_TYPE' => static::getTypeId(),
324 'filter' => [
'=ID' => $documentId],
332 'CATALOG_STORE_DOCS_ERR_BAD_DOCUMENT_ID',
333 [
'#ID#' => $documentId]
341 'CATALOG_STORE_DOCS_ERR_BAD_DOCUMENT_TYPE_ID',
342 [
'#ID#' => $documentId]
356 $productList = &
$result[
'ELEMENTS'];
370 'filter' => [
'=DOC_ID' => $documentId],
375 $row[
'ID'] = (int)$row[
'ID'];
376 $row[
'ELEMENT_ID'] = (int)$row[
'ELEMENT_ID'];
377 $row[
'AMOUNT'] = (float)$row[
'AMOUNT'];
378 if ($row[
'STORE_TO'] !==
null)
380 $row[
'STORE_TO'] = (int)$row[
'STORE_TO'];
381 if ($row[
'STORE_TO'] <= 0)
383 $row[
'STORE_TO'] =
null;
386 if ($row[
'STORE_FROM'] !==
null)
388 $row[
'STORE_FROM'] = (int)$row[
'STORE_FROM'];
389 if ($row[
'STORE_FROM'] <= 0)
391 $row[
'STORE_FROM'] =
null;
395 $elementId = $row[
'ELEMENT_ID'];
398 if (!isset($productList[$elementId]))
400 $productList[$elementId] = [
401 'PRODUCT_ID' => $elementId,
404 'CURRENT_STORES' => [],
405 'CURRENT_BARCODES' => [],
411 'PRODUCT_ID' => $elementId,
412 'STORE_TO' => $row[
'STORE_TO'],
413 'STORE_FROM' => $row[
'STORE_FROM'],
414 'AMOUNT' => $row[
'AMOUNT'],
415 'PURCHASING_PRICE' => $row[
'PURCHASING_PRICE'],
417 'PURCHASING_INFO' => [
418 'PURCHASING_PRICE' => $row[
'PURCHASING_PRICE'],
423 if (isset($row[
'BASE_PRICE']))
425 $documentRow[
'BASE_PRICE_INFO'] = [
426 'BASE_PRICE' => (float)$row[
'BASE_PRICE'],
431 $productList[$elementId][
'POSITIONS'][$rowId] = $documentRow;
441 'CATALOG_STORE_DOCS_ERR_ABSENT_DOCUMENT_ELEMENTS',
442 [
'#ID#' => $documentId]
453 $productList = &$document[
'ELEMENTS'];
454 $elements = array_keys($productList);
456 foreach (array_chunk($elements, 500) as $pageIds)
469 'filter' => [
'@ID' => $pageIds]
473 $id = (int)$row[
'ID'];
474 $productList[$id][
'TYPE'] = (int)$row[
'TYPE'];
475 $productList[$id][
'OLD_QUANTITY'] = (float)$row[
'QUANTITY'];
476 $productList[$id][
'QUANTITY_TRACE'] = $row[
'QUANTITY_TRACE'];
477 $productList[$id][
'CAN_BUY_ZERO'] = $row[
'CAN_BUY_ZERO'];
478 $productList[$id][
'SUBSCRIBE'] = $row[
'SUBSCRIBE'];
479 $productList[$id][
'BARCODE_MULTI'] = $row[
'BARCODE_MULTI'];
481 $productList[$id][
'QUANTITY'] = (float)$row[
'QUANTITY'];
482 $productList[$id][
'QUANTITY_RESERVED'] = (float)$row[
'QUANTITY_RESERVED'];
484 $productList[$id][
'QUANTITY_LIMIT'] = ($row[
'QUANTITY_TRACE'] ===
'Y' && $row[
'CAN_BUY_ZERO'] ===
'N');
494 'filter' => [
'@ID' => $pageIds],
498 $id = (int)$row[
'ID'];
499 $productList[$id][
'IBLOCK_ID'] = (int)$row[
'IBLOCK_ID'];
500 $productList[$id][
'ELEMENT_NAME'] = $row[
'NAME'];
504 unset($pageIds, $elements);
515 foreach ($document[
'ELEMENTS'] as $productId =>
$data)
517 if (!isset(
$data[
'IBLOCK_ID']))
520 'CATALOG_STORE_DOCS_ERR_BAD_ELEMENT_ID',
521 [
'#ID#' => $productId]
526 '#ID#' => $productId,
527 '#NAME#' =>
$data[
'ELEMENT_NAME'],
529 if (!isset(
$data[
'TYPE']))
532 'CATALOG_STORE_DOCS_ERR_BAD_PRODUCT_ID',
543 'CATALOG_STORE_DOCS_ERR_BAD_PRODUCT_TYPE',
548 foreach (
$data[
'POSITIONS'] as $row)
550 if ($row[
'AMOUNT'] <= 0)
553 'CATALOG_STORE_DOCS_ERR_BAD_POSITION_AMOUNT',
571 $stores = static::getStoreList();
572 $activeStores = array_keys($stores[self::ACTIVE_STORES]);
573 if (empty($activeStores))
578 $productList = &$document[
'ELEMENTS'];
579 $elements = array_keys($productList);
581 foreach (array_chunk($elements, 500) as $pageIds)
592 '@PRODUCT_ID' => $pageIds,
593 '@STORE_ID' => $activeStores,
598 $row[
'ID'] = (int)$row[
'ID'];
599 $row[
'PRODUCT_ID'] = (int)$row[
'PRODUCT_ID'];
600 $row[
'STORE_ID'] = (int)$row[
'STORE_ID'];
601 $row[
'AMOUNT'] = (float)$row[
'AMOUNT'];
602 $row[
'QUANTITY_RESERVED'] = (float)$row[
'QUANTITY_RESERVED'];
604 $productId = $row[
'PRODUCT_ID'];
605 $storeId = $row[
'STORE_ID'];
607 $productList[$productId][
'CURRENT_STORES'][$storeId] = $row;
611 unset($pageIds, $elements);
620 $productList = &$document[
'ELEMENTS'];
623 foreach (array_keys($productList) as $elementId)
625 foreach (array_keys($productList[$elementId][
'POSITIONS']) as $rowId)
627 $elements[$rowId] = $elementId;
634 '=DOC_ID' => $document[
'ID'],
639 $row[
'ID'] = (int)$row[
'ID'];
641 $row[
'DOC_ELEMENT_ID'] = (int)$row[
'DOC_ELEMENT_ID'];
642 $documentRowId = $row[
'DOC_ELEMENT_ID'];
643 $elementId = $elements[$documentRowId];
645 $position = $productList[$elementId][
'POSITIONS'][$documentRowId];
647 $productList[$elementId][
'BARCODES'][$row[
'BARCODE']] = [
649 'DOCUMENT_ROW_ID' => $documentRowId,
650 'PRODUCT_ID' => $elementId,
651 'BARCODE' => $row[
'BARCODE'],
652 'STORE_FROM' => $position[
'STORE_FROM'],
653 'STORE_TO' => $position[
'STORE_TO'],
666 foreach ($document[
'ELEMENTS'] as
$data)
668 if (
$data[
'BARCODE_MULTI'] !==
'Y')
673 '#ID#' =>
$data[
'PRODUCT_ID'],
674 '#NAME#' =>
$data[
'ELEMENT_NAME'],
676 if (static::getProductCount(
$data[
'POSITIONS']) !==
count(
$data[
'BARCODES']))
679 'CATALOG_STORE_DOCS_ERR_BAD_BARCODE_COUNT',
684 foreach (array_keys(
$data[
'POSITIONS']) as $rowId)
686 if (
$data[
'POSITIONS'][$rowId][
'AMOUNT'] != static::getRowBarcodeCount($rowId,
$data[
'BARCODES']))
689 'CATALOG_STORE_DOCS_ERR_WRONG_POSITION_BARCODES_COUNT',
711 foreach ($document[
'ELEMENTS'] as $product)
713 foreach (array_keys($product[
'BARCODES']) as $barcode)
715 $result[$barcode] = $product[
'PRODUCT_ID'];
726 $list = static::getDocumentBarcodes($document);
732 $productList = &$document[
'ELEMENTS'];
734 foreach ($list as $barcode => $productId)
736 $productList[$productId][
'CURRENT_BARCODES'][$barcode] = [
738 'PRODUCT_ID' => $productId,
739 'BARCODE' => $barcode,
744 unset($barcode, $productId);
755 '@BARCODE' => array_keys($list),
760 $productId = $list[$row[
'BARCODE']];
761 $row[
'ID'] = (int)$row[
'ID'];
762 $row[
'PRODUCT_ID'] = (int)$row[
'PRODUCT_ID'];
763 $row[
'STORE_ID'] = (int)$row[
'STORE_ID'];
764 if ($row[
'STORE_ID'] <= 0)
766 $row[
'STORE_ID'] =
null;
768 $row[
'ORDER_ID'] = (int)$row[
'ORDER_ID'];
769 if ($row[
'ORDER_ID'] <= 0)
771 $row[
'ORDER_ID'] =
null;
773 $productList[$productId][
'CURRENT_BARCODES'][$row[
'BARCODE']] = $row;
786 foreach ($document[
'ELEMENTS'] as
$data)
788 foreach (
$data[
'CURRENT_BARCODES'] as $barcode)
790 if ($barcode[
'PRODUCT_ID'] !==
$data[
'PRODUCT_ID'])
793 'CATALOG_STORE_DOCS_ERR_WRONG_BARCODES_PRODUCT_ID',
795 '#ID#' =>
$data[
'PRODUCT_ID'],
796 '#NAME#' =>
$data[
'ELEMENT_NAME'],
797 '#BARCODE#' => $barcode[
'BARCODE'],
798 '#OTHER_ID#' => $barcode[
'PRODUCT_ID']
828 foreach ($barcodes as $row)
830 if ($row[
'DOCUMENT_ROW_ID'] === $rowId)
843 self::ALL_STORES => [],
844 self::DISABLED_STORES => [],
845 self::ACTIVE_STORES => [],
847 $iterator = Catalog\StoreTable::getList([
861 $id = (int)$row[
'ID'];
862 $result[self::ALL_STORES][$id] =
true;
863 if ($row[
'ACTIVE'] !==
'Y')
865 $result[self::DISABLED_STORES][$id] =
true;
869 $result[self::ACTIVE_STORES][$id] =
true;
880 self::ERR_STORE_ABSENT => [],
881 self::ERR_STORE_UNKNOWN => [],
882 self::ERR_STORE_DISABLED => [],
885 $storeList = static::getStoreList();
887 $storeField =
$options[
'STORE_FIELD'];
889 foreach ($document[
'ELEMENTS'] as $product)
891 $id = $product[
'PRODUCT_ID'];
892 $name = $product[
'ELEMENT_NAME'];
893 foreach ($product[
'POSITIONS'] as $position)
895 if (!isset($position[$storeField]))
897 $errorList[self::ERR_STORE_ABSENT][$id] =
$name;
900 $storeId = $position[$storeField];
901 if (!isset($storeList[self::ALL_STORES][$storeId]))
903 $errorList[self::ERR_STORE_UNKNOWN][$id] =
$name;
906 if (isset($storeList[self::DISABLED_STORES][$storeId]))
908 $errorList[self::ERR_STORE_DISABLED][$id] =
$name;
912 unset($position,
$name, $id);
917 !empty($errorList[self::ERR_STORE_ABSENT])
918 || !empty($errorList[self::ERR_STORE_UNKNOWN])
919 || !empty($errorList[self::ERR_STORE_DISABLED])
923 if (!empty($errorList[self::ERR_STORE_ABSENT]))
925 $list[] = static::getProductListError(
927 $errorList[self::ERR_STORE_ABSENT]
930 if (!empty($errorList[self::ERR_STORE_UNKNOWN]))
932 $list[] = static::getProductListError(
934 $errorList[self::ERR_STORE_UNKNOWN]
937 if (!empty($errorList[self::ERR_STORE_DISABLED]))
939 $list[] = static::getProductListError(
941 $errorList[self::ERR_STORE_DISABLED]
945 static::setErrors($list);
957 foreach ($products as $id =>
$name)
960 'CATALOG_STORE_DOCS_TPL_PDODUCT',
972 [
'#PRODUCTS#' => implode(
', ', $list)]
981 'ERR_DISABLED' => [],
990 'ERR_DISABLED' => [],
996 return static::checkDocumentStores(
998 [
'STORE_FIELD' =>
'STORE_TO'] + static::getStoreDestinationErrors()
1004 return static::checkDocumentStores(
1006 [
'STORE_FIELD' =>
'STORE_FROM'] + static::getStoreSourceErrors()
1019 $action !== self::ACTION_CONDUCTION
1020 &&
$action !== self::ACTION_CANCEL
1093 trigger_error(
"Wrong API usage of use inventory documents", E_USER_WARNING);
1098 private static function isExistPriceRanges(
int $productId,
int $basePriceId): bool
1100 return Catalog\PriceTable::getCount([
1101 '=PRODUCT_ID' => $productId,
1102 '=CATALOG_GROUP_ID' => $basePriceId,
1105 '!=QUANTITY_FROM' =>
null,
1106 '!=QUANTITY_TO' =>
null,
1127 $rsProps = CCatalogStoreBarCode::GetList(
array(),
array(
"BARCODE" => $barCode),
false,
false,
array(
'ID',
'STORE_ID',
'PRODUCT_ID'));
1130 if($storeFromId > 0)
1134 if($arBarCode[
"STORE_ID"] == $storeFromId && $arBarCode[
"PRODUCT_ID"] == $elementId)
1135 $newStore = $storeToId;
1139 $APPLICATION->ThrowException(
Loc::getMessage(
"CATALOG_STORE_DOCS_ERR_WRONG_STORE_BARCODE",
array(
"#STORE#" =>
'"'.$storeName.
'"',
"#PRODUCT#" =>
'"'.$arFields[
"ELEMENT_NAME"].
'"',
"#BARCODE#" =>
'"'.$barCode.
'"')));
1150 $result = CCatalogStoreBarCode::update($arBarCode[
"ID"],
array(
"STORE_ID" => $storeToId,
"MODIFIED_BY" =>
$userId));
1152 $result = CCatalogStoreBarCode::delete($arBarCode[
"ID"]);
1156 if($storeFromId > 0)
1159 $APPLICATION->ThrowException(
Loc::getMessage(
"CATALOG_STORE_DOCS_ERR_WRONG_STORE_BARCODE",
array(
"#STORE#" =>
'"'.$storeName.
'"',
"#PRODUCT#" =>
'"'.$arFields[
"ELEMENT_NAME"].
'"',
"#BARCODE#" =>
'"'.$barCode.
'"')));
1163 $result = CCatalogStoreBarCode::Add(
array(
"PRODUCT_ID" => $elementId,
"STORE_ID" => $storeToId,
"BARCODE" => $barCode,
"MODIFIED_BY" =>
$userId,
"CREATED_BY" =>
$userId));
1185 if(doubleval($arDocElement[
"AMOUNT"]) <= 0)
1189 $dbProduct = CIBlockElement::GetList(
1191 array(
"ID" => $arDocElement[
"ELEMENT_ID"]),
1196 if ($arProduct = $dbProduct->Fetch())
1198 $name = $arProduct[
'NAME'];
1202 $name = $arDocElement[
"ELEMENT_ID"];
1211 if ($documentId <= 0)
1224 if ($documentId <= 0)
1244 'DOC_NUMBER' => [
'required' =>
'N'],
1245 'DATE_DOCUMENT' => [
'required' =>
'N'],
1246 'ITEMS_ORDER_DATE' => [
'required' =>
'N'],
1247 'ITEMS_RECEIVED_DATE' => [
'required' =>
'N'],
1248 'DOCUMENT_FILES' => [
'required' =>
'N'],
1249 'CONTRACTOR_ID' => [
'required' =>
'Y'],
1250 'CURRENCY' => [
'required' =>
'Y'],
1251 'TOTAL' => [
'required' =>
'N'],
1263 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_ARRIVAL_AMOUNT'),
1264 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_ARRIVAL_AMOUNT'),
1268 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_PURCHASING_PRICE'),
1269 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_PURCHASING_PRICE'),
1273 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_PRICE'),
1274 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_PRICE'),
1278 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_STORE_TO'),
1279 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_STORE_TO'),
1283 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_BARCODE'),
1284 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_BARCODE'),
1288 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_TOTAL'),
1289 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_TOTAL'),
1301 if (!parent::checkParamsForConduction($documentId,
$userId,
$currency, $contractorId))
1306 if (Manager::getActiveProvider(Manager::PROVIDER_STORE_DOCUMENT))
1308 $contractor = Manager::getActiveProvider(Manager::PROVIDER_STORE_DOCUMENT)::getContractorByDocumentId($documentId);
1309 $isContractorSpecified = !is_null($contractor);
1313 $isContractorSpecified = $contractorId > 0;
1316 if (!$isContractorSpecified)
1332 $actions = parent::getDocumentActions(
$action, $document,
$userId);
1333 if ($actions ===
null)
1338 $isBatchMetodSelected = State::isProductBatchMethodSelected();
1340 $elements = $document[
'ELEMENTS'] ?? [];
1341 foreach ($elements as $productId => $element)
1346 if (
$action === self::ACTION_CONDUCTION)
1350 $item[
'PRODUCT_ID'],
1354 if ($isBatchMetodSelected)
1358 $item[
'PRODUCT_ID'],
1361 $item[
'PURCHASING_PRICE'] ??
null,
1362 $item[
'PURCHASING_CURRENCY'] ??
null,
1367 $item[
'PRODUCT_ID'],
1368 $item[
'PURCHASING_PRICE'] ??
null,
1369 $item[
'PURCHASING_CURRENCY'] ??
null,
1370 $item[
'BASE_PRICE_INFO'][
'BASE_PRICE'] ??
null,
1371 $item[
'BASE_PRICE_INFO'][
'BASE_PRICE_CURRENCY'] ??
null,
1376 if (State::isProductBatchMethodSelected())
1383 $item[
'PRODUCT_ID'],
1385 $document[
'DOC_TYPE'],
1390 $barcodes = (
array)($element[
'BARCODES'] ?? []);
1391 foreach ($barcodes as $item)
1393 $storeId = $item[
'STORE_TO'];
1396 $rowId = $item[
'DOCUMENT_ROW_ID'];
1397 $storeId =
$positions[$rowId][
'STORE_TO'] ??
null;
1400 if ($element[
'BARCODE_MULTI'] ===
'N')
1405 if (
$action === self::ACTION_CONDUCTION)
1416 if ($element[
'BARCODE_MULTI'] ===
'Y')
1434 if (!parent::checkConductDocument($document))
1439 if (!static::checkStoreDestination($document))
1449 if (!parent::checkCancellationDocument($document))
1454 if (!static::checkStoreDestination($document))
1466 'CATALOG_STORE_DOCS_ERR_ARRIVAL_STORE_DESTINATION_IS_ABSENT_PRODUCT',
1467 'CATALOG_STORE_DOCS_ERR_ARRIVAL_STORE_DESTINATION_IS_ABSENT_PRODUCT_LIST_EXT',
1470 'CATALOG_STORE_DOCS_ERR_ARRIVAL_STORE_DESTINATION_IS_UNKNOWN_PRODUCT',
1471 'CATALOG_STORE_DOCS_ERR_ARRIVAL_STORE_DESTINATION_IS_UNKNOWN_PRODUCT_LIST',
1474 'CATALOG_STORE_DOCS_ERR_ARRIVAL_STORE_DESTINATION_IS_DISABLE_PRODUCT',
1475 'CATALOG_STORE_DOCS_ERR_ARRIVAL_STORE_DESTINATION_IS_DISABLE_PRODUCT_LIST',
1489 'CURRENCY' => [
'required' =>
'Y'],
1490 'TOTAL' => [
'required' =>
'N'],
1502 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_ARRIVAL_AMOUNT'),
1503 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_ARRIVAL_AMOUNT'),
1507 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_PURCHASING_PRICE'),
1508 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_PURCHASING_PRICE'),
1512 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_PRICE'),
1513 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_PRICE'),
1517 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_STORE_TO'),
1518 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_STORE_TO'),
1522 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_BARCODE'),
1523 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_BARCODE'),
1527 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_TOTAL'),
1528 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_TOTAL'),
1552 'CATALOG_STORE_DOCS_ERR_ADJUSTMENT_STORE_DESTINATION_IS_ABSENT_PRODUCT',
1553 'CATALOG_STORE_DOCS_ERR_ADJUSTMENT_STORE_DESTINATION_IS_ABSENT_PRODUCT_LIST_EXT',
1556 'CATALOG_STORE_DOCS_ERR_ADJUSTMENT_STORE_DESTINATION_IS_UNKNOWN_PRODUCT',
1557 'CATALOG_STORE_DOCS_ERR_ADJUSTMENT_STORE_DESTINATION_IS_UNKNOWN_PRODUCT_LIST',
1560 'CATALOG_STORE_DOCS_ERR_ADJUSTMENT_STORE_DESTINATION_IS_DISABLE_PRODUCT',
1561 'CATALOG_STORE_DOCS_ERR_ADJUSTMENT_STORE_DESTINATION_IS_DISABLE_PRODUCT_LIST',
1572 'DOC_NUMBER' => [
'required' =>
'N'],
1573 'DATE_DOCUMENT' => [
'required' =>
'N'],
1585 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_AMOUNT'),
1586 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_AMOUNT'),
1590 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_MOVING_STORE_TO'),
1591 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_MOVING_STORE_TO'),
1595 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_BARCODE'),
1596 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_BARCODE'),
1600 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_MOVING_STORE_FROM'),
1601 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_MOVING_STORE_FROM'),
1616 $actions = parent::getDocumentActions(
$action, $document,
$userId);
1617 if ($actions ===
null)
1622 $elements = $document[
'ELEMENTS'] ?? [];
1623 foreach ($elements as $productId => $element)
1628 if (
$action === self::ACTION_CONDUCTION)
1630 if (State::isProductBatchMethodSelected())
1633 $item[
'STORE_FROM'],
1635 $item[
'PRODUCT_ID'],
1642 $item[
'STORE_FROM'],
1643 $item[
'PRODUCT_ID'],
1645 $document[
'DOC_TYPE']
1649 $item[
'PRODUCT_ID'],
1655 if (State::isProductBatchMethodSelected())
1662 $item[
'STORE_FROM'],
1663 $item[
'PRODUCT_ID'],
1668 $item[
'PRODUCT_ID'],
1670 $document[
'DOC_TYPE']
1675 $barcodes = (
array)($element[
'BARCODES'] ?? []);
1676 foreach ($barcodes as $item)
1678 if (
$action === self::ACTION_CONDUCTION)
1680 if ($element[
'BARCODE_MULTI'] ===
'N')
1686 $storeId = $item[
'STORE_TO'];
1689 $rowId = $item[
'DOCUMENT_ROW_ID'];
1690 $storeId =
$positions[$rowId][
'STORE_TO'] ??
null;
1703 if ($element[
'BARCODE_MULTI'] ===
'N')
1709 $storeId = $item[
'STORE_FROM'];
1712 $rowId = $item[
'DOCUMENT_ROW_ID'];
1713 $storeId =
$positions[$rowId][
'STORE_FROM'] ??
null;
1732 if (!parent::checkConductDocument($document))
1737 if (!static::checkStoreSource($document))
1742 if (!static::checkStoreDestination($document))
1748 $elements = (
array)($document[
'ELEMENTS'] ?? []);
1749 foreach ($elements as $element)
1754 if ((
int)$position[
'STORE_TO'] === (
int)$position[
'STORE_FROM'])
1769 if (!parent::checkConductDocument($document))
1774 if (!static::checkStoreSource($document))
1779 if (!static::checkStoreDestination($document))
1791 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_DESTINATION_IS_ABSENT_PRODUCT',
1792 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_DESTINATION_IS_ABSENT_PRODUCT_LIST_EXT',
1795 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_DESTINATION_IS_UNKNOWN_PRODUCT',
1796 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_DESTINATION_IS_UNKNOWN_PRODUCT_LIST',
1799 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_DESTINATION_IS_DISABLE_PRODUCT',
1800 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_DESTINATION_IS_DISABLE_PRODUCT_LIST',
1809 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_FROM_IS_ABSENT_PRODUCT',
1810 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_FROM_IS_ABSENT_PRODUCT_LIST',
1813 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_FROM_IS_UNKNOWN_PRODUCT',
1814 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_FROM_IS_UNKNOWN_PRODUCT_LIST',
1817 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_FROM_IS_DISABLE_PRODUCT',
1818 'CATALOG_STORE_DOCS_ERR_MOVING_STORE_FROM_IS_DISABLE_PRODUCT_LIST',
1834 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_AMOUNT'),
1835 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_AMOUNT'),
1839 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_STORE_TO'),
1840 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_STORE_TO'),
1844 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_BARCODE'),
1845 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_BARCODE'),
1860 $actions = parent::getDocumentActions(
$action, $document,
$userId);
1861 if ($actions ===
null)
1866 $elements = $document[
'ELEMENTS'] ?? [];
1867 foreach ($elements as $productId => $element)
1872 if (
$action === self::ACTION_CONDUCTION)
1876 $item[
'PRODUCT_ID'],
1879 if (State::isProductBatchMethodSelected())
1883 $item[
'PRODUCT_ID'],
1886 $item[
'PURCHASING_PRICE'],
1887 $item[
'PURCHASING_CURRENCY'],
1893 if (State::isProductBatchMethodSelected())
1900 $item[
'PRODUCT_ID'],
1902 $document[
'DOC_TYPE']
1907 $barcodes = (
array)($element[
'BARCODES'] ?? []);
1908 foreach ($barcodes as $item)
1910 $storeId = $item[
'STORE_TO'];
1913 $rowId = $item[
'DOCUMENT_ROW_ID'];
1914 $storeId =
$positions[$rowId][
'STORE_TO'] ??
null;
1917 if ($element[
'BARCODE_MULTI'] ===
'N')
1922 if (
$action === self::ACTION_CONDUCTION)
1948 if (!parent::checkConductDocument($document))
1953 if (!static::checkStoreDestination($document))
1963 if (!parent::checkConductDocument($document))
1968 if (!static::checkStoreDestination($document))
1980 'CATALOG_STORE_DOCS_ERR_RETURNS_STORE_DESTINATION_IS_ABSENT_PRODUCT',
1981 'CATALOG_STORE_DOCS_ERR_RETURNS_STORE_DESTINATION_IS_ABSENT_PRODUCT_LIST_EXT',
1984 'CATALOG_STORE_DOCS_ERR_RETURNS_STORE_DESTINATION_IS_UNKNOWN_PRODUCT',
1985 'CATALOG_STORE_DOCS_ERR_RETURNS_STORE_DESTINATION_IS_UNKNOWN_PRODUCT_LIST',
1988 'CATALOG_STORE_DOCS_ERR_RETURNS_STORE_DESTINATION_IS_DISABLE_PRODUCT',
1989 'CATALOG_STORE_DOCS_ERR_RETURNS_STORE_DESTINATION_IS_DISABLE_PRODUCT_LIST',
2000 'DOC_NUMBER' => [
'required' =>
'N'],
2001 'DATE_DOCUMENT' => [
'required' =>
'N'],
2013 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_AMOUNT'),
2014 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_AMOUNT'),
2018 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_BARCODE'),
2019 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_BARCODE'),
2023 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_DEDUCT_STORE_FROM'),
2024 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_DEDUCT_STORE_FROM'),
2039 $actions = parent::getDocumentActions(
$action, $document,
$userId);
2040 if ($actions ===
null)
2045 $elements = $document[
'ELEMENTS'] ?? [];
2046 foreach ($elements as $productId => $element)
2051 if (
$action === self::ACTION_CONDUCTION)
2053 if (State::isProductBatchMethodSelected())
2057 $item[
'PRODUCT_ID'],
2062 $item[
'STORE_FROM'],
2063 $item[
'PRODUCT_ID'],
2065 $document[
'DOC_TYPE']
2071 $item[
'STORE_FROM'],
2072 $item[
'PRODUCT_ID'],
2075 if (State::isProductBatchMethodSelected())
2082 $barcodes = (
array)($element[
'BARCODES'] ?? []);
2083 foreach ($barcodes as $item)
2085 $storeId = $item[
'STORE_TO'];
2088 $rowId = $item[
'DOCUMENT_ROW_ID'];
2089 $storeId =
$positions[$rowId][
'STORE_TO'] ??
null;
2092 if ($element[
'BARCODE_MULTI'] ===
'N')
2097 if (
$action === self::ACTION_CONDUCTION)
2123 if (!parent::checkConductDocument($document))
2128 if (!static::checkStoreSource($document))
2138 if (!parent::checkConductDocument($document))
2143 if (!static::checkStoreSource($document))
2155 'CATALOG_STORE_DOCS_ERR_DEDUCT_STORE_SOURCE_IS_ABSENT_PRODUCT',
2156 'CATALOG_STORE_DOCS_ERR_DEDUCT_STORE_SOURCE_IS_ABSENT_PRODUCT_LIST_EXT',
2159 'CATALOG_STORE_DOCS_ERR_DEDUCT_STORE_SOURCE_IS_UNKNOWN_PRODUCT',
2160 'CATALOG_STORE_DOCS_ERR_DEDUCT_STORE_SOURCE_IS_UNKNOWN_PRODUCT_LIST',
2163 'CATALOG_STORE_DOCS_ERR_DEDUCT_STORE_SOURCE_IS_DISABLE_PRODUCT',
2164 'CATALOG_STORE_DOCS_ERR_DEDUCT_STORE_SOURCE_IS_DISABLE_PRODUCT_LIST',
2180 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_AMOUNT'),
2181 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_AMOUNT'),
2185 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_RESERVED'),
2186 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_COMMON_RESERVED'),
2190 'name' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_UNRESERVED_STORE_FROM'),
2191 'title' =>
Loc::getMessage(
'CATALOG_STORE_DOCS_ELEMENT_FIELD_UNRESERVED_STORE_FROM'),
2206 $actions = parent::getDocumentActions(
$action, $document,
$userId);
2207 if ($actions ===
null)
2212 $elements = $document[
'ELEMENTS'] ?? [];
2213 foreach ($elements as $productId => $element)
2218 if (
$action === self::ACTION_CONDUCTION)
2221 $item[
'STORE_FROM'],
2222 $item[
'PRODUCT_ID'],
2229 $item[
'STORE_FROM'],
2230 $item[
'PRODUCT_ID'],
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static getList(array $parameters)
const TYPE_STORE_ADJUSTMENT
static getMessage($code, $replace=null, $language=null)
static getList(array $parameters=array())
static checkCancellationDocument(array $document)
static checkConductDocument(array $document)
static getDocumentActions(string $action, array $document, int $userId)
static checkParamsForConduction(int $documentId, int $userId, ?string $currency, int $contractorId)
static getElementFields()
static getDocumentSpecificFields()
static getStoreDestinationErrors()
static checkCancellationDocument(array $document)
static getStoreSourceErrors()
static checkConductDocument(array $document)
static getDocumentActions(string $action, array $document, int $userId)
static getElementFields()
static getDocumentSpecificFields()
static checkCancellationDocument(array $document)
static executeActions(array $actions)
static getStoreSourceErrors()
static checkStoreSource(array $document)
static getDocumentCommonFields()
static checkStoreDestination(array $document)
static checkTotalAmount($elementId, $name='')
static loadDocument(int $documentId, array $options=[])
static getRowBarcodeCount(int $rowId, array $barcodes)
const TYPE_STORE_ADJUSTMENT
static checkConductDocument(array $document)
static getProductCount(array $positions)
static getDocumentActions(string $action, array $document, int $userId)
static checkParamsForConduction(int $documentId, int $userId, ?string $currency, int $contractorId)
static conductDocument($documentId, $userId, $currency, $contractorId)
static applyBarCode($arFields, $userId)
static getElementFields()
static checkDocumentBarcodes(array $document)
static loadProductStores(array $document)
static loadDocumentBarcodes(array $document)
static getDocumentBarcodes(array $document)
static checkDocumentProducts(array $document)
static getDocumentSpecificFields()
static loadBarcodes(array $document)
static distributeElementsToStores($arFields, $userId)
static checkBarcodes(array $document)
static load(int $documentId, array $options=[])
static setErrors(array $errors)
static loadProducts(array $document)
static getStoreDestinationErrors()
static checkParamsForCancellation(int $documentId, int $userId)
static cancellationDocument($documentId, $userId)
static checkAmountField($arDocElement, $name='')
static checkDocumentStores(array $document, array $options)
static getDocumentFields()
static checkDocumentActions(array $actions)
static getProductListError(array $errors, array $products)
static checkCancellationDocument(array $document)
static getStoreSourceErrors()
static checkConductDocument(array $document)
static getDocumentActions(string $action, array $document, int $userId)
static getElementFields()
static getDocumentSpecificFields()
static getStoreDestinationErrors()
static checkCancellationDocument(array $document)
static checkConductDocument(array $document)
static getDocumentActions(string $action, array $document, int $userId)
static getElementFields()
static getStoreDestinationErrors()
static checkParamsForConduction(int $documentId, int $userId, ?string $currency, int $contractorId)
static getElementFields()
static getDocumentSpecificFields()
static getStoreDestinationErrors()
static getStoreName($storeId)
static getDocumentActions(string $action, array $document, int $userId)
static getElementFields()
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(Loader::includeModule( 'bitrix24')) elseif(Loader::includeModule('intranet') &&CIntranetUtils::getPortalZone() !=='ru') $description
if(!function_exists("bx_hmac")) $amount
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"