- Модуль: crmmobile
- Путь к файлу: ~/bitrix/modules/crmmobile/lib/Controller/Category.php
- Класс: BitrixCrmMobileControllerCategory
- Вызов: Category::updateAction
public function updateAction(Factory $factory, int $categoryId, array $fields): void
{
if (!$this->canUpdateCategory($factory, $categoryId))
{
return;
}
$entityId = $factory->getStagesEntityId($categoryId);
$stages = array_merge(
$fields['processStages'] ?? [],
$fields['successStages'] ?? [],
$fields['failedStages'] ?? [],
);
foreach ($stages as $stage)
{
$stageResult = $this->updateStageSort($entityId, $stage['id'], $stage['sort']);
if (!$stageResult->isSuccess())
{
$this->addErrors($stageResult->getErrors());
return;
}
}
$newCategoryName = ($fields['name'] ?? null);
if (!$this->updateCategoryName($factory, $categoryId, $newCategoryName))
{
return;
}
$permissions = [
UserPermissions::PERMISSION_ALL,
UserPermissions::PERMISSION_SELF,
UserPermissions::PERMISSION_NONE,
];
$entityTypeId = $factory->getEntityTypeId();
if (in_array($fields['access'], $permissions, true))
{
$this->setAccess($entityTypeId, $fields['id'], $fields['access']);
}
elseif (is_numeric($fields['access']))
{
$this->copyAccessCategory($entityTypeId, $fields['id'], (int)$fields['access']);
}
}