• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/exchange/entity/userprofileimport.php
  • Класс: BitrixSaleExchangeEntityUserProfileImport
  • Вызов: UserProfileImport::add
public function add(array $params)
{
	$result = new SaleResult();

	$profileId = null;
	$fields = $params['TRAITS'];
	$property = $params["ORDER_PROP"];

	$errorList = [];
	$fields['ID'] = $this->registerUser($fields, $errorList);

	if (!empty($errorList))
	{
		foreach($errorList as $error)
		{
			$result->addError(new Error(str_replace('
','', $error['TEXT']))); } } elseif(intval($fields['ID'])>0) { $propertyOrders = static::getPropertyOrdersByPersonalTypeId($fields["PERSON_TYPE_ID"]); if(is_array($propertyOrders)) { foreach($propertyOrders as $filedsProperty) { $propertyId = $filedsProperty["ID"]; if(array_key_exists($propertyId, $property)) { $propertyByConfigValue = $property[$propertyId]; if($profileId == null) { if(!empty($propertyByConfigValue)) { $profileId = CSaleOrderUserProps::Add(array( "NAME" => $fields["AGENT_NAME"], "USER_ID" => $fields['ID'], "PERSON_TYPE_ID" => $fields['PERSON_TYPE_ID'], "XML_ID" => $fields["XML_ID"], "VERSION_1C" => $fields["VERSION_1C"] )); } } CSaleOrderUserPropsValue::Add(array( "USER_PROPS_ID" => $profileId, "ORDER_PROPS_ID" => $propertyId, "NAME" => $filedsProperty["NAME"], "VALUE" => $propertyByConfigValue )); } } } } if($result->isSuccess()) { $user = new static(); $user->setFields($fields); $this->setEntity($user); } return $result; }