CAllCrmQuote::PrepareStorageElementInfo

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmQuote
  4. PrepareStorageElementInfo
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_quote.php
  • Класс: \CAllCrmQuote
  • Вызов: CAllCrmQuote::PrepareStorageElementInfo
static function PrepareStorageElementInfo(&$arFields)
{
	$storageTypeID = isset($arFields['STORAGE_TYPE_ID']) ? (int)$arFields['STORAGE_TYPE_ID'] : StorageType::Undefined;
	if(!StorageType::IsDefined($storageTypeID))
	{
		$storageTypeID = self::GetDefaultStorageTypeID();
	}

	$storageElementIDs = isset($arFields['STORAGE_ELEMENT_IDS']) && is_array($arFields['STORAGE_ELEMENT_IDS'])
		? $arFields['STORAGE_ELEMENT_IDS'] : array();

	if($storageTypeID === StorageType::File)
	{
		$arFields['FILES'] = array();
		foreach($storageElementIDs as $fileID)
		{
			$arData = CFile::GetFileArray($fileID);
			if(is_array($arData))
			{
				$arFields['FILES'][] = array(
					'fileID' => $arData['ID'],
					'fileName' => $arData['FILE_NAME'],
					'fileURL' =>  CCrmUrlUtil::UrnEncode($arData['SRC']),
					'fileSize' => $arData['FILE_SIZE']
				);
			}
		}
	}
	elseif($storageTypeID === StorageType::WebDav || $storageTypeID === StorageType::Disk)
	{
		$infos = array();
		foreach($storageElementIDs as $elementID)
		{
			$id = (isset($arFields['ID']) && $arFields['ID'] > 0) ? (int)$arFields['ID'] : 0;
			$infos[] = StorageManager::getFileInfo(
				$elementID, $storageTypeID, false,
				array('OWNER_TYPE_ID' => \CCrmOwnerType::Quote, 'OWNER_ID' => $id)
			);
		}
		$arFields[$storageTypeID === StorageType::Disk ? 'DISK_FILES' : 'WEBDAV_ELEMENTS'] = &$infos;
		unset($infos);
	}
}

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