• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/integration/rest/appconfiguration.php
  • Класс: BitrixBizprocIntegrationRestAppConfiguration
  • Вызов: AppConfiguration::clearCrmTrigger
static function clearCrmTrigger($option)
{
	$result = [
		'NEXT' => false,
	];
	$clearFull = $option['CLEAR_FULL'];

	$res = TriggerTable::getList(
		[
			'order' => [
				'ID' => 'ASC',
			],
			'filter' => [
				'>ID' => $option['NEXT'],
			],
			'limit' => 10,
		]
	);
	while ($item = $res->Fetch())
	{
		$result['NEXT'] = $item['ID'];
		if (!$clearFull && $item['ENTITY_TYPE_ID'] == CCrmOwnerType::Deal)
		{
			//dont off old custom deal trigger
			$matches = [];
			preg_match(static::$customDealMatch, $item['ENTITY_STATUS'], $matches, PREG_OFFSET_CAPTURE);
			if (!empty($matches))
			{
				continue;
			}
		}
		$delete = TriggerTable::delete($item['ID']);
		if ($delete->isSuccess())
		{
			$result['OWNER_DELETE'][] = [
				'ENTITY_TYPE' => self::OWNER_ENTITY_TYPE_TRIGGER,
				'ENTITY' => $item['ID'],
			];
		}
	}

	return $result;
}