- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/location/type.php
- Класс: BitrixSaleLocationTypeTable
- Вызов: TypeTable::update
static function update($primary, array $data)
{
$primary = Assert::expectIntegerPositive($primary, '$primary');
if(isset($data['CODE']))
{
$res = self::getList(array(
'filter' => array(
'=CODE' => $data['CODE'],
'!=ID' => $primary
)
));
if($res->fetch())
{
$updResult = new EntityUpdateResult();
$updResult->addError(new MainError(Loc::getMessage('SALE_LOCATION_TYPE_ENTITY_CODE_FIELD_EXIST_ERROR')));
return $updResult;
}
}
// first update parent, and if it succeed, do updates of the connected data
if(isset($data['NAME']))
{
$name = $data['NAME'];
unset($data['NAME']);
}
$updResult = parent::update($primary, $data);
// update connected data
if($updResult->isSuccess())
{
// names
if(isset($name))
NameTypeTable::updateMultipleForOwner($primary, $name);
}
return $updResult;
}