• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/tasklog.php
  • Класс: CTaskLog
  • Вызов: CTaskLog::UnifyFields
static function UnifyFields(&$value, $key)
{
	$comparedFields = static::getTrackedFields();

	if (array_key_exists($key, $comparedFields)) {
		switch ($comparedFields[$key]['TYPE']) {
			case "integer":
				$value = intval((string)$value);
				break;

			case "string":
				$value = trim((string)$value);
				break;

			case "array":
				if (!is_array($value))
					$value = explode(",", $value);

				$value = array_unique(array_filter(array_map("trim", $value)));
				sort($value);
				break;

			case "date":
				$value = MakeTimeStamp($value);

				if (!$value) {
					$value = strtotime($value);        // There is correct Unix timestamp in return value
					// CTimeZone::getOffset() substraction here???
				} else {
					// It can be other date on server (relative to client), ...
					$bTzWasDisabled = !CTimeZone::enabled();

					if ($bTzWasDisabled)
						CTimeZone::enable();

					$value -= CTimeZone::getOffset();        // get correct UnixTimestamp

					if ($bTzWasDisabled)
						CTimeZone::disable();

					// We mustn't store result of MakeTimestamp() in DB,
					// because it is shifted for time zone offset already,
					// which can't be restored.
				}
				break;

			case "bool":
				if ($value != "Y")
					$value = "N";
				break;
		}
	}
}