CCrmInvoiceRestService::tryExternalizeWebDavElementField

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmInvoiceRestService
  4. tryExternalizeWebDavElementField
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice_invoice.php
  • Класс: \CCrmInvoiceRestService
  • Вызов: CCrmInvoiceRestService::tryExternalizeWebDavElementField
static function tryExternalizeWebDavElementField(&$fields, $fieldName, $multiple = false)
{
	if(!isset($fields[$fieldName]))
	{
		return false;
	}

	if(!$multiple)
	{
		$elementID = intval($fields[$fieldName]);
		$info = CCrmWebDavHelper::GetElementInfo($elementID, false);
		if(empty($info))
		{
			unset($fields[$fieldName]);
			return false;
		}
		else
		{
			$fields[$fieldName] = array(
				'id' => $elementID,
				'url' => isset($info['SHOW_URL']) ? $info['SHOW_URL'] : ''
			);

			return true;
		}
	}

	$result = array();
	$elementsID = $fields[$fieldName];
	if(is_array($elementsID))
	{
		foreach($elementsID as $elementID)
		{
			$elementID = intval($elementID);
			$info = CCrmWebDavHelper::GetElementInfo($elementID, false);
			if(empty($info))
			{
				continue;
			}

			$result[] = array(
				'id' => $elementID,
				'url' => isset($info['SHOW_URL']) ? $info['SHOW_URL'] : ''
			);
		}
	}

	if(!empty($result))
	{
		$fields[$fieldName] = &$result;
		unset($result);
		return true;
	}

	unset($fields[$fieldName]);
	return false;
}

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