• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/taskwebservice.php
  • Класс: CTasksWebService
  • Вызов: CTasksWebService::getDeletedTasks
private function getDeletedTasks(array $arFilter): array
{
	if (!BitrixMainLoader::includeModule('recyclebin'))
	{
		return [];
	}

	$query = RecyclebinTable::query()
		->setSelect([
			'TASK_ID' => 'ENTITY_ID',
			'DATA' => 'RD.DATA'
		])
		->registerRuntimeField(
			'RD',
			new BitrixMainEntityReferenceField(
				'RD',
				RecyclebinDataTable::getEntity(),
				Join::on('this.ID', 'ref.RECYCLEBIN_ID')->where('ref.ACTION', 'TASK'),
				['join_type' => 'inner']
			)
		)
		->where('ENTITY_TYPE', '=', Manager::TASKS_RECYCLEBIN_ENTITY);

	if (array_key_exists('>CHANGED_DATE', $arFilter))
	{
		$format = CSite::GetDateFormat('FULL');
		$format = BitrixMainTypeDate::convertFormatToPhp($format);
		$query->where('TIMESTAMP', '>', new BitrixMainTypeDateTime($arFilter['>CHANGED_DATE'], $format));
	}

	$res = $query->exec();

	$ids = [];
	while ($row = $res->fetch())
	{
		$taskData = unserialize($row['DATA'], ['allowed_classes' => false]);
		if ($taskData['RESPONSIBLE_ID'] == $arFilter['MEMBER'])
		{
			$ids[] = $row['TASK_ID'];
		}
	}

	return $ids;
}