StoreDocument::checkFields

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. StoreDocument
  4. checkFields
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/activity/provider/storedocument.php
  • Класс: Bitrix\Crm\Activity\Provider\StoreDocument
  • Вызов: StoreDocument::checkFields
static function checkFields($action, &$fields, $id, $params = null)
{
	$result = new Main\Result();

	$previousFields = (isset($params['PREVIOUS_FIELDS']) && is_array($params['PREVIOUS_FIELDS']))
		? $params['PREVIOUS_FIELDS']
		: []
	;

	if (
		$action === self::ACTION_UPDATE
		&& isset($fields['COMPLETED'])
		&& $fields['COMPLETED'] === 'Y'
		&& empty($previousFields['END_TIME'])
	)
	{
		$end = new Main\Type\DateTime();
		$fields['END_TIME'] = $end->toString();
	}

	if (isset($fields['END_TIME']))
	{
		if($fields['END_TIME'] !== '')
		{
			$fields['DEADLINE'] = $fields['END_TIME'];
		}
		else
		{
			$fields['~DEADLINE'] = \CCrmDateTimeHelper::GetMaxDatabaseDate();
		}
	}

	return $result;
}

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