- Модуль: lists
- Путь к файлу: ~/bitrix/modules/lists/lib/entity/element.php
- Класс: BitrixListsEntityElement
- Вызов: Element::update
public function update()
{
$this->param->checkRequiredInputParams(
[
"IBLOCK_TYPE_ID",
"IBLOCK_CODE",
"IBLOCK_ID",
"ELEMENT_CODE",
"ELEMENT_ID",
]
);
if ($this->param->hasErrors())
{
$this->errorCollection->add($this->param->getErrors());
return false;
}
$this->validateFields();
$isEnabledBp = $this->isEnabledBizproc($this->params["IBLOCK_TYPE_ID"]);
$hasBpTemplatesWithAutoStart = false;
if ($isEnabledBp)
{
$hasBpTemplatesWithAutoStart = $this->hasBpTemplatesWithAutoStart(CBPDocumentEventType::Edit);
}
if ($this->hasErrors())
{
return false;
}
list($elementSelect, $elementFields, $elementProperty) = $this->getElementData();
$fields = $this->getElementFields($this->elementId, $this->params["FIELDS"]);
$elementObject = new CIBlockElement;
$updateResult = $elementObject->update($this->elementId, $fields, false, true, true);
if ($updateResult)
{
if ($isEnabledBp && $hasBpTemplatesWithAutoStart)
{
$changedElementFields = CLists::checkChangedFields(
$this->iblockId,
$this->elementId,
$elementSelect,
$elementFields,
$elementProperty
);
$this->startBp($this->elementId, CBPDocumentEventType::Edit, $changedElementFields);
if ($this->hasErrors())
{
return false;
}
}
return true;
}
else
{
if ($elementObject->LAST_ERROR)
{
$this->errorCollection->setError(
new Error($elementObject->LAST_ERROR, self::ERROR_UPDATE_ELEMENT)
);
}
else
{
$this->errorCollection->setError(
new Error("Unknown error", self::ERROR_UPDATE_ELEMENT)
);
}
return false;
}
}