• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/rest/configuration/entity/lead.php
  • Класс: Bitrix\Crm\Integration\Rest\Configuration\Entity\Lead
  • Вызов: Lead::clear
static function clear($option)
{
	if(!Helper::checkAccessManifest($option, static::$accessManifest))
	{
		return null;
	}

	$result = [
		'NEXT' => false
	];
	$clearFull = $option['CLEAR_FULL'];
	if($clearFull)
	{
		$entity = new CCrmLead(true);
		$res = $entity->getList([], [], [], 10);
		while($lead = $res->fetch())
		{
			if(!$entity->delete($lead['ID']))
			{
				$result['NEXT'] = false;
				$result['ERROR_ACTION'] = 'DELETE_ERROR_LEAD';
				break;
			}
			else
			{
				$result['NEXT'] = $lead['ID'];
			}
		}
	}

	return $result;
}