CCrmExternalChannelImportActivity::innerAdd

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmExternalChannelImportActivity
  4. innerAdd
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/rest/externalchannel.php
  • Класс: Bitrix\Crm\Rest\CCrmExternalChannelImportActivity
  • Вызов: CCrmExternalChannelImportActivity::innerAdd
protected function innerAdd(&$activity, &$resultList, array $params = null)
{
	$error = array();
	$resultList = array(
		'id'=> -1,
		'process' => array(
			'add' => false,
			'error' => array()
		)
	);

	if(($fields = $activity[self::FIELDS]) && count($fields)>0)
	{
		$errors = array();
		$this->checkFields($fields, $errors);
		if(count($errors)>0)
			$error[] = implode('; ', $errors);

		if(count($error)<=0)
		{
			$errors = array();

			$this->getEntity()->internalizeFields($fields, $this->getEntity()->getFieldsInfo());

			$this->fillFields($fields, $activity);

			$id = $this->getEntity()->innerAdd($fields, $errors);
			if($this->isValidID($id))
			{
				$resultList['id'] = $id;
				$resultList['process']['add'] = true;
			}

			if(count($errors)>0)
				$error[] = implode('; ', $errors);
		}
	}
	else
		$error[] = "Activity fields is not defined.";

	if(count($error)>0)
		$resultList['process']['error'] = $error;
}

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