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