Call::postForm

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Call
  4. postForm
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/activity/provider/call.php
  • Класс: Bitrix\Crm\Activity\Provider\Call
  • Вызов: Call::postForm
static function postForm(array &$activity, array $formData)
{
	$result = new Main\Result();
	if ($formData['comment'] ?? null)
	{
		$activityId = $formData['id'];
		$activityFields = CCrmActivity::GetByID($activityId, false);

		$callId = mb_strpos($activityFields['ORIGIN_ID'], 'VI_') === false? null : mb_substr($activityFields['ORIGIN_ID'], 3);
		if ($callId)
		{
			VoxImplantManager::saveComment($callId, $formData['comment']);
		}
	}

	if (is_array($activity['COMMUNICATIONS']))
	{
		foreach ($activity['COMMUNICATIONS'] as $k => $v)
		{
			if ($activity['COMMUNICATIONS'][$k]['TYPE'] == '' && $activity['COMMUNICATIONS'][$k]['VALUE'] == '')
			{
				$firstNumber = static::getFirstPhoneNumber($activity['COMMUNICATIONS'][$k]['ENTITY_TYPE_ID'], $activity['COMMUNICATIONS'][$k]['ENTITY_ID']);
				if ($firstNumber === '')
				{
					$result->addError(new Main\Error(Loc::getMessage('VOXIMPLANT_ACTIVITY_PROVIDER_CALL_ERROR_NO_NUMBER')));
					return $result;
				}

				$activity['COMMUNICATIONS'][$k]['VALUE'] = $firstNumber;
				$activity['COMMUNICATIONS'][$k]['TYPE'] = static::COMMUNICATION_TYPE_PHONE;
			}
		}
	}

	return $result;
}

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