• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/lib/folderinvite.php
  • Класс: BitrixWebdavFolderInviteTable
  • Вызов: FolderInviteTable::addIfNonExists
static function addIfNonExists(array $data)
{
	$filter = array_intersect_key($data, array(
		'INVITE_USER_ID' => true,
		'IBLOCK_ID' => true,
		'SECTION_ID' => true,
	));
	$row = static::getRow(array('filter' => $filter, 'select' => array('ID', 'IS_DELETED')));
	//if we add new invite by old deleted invite, then we delete old and add new.
	if($row && empty($data['IS_DELETED']) && $row['IS_DELETED'])
	{
		static::delete($row['ID']);
	}
	elseif($row)
	{
		$result = new BitrixMainEntityAddResult();
		$result->setId($row['ID']);

		return $result;
	}

	return static::add($data);
}