CBPDocumentService::getDocumentFields

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPDocumentService
  4. getDocumentFields
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/documentservice.php
  • Класс: CBPDocumentService
  • Вызов: CBPDocumentService::getDocumentFields
public function getDocumentFields($parameterDocumentType, $importExportMode = false)
{
	[$moduleId, $entity, $documentType] = CBPHelper::ParseDocumentId($parameterDocumentType);

	$k = $moduleId."@".$entity."@".$documentType;
	if (isset($this->documentFieldsCache[$k]))
	{
		return $this->documentFieldsCache[$k];
	}

	if ($moduleId)
	{
		CModule::IncludeModule($moduleId);
	}

	if (class_exists($entity))
	{
		$fields = call_user_func_array(array($entity, "GetDocumentFields"), array($documentType, $importExportMode));
		if (is_array($fields))
		{
			foreach ($fields as $key => $prop)
			{
				if ($prop["Type"] === 'integer')
				{
					$fields[$key]["Type"] = 'int';
				}
				if (empty($prop['BaseType']))
				{
					$baseTypes = [
						"int",
						"double",
						"date",
						"datetime",
						"user",
						"string",
						"bool",
						"file",
						"text",
						"select",
						'time',
					];

					$fields[$key]["BaseType"] =
						in_array($prop["Type"], $baseTypes, true)
							? $prop["Type"]
							: 'string'
					;
				}
			}
		}

		$this->documentFieldsCache[$k] = $fields;
		return $this->documentFieldsCache[$k];
	}

	return null;
}

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