• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/shipment.php
  • Класс: BitrixSaleShipment
  • Вызов: Shipment::checkValueBeforeSet
protected function checkValueBeforeSet($name, $value)
{
	$result = parent::checkValueBeforeSet($name, $value);

	if ($name === "DELIVERY_ID")
	{
		if (intval($value) > 0 && !DeliveryServicesManager::isServiceExist($value))
		{
			$result->addError(
				new ResultError(
					Loc::getMessage('SALE_SHIPMENT_WRONG_DELIVERY_SERVICE'),
					'SALE_SHIPMENT_WRONG_DELIVERY_SERVICE'
				)
			);
		}
	}
	elseif ($name === 'ACCOUNT_NUMBER')
	{
		$dbRes = static::getList([
			'select' => ['ID'],
			'filter' => ['=ACCOUNT_NUMBER' => $value]
		]);

		if ($dbRes->fetch())
		{
			$result->addError(
				new ResultError(
					Loc::getMessage('SALE_SHIPMENT_ACCOUNT_NUMBER_EXISTS')
				)
			);
		}
	}

	return $result;
}