CCrmExternalSaleImport::ParseOrderDataOrder

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmExternalSaleImport
  4. ParseOrderDataOrder
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_external_sale_import.php
  • Класс: \CCrmExternalSaleImport
  • Вызов: CCrmExternalSaleImport::ParseOrderDataOrder
private function ParseOrderDataOrder($arDocument, $arSettings)
{
	$arOrder = array();

	foreach ($arDocument["#"] as $key => $value)
	{
		$value = $value[0]["#"];
		switch ($key)
		{
			case 'Id':
				$arOrder["ID"] = intval($value);
				break;
			case 'Number':
				$arOrder["ACCOUNT_NUMBER"] = $value;
				break;
			case 'Amount':
				$arOrder["PRICE"] = $arDocument["#"]["Amount"][0]["#"];
				$arOrder["PRICE"] = str_replace($arSettings["SumFormat"]["CRD"], ".", $arOrder["PRICE"]);
				break;
			case 'Comment':
				$arOrder["COMMENT"] = $value;
				break;
			case 'DateUpdate':
				$arOrder["DATE_UPDATE"] = ConvertTimeStamp(MakeTimeStamp($value, "YYYY-MM-DD HH:MI:SS"), "FULL");
				break;
			case 'Date':
			case 'Time':
				if (!isset($arOrder["DATE_INSERT"]))
				{
					$str = "";
					$fmt = "";
					if (isset($arDocument["#"]["Date"][0]["#"]))
					{
						$str .= $arDocument["#"]["Date"][0]["#"];
						$fmt .= $arSettings["DateFormat"]["DF"];
					}
					if ($str != "" && isset($arDocument["#"]["Time"][0]["#"]))
					{
						$str .= " ";
						$fmt .= " ";
					}
					if (isset($arDocument["#"]["Time"][0]["#"]))
					{
						$str .= $arDocument["#"]["Time"][0]["#"];
						$fmt .= $arSettings["TimeFormat"]["DF"];
					}
					$arOrder["DATE_INSERT"] = ConvertTimeStamp(MakeTimeStamp($str, $fmt), "FULL");
				}
				break;
			case 'Currency':
				$arOrder["CURRENCY"] = $value;
				break;
			case 'CurrencyRate':
				$arOrder["CURRENCY_RATE"] = $value;
				break;
			case 'Contractors':
				$this->ParseOrderDataOrderContractors($value, $arSettings, $arOrder);
				break;
			case 'Items':
				$this->ParseOrderDataOrderItems($value, $arSettings, $arOrder);
				break;
			case 'PropertiesValues':
				$this->ParseOrderDataOrderPropertiesValues($value, $arSettings, $arOrder);
				break;
			case 'Taxes':
				$this->ParseOrderDataOrderTaxes($value, $arSettings, $arOrder);
				break;
			case 'Discounts':
				$this->ParseOrderDataOrderDiscounts($value, $arSettings, $arOrder);
				break;
			default:
				$arOrder[$key] = $value;
				break;
		}
	}

	return $arOrder;
}

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