• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/internals/orderdiscount.php
  • Класс: BitrixSaleInternalsOrderCouponsTable
  • Вызов: OrderCouponsTable::applyOrder
static function applyOrder($coupons, $order)
{
	$order = (int)$order;
	if ($order <= 0 || empty($coupons))
		return;
	if (!is_array($coupons))
		$coupons = array($coupons);
	MainTypeCollection::normalizeArrayValuesByInt($coupons, true);
	if (empty($coupons))
		return;
	$conn = MainApplication::getConnection();
	$helper = $conn->getSqlHelper();
	$conn->queryExecute(
		'update '.$helper->quote(self::getTableName()).
		' set '.$helper->quote('ORDER_ID').' = '.$order.' where '.
		$helper->quote('ID').' in ('.implode(',', $coupons).') and '.
		$helper->quote('ORDER_ID').' = 0'
	);
}