• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/invoice/internals/invoicediscount.php
  • Класс: Bitrix\Crm\Invoice\Internals\InvoiceCouponsTable
  • Вызов: InvoiceCouponsTable::clearList
static function clearList($coupon)
{
	if (!is_array($coupon))
		$coupon = array($coupon);
	Main\Type\Collection::normalizeArrayValuesByInt($coupon, true);
	if (empty($coupon))
		return;
	$conn = Main\Application::getConnection();
	$helper = $conn->getSqlHelper();
	$couponRows = array_chunk($coupon, 500);
	$query = 'delete from '.$helper->quote(self::getTableName()).' where '.$helper->quote('ID');
	foreach ($couponRows as &$row)
	{
		$conn->queryExecute($query.' in ('.implode(', ', $row).')');
	}
	unset($row, $query, $couponRows, $helper, $conn);
}