ToDo::checkFields

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. ToDo
  4. checkFields
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/activity/provider/todo.php
  • Класс: Bitrix\Crm\Activity\Provider\ToDo
  • Вызов: ToDo::checkFields
static function checkFields($action, &$fields, $id, $params = null)
{
	$isInitiatedByCalendar = (
		!empty($params['INITIATED_BY_CALENDAR'])
		|| !empty($fields['CALENDAR_EVENT_ID'])
	);

	if (isset($fields['END_TIME']) && (string)($fields['END_TIME']) !== '')
	{
		$fields['DEADLINE'] = $fields['END_TIME'];
	}

	if ($action === self::ACTION_UPDATE && $isInitiatedByCalendar)
	{
		if (isset($fields['START_TIME']) && (string)$fields['START_TIME'] !== '')
		{
			$fields['DEADLINE'] = $fields['START_TIME'];
		}
		elseif (isset($fields['~START_TIME']) && (string)$fields['~START_TIME'] !== '')
		{
			$fields['~DEADLINE'] = $fields['~START_TIME'];
		}
	}

	if (
		$action === self::ACTION_UPDATE
		&& isset($fields['SUBJECT'])
		&& (empty($fields['DESCRIPTION']) || $isInitiatedByCalendar)
	)
	{
		$fields['DESCRIPTION'] = $fields['SUBJECT'];
	}

	return new Result();
}

Добавить комментарий