• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/rest/helper.php
  • Класс: BitrixVoximplantRestHelper
  • Вызов: Helper::updateExternalLine
static function updateExternalLine($number, $updatingFields, $restAppId)
{
	$result = new Result();
	$number = trim($number);
	if ($number == '')
	{
		$result->addError(new Error('NUMBER should not be empty'));
		return $result;
	}

	$row = ExternalLineTable::getRow([
		'filter' => [
			'=NUMBER' => $number,
			'=REST_APP_ID' =>$restAppId
		]
	]);

	if (!$row)
	{
		$result->addError(new Error('Could not find line with number ' . $number));
		return $result;
	}

	$updateResult = ExternalLineTable::update($row['ID'], $updatingFields);

	if (!$updateResult->isSuccess())
	{
		$result->addErrors($updateResult->getErrors());
		return $result;
	}

	Application::getInstance()->addBackgroundJob(
		["CVoxImplantUser", "clearCache"],
		[],
		Application::JOB_PRIORITY_LOW
	);

	$updateResult->setData([
		'ID' => $updateResult->getId()
	]);

	return $updateResult;
}