• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/update/userfield/crmdealfield.php
  • Класс: Bitrix\Crm\Update\UserField\CrmDealField
  • Вызов: CrmDealField::prepareListValuesForUpdate
protected function prepareListValuesForUpdate($field, $entity)
{
	$ufFieldValues = $entity[$field["FIELD_NAME"]];
	$listValuesForUpdate = array($field["FIELD_NAME"] => array());
	if(!empty($ufFieldValues))
	{
		if(is_array($ufFieldValues))
		{
			foreach($ufFieldValues as $fieldValue)
			{
				if(!intval($fieldValue))
				{
					$explode = explode('_', $fieldValue);
					if(\CUserTypeCrm::getLongEntityType($explode[0]) == $field["AVAILABLE_ENTITY_TYPE"])
					{
						$listValuesForUpdate[$field["FIELD_NAME"]][] = intval($explode[1]);
					}
				}
			}
		}
		else
		{
			if(!intval($ufFieldValues))
			{
				$explode = explode('_', $ufFieldValues);
				if(\CUserTypeCrm::getLongEntityType($explode[0]) == $field["AVAILABLE_ENTITY_TYPE"])
				{
					$listValuesForUpdate[$field["FIELD_NAME"]] = intval($explode[1]);
				}
			}
		}
	}

	return $listValuesForUpdate;
}