• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/ivr/ivr.php
  • Класс: BitrixVoximplantIvrIvr
  • Вызов: Ivr::delete
public function delete()
{
	$result = new Result();

	if(!$this->id)
	{
		return $result;
	}

	$checkCursor = ConfigTable::getList(array(
		'filter' => array(
			'IVR' => 'Y',
			'IVR_ID' => $this->id
		)
	));

	$attachedToNumbers = array();
	while ($row = $checkCursor->fetch())
	{
		$attachedToNumbers[] = $row['PHONE_NAME'];
	}

	if(!empty($attachedToNumbers))
	{
		$result->addError(new Error(Loc::getMessage(
			"IVR_ERROR_IN_USE",
			array(
				"#NUMBERS#" => implode('. ', $attachedToNumbers))
		)));
		return $result;
	}

	foreach ($this->items as $item)
	{
		$item->delete();
	}

	IvrTable::delete($this->id);
	return $result;
}