• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/access/rule/checklistsaverule.php
  • Класс: BitrixTasksAccessRuleChecklistSaveRule
  • Вызов: ChecklistSaveRule::isUpdated
private function isUpdated($old, $new): bool
{
	$fields = [
		'PARENT_ID',
		'TITLE',
		'IS_IMPORTANT',
		'MEMBERS',
		'ATTACHMENTS'
	];

	$new['TITLE'] = BitrixMainTextEncoding::convertEncodingToCurrent($new['TITLE']);
	if (empty($new['MEMBERS']))
	{
		$new['MEMBERS'] = [];
	}
	if (empty($new['ATTACHMENTS']))
	{
		$new['ATTACHMENTS'] = [];
	}
	$new['IS_COMPLETE'] = ((int) $new['IS_COMPLETE']) ? 'Y' : 'N';
	$new['IS_IMPORTANT'] = ((int) $new['IS_IMPORTANT']) ? 'Y' : 'N';

	foreach ($fields as $field)
	{
		if ($field === 'ATTACHMENTS')
		{
			$oldAttachments = array_keys($old['ATTACHMENTS']);
			$newAttachments = array_keys($new['ATTACHMENTS']);

			if (count(array_intersect($oldAttachments, $newAttachments)) !== count($oldAttachments))
			{
				return true;
			}

			continue;
		}

		if (($old[$field] ?? null) != ($new[$field] ?? null))
		{
			return true;
		}
	}

	return false;
}