CCrmTax::unSetVatMode

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmTax
  4. unSetVatMode
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_tax.php
  • Класс: \CCrmTax
  • Вызов: CCrmTax::unSetVatMode
static function unSetVatMode()
{
	if(!Loader::includeModule('catalog'))
		return false;

	$count = 0;
	$arActiveVats = array();

	$dbActiveVats = Catalog\Model\Vat::getList([
		'select' => [
			'ID',
		],
		'filter' => [
			'=ACTIVE' => 'Y',
		],
	]);
	while($arVat = $dbActiveVats->Fetch())
	{
		$arActiveVats[] = $arVat['ID'];
		$result = Catalog\Model\Vat::update(
			(int)$arVat['ID'],
			[
				'ACTIVE' => 'N',
			]
		);
		if ($result->isSuccess())
		{
			$count++;
		}
	}

	$strActiveVats = !empty($arActiveVats) ? implode(',', $arActiveVats) : '';
	COption::SetOptionString("crm", "crmSaveActiveVats", $strActiveVats);
	COption::SetOptionString("crm", "vatModeSetted", 'N');
	self::$bVatMode = false;

	return $count;
}

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