Invoice::GetDocument

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Invoice
  4. GetDocument
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/bizproc/document/invoice.php
  • Класс: Bitrix\Crm\Integration\BizProc\Document\Invoice
  • Вызов: Invoice::GetDocument
public function GetDocument($documentId)
{
	$arDocumentID = static::GetDocumentInfo($documentId);
	if (empty($arDocumentID))
		throw new \CBPArgumentNullException('documentId');

	$arResult = null;

	//TODO: use new API
	$invoiceFields = \CCrmInvoice::GetByID($arDocumentID['ID'], false);

	if ($invoiceFields)
	{
		$userKeys = [
			'USER_ID', 'EMP_PAYED_ID', 'EMP_DEDUCTED_ID', 'EMP_STATUS_ID', 'EMP_MARKED_ID',
			'EMP_ALLOW_DELIVERY_ID', 'CREATED_BY', 'RESPONSIBLE_ID', 'EMP_CANCELED_ID',
		];
		foreach ($userKeys as $userKey)
		{
			if (isset($invoiceFields[$userKey]))
			{
				$invoiceFields[$userKey] = 'user_' . $invoiceFields[$userKey];
			}
		}

		return $invoiceFields;
	}

	return null;
}

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