CCrmProductSection::Update

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmProductSection
  4. Update
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_product_section.php
  • Класс: \CCrmProductSection
  • Вызов: CCrmProductSection::Update
static function Update($ID, &$arFields)
{
	if (!CModule::IncludeModule('iblock'))
	{
		return false;
	}


	$section = new CIBlockSection();
	$dbResult = $section->GetList(
		array(),
		array(
			'ID' => $ID,
			/*'GLOBAL_ACTIVE' => 'Y',*/
			'CHECK_PERMISSIONS' => 'N'
		),
		false,
		array('IBLOCK_ID'),
		false
	);

	$currentFields = $dbResult ? $dbResult->Fetch() : null;
	if(!(is_array($currentFields) && CCrmCatalog::Exists(intval($currentFields['IBLOCK_ID']))))
	{
		self::$LAST_ERROR_CODE = self::ERR_SECTION_NOT_FOUND;
		self::$LAST_ERROR = GetMessage('CRM_PRODUCT_SECTION_ERR_SECTION_NOT_FOUND');
		return false;
	}

	$sectionFields = CCrmProductSectionDbResult::MapKeys($arFields);
	$sectionFields['CHECK_PERMISSIONS'] = 'N';

	$result = $section->Update($ID, $sectionFields);

	if($result === false)
	{
		self::$LAST_ERROR_CODE = self::ERR_IBLOCK_SECTION_UPDATE;
		self::$LAST_ERROR = $section->LAST_ERROR;
	}

	return $result;
}

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