• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/Access/Rule/StoreDocumentAllowNegationProductQuantityRule.php
  • Класс: BitrixCatalogAccessRuleStoreDocumentAllowNegationProductQuantityRule
  • Вызов: StoreDocumentAllowNegationProductQuantityRule::check
public function check($params): bool
{
	$item = $params['item'];

	if ($item instanceof StoreDocument)
	{
		$typesWithCheck = [
			StoreDocument::TYPE_DEDUCT,
			StoreDocument::TYPE_MOVING,
			StoreDocument::TYPE_SALES_ORDERS,
		];
		if (in_array($item->getType(), $typesWithCheck, true))
		{
			$permission = PermissionDictionary::getStoreDocumentPermissionId(
				PermissionDictionary::CATALOG_STORE_DOCUMENT_ALLOW_NEGATION_PRODUCT_QUANTITY,
				$item->getType()
			);

			return $this->checkPermission($permission);
		}

		// for other types, allows to go into the negative.
		return true;
	}

	return false;
}