QuoteContactTable::unbindAllQuotes

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. QuoteContactTable
  4. unbindAllQuotes
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/binding/quotecontact.php
  • Класс: Bitrix\Crm\Binding\QuoteContactTable
  • Вызов: QuoteContactTable::unbindAllQuotes
static function unbindAllQuotes($contactID)
{
	$contactID = (int)$contactID;
	if($contactID <= 0)
	{
		throw new Main\ArgumentException('Must be greater than zero', 'contactID');
	}

	$connection = Main\Application::getConnection();
	$connection->queryExecute(
	/** @lang text */
		"DELETE FROM b_crm_quote_contact WHERE CONTACT_ID = {$contactID}"
	);
	$connection->queryExecute(
	/** @lang text */
		"UPDATE b_crm_quote SET CONTACT_ID =
		(SELECT MIN(CONTACT_ID) FROM b_crm_quote_contact t WHERE t.QUOTE_ID = b_crm_quote.ID)
		WHERE CONTACT_ID = {$contactID}"
	);
}

Добавить комментарий