- Модуль: catalog
- Путь к файлу: ~/bitrix/modules/catalog/lib/config/state.php
- Класс: BitrixCatalogConfigState
- Вызов: State::handlerBeforeIblockElementUpdate
static function handlerBeforeIblockElementUpdate(array &$fields): bool
{
if (!self::checkIblockId($fields))
{
return true;
}
$limit = self::checkIblockLimit((int)$fields['IBLOCK_ID']);
if (empty($limit))
{
return true;
}
if (!isset($fields['IBLOCK_SECTION']) || !is_array($fields['IBLOCK_SECTION']))
{
return true;
}
$sections = $fields['IBLOCK_SECTION'];
MainTypeCollection::normalizeArrayValuesByInt($sections, true);
if (empty($sections))
{
return true;
}
self::loadIblockSections((int)$fields['IBLOCK_ID']);
$sections = array_intersect($sections, self::$fullIblockSections);
if (empty($sections))
{
return true;
}
unset($sections);
$notMove = false;
$iterator = IblockSectionElementTable::getList([
'select' => ['IBLOCK_SECTION_ID'],
'filter' => [
'=IBLOCK_ELEMENT_ID' => $fields['ID'],
'=ADDITIONAL_PROPERTY_ID' => null,
],
]);
while ($row = $iterator->fetch())
{
$row['ID'] = (int)$row['ID'];
if (isset(self::$fullIblockSections[$row['ID']]))
{
$notMove = true;
break;
}
}
unset($row, $iterator);
if ($notMove)
{
return true;
}
self::setProductLimitError($limit['MESSAGE']);
unset($limit);
return false;
}