CCrmProductRowRestProxy::innerAdd

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmProductRowRestProxy
  4. innerAdd
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmProductRowRestProxy
  • Вызов: CCrmProductRowRestProxy::innerAdd
protected function innerAdd(&$fields, &$errors, array $params = null)
{
	$ownerID = isset($fields['OWNER_ID']) ? intval($fields['OWNER_ID']) : 0;
	$ownerType = $fields['OWNER_TYPE'] ?? '';

	if($ownerID <= 0 || $ownerType === '')
	{
		if ($ownerID <= 0)
		{
			$errors[] = 'The field OWNER_ID is required.';
		}

		if ($ownerType === '')
		{
			$errors[] = 'The field OWNER_TYPE is required.';
		}
		return false;
	}

	if(!CCrmAuthorizationHelper::CheckCreatePermission(
		CCrmProductRow::ResolveOwnerTypeName($ownerType)))
	{
		$errors[] = 'Access denied.';
		return false;
	}

	$result = CCrmProductRow::Add($fields, true, true);
	if(!is_int($result))
	{
		$errors[] = CCrmProductRow::GetLastError();
	}
	return $result;
}

Добавить комментарий