• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/classes/general/timeman_entry.php
  • Класс: CAllTimeManEntry
  • Вызов: CAllTimeManEntry::Add
static function Add($arFields)
{
	global $DB;

	$e = GetModuleEvents('timeman', 'OnBeforeTMEntryAdd');
	while ($a = $e->Fetch())
	{
		if (false === ExecuteModuleEventEx($a, [$arFields]))
		{
			return false;
		}
	}

	if (!self::CheckFields('ADD', $arFields))
	{
		return false;
	}

	$id = $DB->Add('b_timeman_entries', $arFields, ['TASKS']);
	if ($id > 0)
	{
		$arFields['ID'] = $id;

		if (is_array($arFields['REPORTS']))
		{
			foreach ($arFields['REPORTS'] as $report)
			{
				$report['ENTRY_ID'] = $id;
				$report['USER_ID'] = $arFields['USER_ID'];

				CTimeManReport::Add($report);
			}
		}

		$e = GetModuleEvents('timeman', 'OnAfterTMEntryAdd');
		while ($a = $e->Fetch())
		{
			ExecuteModuleEventEx($a, [$arFields]);
		}
	}

	return $id;
}