• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/checklist/internals/checklist.php
  • Класс: BitrixTasksCheckListInternalsCheckList
  • Вызов: CheckList::getChangedAttachments
private function getChangedAttachments($oldAttachments, $newAttachments)
{
	$attachmentsChanged = false;
	$changedAttachments = [];

	foreach ($newAttachments as $attachmentId => $fileId)
	{
		if (array_key_exists($attachmentId, $oldAttachments))
		{
			$changedAttachments[] = $attachmentId;
		}
		else if (in_array($attachmentId, $oldAttachments, true))
		{
			$changedAttachments[] = array_search($attachmentId, $oldAttachments, true);
		}
		else
		{
			$changedAttachments[] = $fileId;
			$attachmentsChanged = true;
		}
	}

	if (!$attachmentsChanged)
	{
		foreach (array_keys($oldAttachments) as $id)
		{
			if (!in_array($id, $changedAttachments))
			{
				$attachmentsChanged = true;
				break;
			}
		}
	}

	if (!$attachmentsChanged)
	{
		$changedAttachments = null;
	}

	return $changedAttachments;
}