Exemple #1
0
if ($companyLogoID <= 0) {
    $arFields['COMPANY_LOGO_HTML'] = '';
} else {
    $arPhoto = CFile::ResizeImageGet($companyLogoID, array('width' => 50, 'height' => 50), BX_RESIZE_IMAGE_PROPORTIONAL, false);
    $arFields['COMPANY_LOGO_HTML'] = CFile::ShowImage($arPhoto['src'], 50, 50, 'border=0');
}
$fullNameFormat = $arParams['NAME_TEMPLATE'];
$arFields['~ASSIGNED_BY_FORMATTED_NAME'] = intval($arFields['~ASSIGNED_BY_ID']) > 0 ? CUser::FormatName($fullNameFormat, array('LOGIN' => $arFields['~ASSIGNED_BY_LOGIN'], 'NAME' => $arFields['~ASSIGNED_BY_NAME'], 'LAST_NAME' => $arFields['~ASSIGNED_BY_LAST_NAME'], 'SECOND_NAME' => $arFields['~ASSIGNED_BY_SECOND_NAME']), true, false) : GetMessage('RESPONSIBLE_NOT_ASSIGNED');
$arFields['ASSIGNED_BY_FORMATTED_NAME'] = htmlspecialcharsbx($arFields['~ASSIGNED_BY_FORMATTED_NAME']);
$arFields['~CREATED_BY_FORMATTED_NAME'] = CUser::FormatName($fullNameFormat, array('LOGIN' => $arFields['~CREATED_BY_LOGIN'], 'NAME' => $arFields['~CREATED_BY_NAME'], 'LAST_NAME' => $arFields['~CREATED_BY_LAST_NAME'], 'SECOND_NAME' => $arFields['~CREATED_BY_SECOND_NAME']), true, false);
$arFields['CREATED_BY_FORMATTED_NAME'] = htmlspecialcharsbx($arFields['~CREATED_BY_FORMATTED_NAME']);
$arFields['PATH_TO_USER_CREATOR'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arFields['ASSIGNED_BY']));
$arFields['~MODIFY_BY_FORMATTED_NAME'] = CUser::FormatName($fullNameFormat, array('LOGIN' => $arFields['~MODIFY_BY_LOGIN'], 'NAME' => $arFields['~MODIFY_BY_NAME'], 'LAST_NAME' => $arFields['~MODIFY_BY_LAST_NAME'], 'SECOND_NAME' => $arFields['~MODIFY_BY_SECOND_NAME']), true, false);
$arFields['MODIFY_BY_FORMATTED_NAME'] = htmlspecialcharsbx($arFields['~MODIFY_BY_FORMATTED_NAME']);
$arFields['PATH_TO_USER_MODIFIER'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arFields['MODIFY_BY']));
$arFields['CLIENT_INFO'] = htmlspecialcharsbx(CCrmQuote::MakeClientInfoString($arFields));
// storage type
$storageTypeId = isset($arFields['STORAGE_TYPE_ID']) ? (int) $arFields['STORAGE_TYPE_ID'] : CCrmQuoteStorageType::Undefined;
if ($storageTypeId === CCrmQuoteStorageType::Undefined || !CCrmQuoteStorageType::IsDefined($storageTypeId)) {
    $storageTypeId = CCrmQuote::GetDefaultStorageTypeID();
}
$arFields['STORAGE_TYPE_ID'] = $arFields['~STORAGE_TYPE_ID'] = $storageTypeId;
$arResult['ENABLE_DISK'] = $storageTypeId === StorageType::Disk;
$arResult['ENABLE_WEBDAV'] = $storageTypeId === StorageType::WebDav;
unset($storageTypeId);
CCrmQuote::PrepareStorageElementIDs($arFields);
$arResult['ELEMENT'] = $arFields;
unset($arFields);
if (empty($arResult['ELEMENT']['ID'])) {
    LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_QUOTE_LIST'], array()));
}