CCrmExternalSaleImport::GetOrderData

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmExternalSaleImport
  4. GetOrderData
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_external_sale_import.php
  • Класс: \CCrmExternalSaleImport
  • Вызов: CCrmExternalSaleImport::GetOrderData
public function GetOrderData($orderId, $skipBP = true)
{
	$this->ClearErrors();
	$this->arImportResult = new CCrmExternalSaleImportResult();

	$orderId = intval($orderId);
	if ($orderId <= 0)
	{
		$this->AddError("GO1", "Order ID is not specified");
		return self::SyncStatusError;
	}

	$filter = array(
		"ORDER_ID" => $orderId,
		"GZ_COMPRESSION_SUPPORTED" => function_exists("gzcompress") ? 1 : 0,
		"type" => "crm",
		"mode" => "query"
	);

	$queryOptions = array();
	$sessid = $this->GetServerSessionID();
	$serverVersion = $this->GetServerVersion();
	if($sessid !== "" && $serverVersion >= 2.09)
	{
		$queryOptions["REQUEST_METHOD"] = "GET";
		$filter["sessid"] = $sessid;
	}
	else
	{
		$queryOptions["REQUEST_METHOD"] = "POST";
		if($sessid !== "")
		{
			$filter["sessid"] = $sessid;
		}
	}

	$orderData = $this->QueryOrderData($filter, $queryOptions);
	if ($orderData == null)
	{
		$this->AddError("SD2", "Communication error");
		return self::SyncStatusError;
	}

	$arErrors = array();
	$arOrders = $this->ParseOrderData($orderData, $modificationLabel, $arErrors);
	if (is_array($arOrders))
	{
		foreach ($arOrders as $order)
		{
			$this->SaveOrderData($order, $skipBP);
		}

		return self::SyncStatusFinished;
	}

	foreach ($arErrors as $error)
	{
		$this->AddError($error[0], $error[1]);
	}
	return self::SyncStatusError;
}

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