• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/helpers/admin/blocks/orderbuyer.php
  • Класс: BitrixSaleHelpersAdminBlocksOrderBuyer
  • Вызов: OrderBuyer::getOrderPropertiesByJS
static function getOrderPropertiesByJS(SaleOrder $order)
{
	if ($order->getId() > 0)
		$result = $order->getPropertyCollection()->getArray();
	else
		$result = self::getNotRelPropData($order);

	if (!empty($result['properties']))
	{
		$propertyTypes = InputManager::getTypes();
		$baseTypes = array();
		foreach ($propertyTypes as $typeName => $typeData)
		{
			if (mb_strpos($typeData['CLASS'], 'Bitrix\Sale\Internals\Input') !== false)
				$baseTypes[] = $typeName;
		}

		foreach ($result['properties'] as &$property)
		{
			$propertyClassName = $propertyTypes[$property['TYPE']]['CLASS'];

			if (
				!in_array($property['TYPE'], $baseTypes)
				&& class_exists($propertyClassName)
				&& new $propertyClassName instanceof InputBase
			)
			{
				ob_start();
				$propertyCustomName = "PROPERTIES[".$property['ID']."]";
				/** @var InputBase $propertyClassName */
				echo $propertyClassName::getEditHtml($propertyCustomName, $property, $property['VALUE']);
				$property['EDIT_HTML'] = ob_get_contents();
				ob_end_clean();
				$property['TYPE'] = 'UF';
			}

			if ($property['TYPE'] === 'ENUM' && is_array($property['OPTIONS']))
			{
				$property['OPTIONS_SORT'] = array_keys($property['OPTIONS']);
			}
		}
	}

	if (!empty($result['groups']) && !empty($result['properties']))
	{
		$groupIndexList = array();
		foreach ($result['groups'] as $groupdData)
		{
			$groupIndexList[] = intval($groupdData['ID']);
		}

		if (!empty($groupIndexList))
		{
			foreach ($result['properties'] as $index => $propertyData)
			{
				if (array_key_exists('PROPS_GROUP_ID', $propertyData))
				{
					if (!in_array($propertyData['PROPS_GROUP_ID'], $groupIndexList))
					{
						$result['properties'][$index]['PROPS_GROUP_ID'] = 0;
					}
				}
			}
		}

	}

	return '
		
	';
}