public static function PreparePopupItems($currencyID = '', $count = 50, $enableRawPrices = false)
 {
     $currencyID = strval($currencyID);
     if (!isset($currencyID[0])) {
         $currencyID = CCrmCurrency::GetBaseCurrencyID();
     }
     $count = intval($count);
     if ($count <= 0) {
         $count = 50;
     }
     $arSelect = array('ID', 'NAME', 'PRICE', 'CURRENCY_ID');
     $arPricesSelect = $arVatsSelect = array();
     $arSelect = CCrmProduct::DistributeProductSelect($arSelect, $arPricesSelect, $arVatsSelect);
     $rs = CCrmProduct::GetList(array('ID' => 'DESC'), array('ACTIVE' => 'Y', 'CATALOG_ID' => CCrmCatalog::EnsureDefaultExists()), $arSelect, $count);
     $arProducts = array();
     $arProductId = array();
     while ($product = $rs->Fetch()) {
         foreach ($arPricesSelect as $fieldName) {
             $product[$fieldName] = null;
         }
         foreach ($arVatsSelect as $fieldName) {
             $product[$fieldName] = null;
         }
         $arProductId[] = $product['ID'];
         $arProducts[$product['ID']] = $product;
     }
     CCrmProduct::ObtainPricesVats($arProducts, $arProductId, $arPricesSelect, $arVatsSelect, $enableRawPrices);
     $measureInfos = \Bitrix\Crm\Measure::getProductMeasures($arProductId);
     $productVatInfos = CCrmProduct::PrepareCatalogProductFields($arProductId);
     unset($arProductId, $arPricesSelect, $arVatsSelect);
     $defaultMeasureInfo = \Bitrix\Crm\Measure::getDefaultMeasure();
     $result = array();
     foreach ($arProducts as $productID => &$product) {
         if ($currencyID != $product['CURRENCY_ID']) {
             $product['PRICE'] = CCrmCurrency::ConvertMoney($product['PRICE'], $product['CURRENCY_ID'], $currencyID);
             $product['CURRENCY_ID'] = $currencyID;
         }
         $customData = array('price' => $product['PRICE']);
         if (isset($measureInfos[$productID]) && !empty($measureInfos[$productID])) {
             $measureIfo = $measureInfos[$productID][0];
             $customData['measure'] = array('code' => $measureIfo['CODE'], 'name' => $measureIfo['SYMBOL']);
         } elseif ($defaultMeasureInfo !== null) {
             $customData['measure'] = array('code' => $defaultMeasureInfo['CODE'], 'name' => $defaultMeasureInfo['SYMBOL']);
         }
         if (isset($productVatInfos[$productID])) {
             $productVatInfo = $productVatInfos[$productID];
             $customData['tax'] = array('id' => $productVatInfo['TAX_ID'], 'included' => $enableRawPrices && $productVatInfo['TAX_INCLUDED']);
         }
         $result[] = array('title' => $product['NAME'], 'desc' => CCrmProduct::FormatPrice($product), 'id' => $product['ID'], 'url' => '', 'type' => 'product', 'selected' => false, 'customData' => &$customData);
         unset($customData);
     }
     unset($product, $arProducts);
     return $result;
 }
Exemple #2
0
        $arSelect = array('ID', 'NAME', 'PRICE', 'CURRENCY_ID');
        $arPricesSelect = $arVatsSelect = array();
        $arSelect = CCrmProduct::DistributeProductSelect($arSelect, $arPricesSelect, $arVatsSelect);
        $obRes = CCrmProduct::GetList(array('ID' => 'DESC'), array('ID' => $arSelected['PRODUCT']), $arSelect);
        $arProducts = $arProductId = array();
        while ($arRes = $obRes->Fetch()) {
            foreach ($arPricesSelect as $fieldName) {
                $arRes[$fieldName] = null;
            }
            foreach ($arVatsSelect as $fieldName) {
                $arRes[$fieldName] = null;
            }
            $arProductId[] = $arRes['ID'];
            $arProducts[$arRes['ID']] = $arRes;
        }
        CCrmProduct::ObtainPricesVats($arProducts, $arProductId, $arPricesSelect, $arVatsSelect);
        unset($arProductId, $arPricesSelect, $arVatsSelect);
        foreach ($arProducts as $arRes) {
            $arRes['SID'] = $arResult['PREFIX'] == 'Y' ? 'D_' . $arRes['ID'] : $arRes['ID'];
            if (isset($arResult['SELECTED'][$arRes['SID']])) {
                unset($arResult['SELECTED'][$arRes['SID']]);
                $sSelected = 'Y';
            } else {
                $sSelected = 'N';
            }
            $ar[] = array('title' => $arRes['NAME'], 'desc' => CCrmProduct::FormatPrice($arRes), 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_product_show'), array('product_id' => $arRes['ID'])), 'type' => 'product', 'selected' => $sSelected);
        }
        unset($arProducts);
        $arResult['ELEMENT'] = array_merge($ar, $arResult['ELEMENT']);
    }
}
Exemple #3
0
            $arPropertyValues[$propID][] = nl2br(htmlspecialcharsex($arProperty["VALUE"]));
        }
    }
    unset($rsProperties, $arProperty, $propID);
}
$arResult['PROPERTY_VALUES'] = $arPropertyValues;
unset($arPropertyValues);
$arResult['FIELDS'] = array();
$arResult['FIELDS']['tab_1'][] = array('id' => 'product_info', 'name' => GetMessage('CRM_SECTION_PRODUCT_INFO'), 'type' => 'section', 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'ID', 'name' => 'ID', 'type' => 'label', 'params' => array('size' => 50), 'value' => $product['ID'], 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'NAME', 'name' => GetMessage('CRM_PRODUCT_FIELD_NAME'), 'params' => array('size' => 50), 'type' => 'label', 'value' => isset($product['~NAME']) ? $product['~NAME'] : '', 'isTactile' => true);
if (isset($product['~DESCRIPTION']) && strlen($product['~DESCRIPTION']) > 0) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'DESCRIPTION', 'name' => GetMessage('CRM_FIELD_DESCRIPTION'), 'params' => array('size' => 50), 'type' => 'label', 'value' => $product['~DESCRIPTION'], 'isTactile' => true);
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'ACTIVE', 'name' => GetMessage('CRM_FIELD_ACTIVE'), 'type' => 'label', 'params' => array(), 'value' => GetMessage(isset($product['ACTIVE']) && $product['ACTIVE'] == 'Y' ? 'MAIN_YES' : 'MAIN_NO'), 'isTactile' => true);
$price = CCrmProduct::FormatPrice($product);
if (strlen($price) > 0) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'PRICE', 'name' => GetMessage('CRM_FIELD_PRICE'), 'type' => 'label', 'params' => array(), 'value' => $price, 'isTactile' => true);
}
if ($bVatMode) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'VAT_ID', 'name' => GetMessage('CRM_FIELD_VAT_ID'), 'type' => 'label', 'params' => array(), 'value' => htmlspecialcharsbx(isset($product['VAT_ID']) && $product['VAT_ID'] > 0 ? $vatRateListItems[$product['VAT_ID']] : $vatRateListItems['']), 'isTactile' => true);
    $arResult['FIELDS']['tab_1'][] = array('id' => 'VAT_INCLUDED', 'name' => GetMessage('CRM_FIELD_VAT_INCLUDED'), 'type' => 'label', 'params' => array(), 'value' => GetMessage(isset($product['VAT_INCLUDED']) && $product['VAT_INCLUDED'] == 'Y' ? 'MAIN_YES' : 'MAIN_NO'), 'isTactile' => true);
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'MEASURE', 'name' => GetMessage('CRM_FIELD_MEASURE'), 'type' => 'label', 'params' => array(), 'value' => htmlspecialcharsbx(isset($product['MEASURE']) ? $measureListItems[$product['MEASURE']] : $measureListItems['']), 'isTactile' => true);
$productSectionID = isset($product['SECTION_ID']) ? $product['SECTION_ID'] : 0;
$productSectionName = '';
if ($productSectionID > 0) {
    $sectionListItems = array();
    $rsSection = CIBlockSection::GetByID($productSectionID);
    if ($arSection = $rsSection->Fetch()) {
        $productSectionName = $arSection['NAME'];
Exemple #4
0
		unset($arProductId, $arPricesSelect, $arVatsSelect);

		foreach ($arProducts as $arRes)
		{
			$arRes['SID'] = $arResult['PREFIX'] == 'Y'? 'D_'.$arRes['ID']: $arRes['ID'];
			if (isset($arResult['SELECTED'][$arRes['SID']]))
			{
				unset($arResult['SELECTED'][$arRes['SID']]);
				$sSelected = 'Y';
			}
			else
				$sSelected = 'N';

			$ar[] = array(
				'title' => $arRes['NAME'],
				'desc' => CCrmProduct::FormatPrice($arRes),
				'id' => $arRes['SID'],
				'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_product_show'),
					array(
						'product_id' => $arRes['ID']
					)
				),
				'type'  => 'product',
				'selected' => $sSelected
			);
		}
		unset($arProducts);
		$arResult['ELEMENT'] = array_merge($ar, $arResult['ELEMENT']);
	}
}
?>
Exemple #5
0
    if (strlen($dstCurrencyID) > 0 && strlen($srcCurrencyID) > 0 && $dstCurrencyID != $srcCurrencyID) {
        $arRes['PRICE'] = CCrmCurrency::ConvertMoney($arRes['PRICE'], $srcCurrencyID, $dstCurrencyID);
        $arRes['CURRENCY_ID'] = $dstCurrencyID;
    }
    $productID = $arRes['ID'];
    $customData = array('price' => $arRes['PRICE']);
    if (isset($measureInfos[$productID]) && !empty($measureInfos[$productID])) {
        $measureIfo = $measureInfos[$productID][0];
        $customData['measure'] = array('code' => $measureIfo['CODE'], 'name' => $measureIfo['SYMBOL']);
    } elseif ($defaultMeasureInfo !== null) {
        $customData['measure'] = array('code' => $defaultMeasureInfo['CODE'], 'name' => $defaultMeasureInfo['SYMBOL']);
    }
    if (isset($productVatInfos[$productID])) {
        $productVatInfo = $productVatInfos[$productID];
        $customData['tax'] = array('id' => $productVatInfo['TAX_ID'], 'included' => $enableRawPrices && $productVatInfo['TAX_INCLUDED']);
    }
    $arData[] = array('id' => $multi ? 'PROD_' . $arRes['ID'] : $arRes['ID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_product_show'), array('product_id' => $arRes['ID'])), 'title' => $arRes['NAME'], 'desc' => CCrmProduct::FormatPrice($arRes), 'type' => 'product', 'customData' => &$customData);
    unset($customData);
    if ($limit > 0 && ++$i === $limit) {
        break;
    }
}
unset($arProducts);
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
if ($bResultWithValue) {
    $arResponse = array('searchValue' => $_REQUEST['VALUE'], 'data' => $arData);
    echo CUtil::PhpToJsObject($arResponse);
} else {
    echo CUtil::PhpToJsObject($arData);
}
die;
Exemple #6
0
 protected function prepareCrmSelectorItem($ufInfo)
 {
     /** @global CUser $USER */
     global $USER;
     $result = false;
     $selectorItem = array();
     if (!CModule::IncludeModule('crm')) {
         return $result;
     }
     $CCrmPerms = new CCrmPerms($USER->GetID());
     $nPermittedEntityTypes = 0;
     if ($ufInfo['SETTINGS']['LEAD'] == 'Y' && !$CCrmPerms->HavePerm('LEAD', BX_CRM_PERM_NONE, 'READ')) {
         $nPermittedEntityTypes++;
     }
     if ($ufInfo['SETTINGS']['CONTACT'] == 'Y' && !$CCrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'READ')) {
         $nPermittedEntityTypes++;
     }
     if ($ufInfo['SETTINGS']['COMPANY'] == 'Y' && !$CCrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'READ')) {
         $nPermittedEntityTypes++;
     }
     if ($ufInfo['SETTINGS']['DEAL'] == 'Y' && !$CCrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'READ')) {
         $nPermittedEntityTypes++;
     }
     if ($ufInfo['SETTINGS']['QUOTE'] == 'Y' && !$CCrmPerms->HavePerm('QUOTE', BX_CRM_PERM_NONE, 'READ')) {
         $nPermittedEntityTypes++;
     }
     if ($ufInfo['SETTINGS']['PRODUCT'] == 'Y' && $CCrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ')) {
         $nPermittedEntityTypes++;
     }
     $usePrefix = true;
     /*$nPermittedEntityTypes > 1;*/
     // last 50 entity
     $entityTypes = array();
     $elements = array();
     $arSettings = $ufInfo['SETTINGS'];
     if (isset($arSettings['LEAD']) && $arSettings['LEAD'] == 'Y') {
         $entityTypes[] = 'lead';
         $arSelect = array('ID', 'TITLE', 'FULL_NAME', 'STATUS_ID');
         $obRes = CCrmLead::GetList(array('ID' => 'DESC'), array(), $arSelect, 50);
         $arFiles = array();
         while ($arRes = $obRes->Fetch()) {
             $arRes['SID'] = $usePrefix ? 'L_' . $arRes['ID'] : $arRes['ID'];
             $elements[] = array('title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => $arRes['FULL_NAME'], 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $arRes['ID'])), 'type' => 'lead', 'selected' => 'N');
         }
     }
     if (isset($arSettings['CONTACT']) && $arSettings['CONTACT'] == 'Y') {
         $entityTypes[] = 'contact';
         $arSelect = array('ID', 'FULL_NAME', 'COMPANY_TITLE', 'PHOTO');
         $obRes = CCrmContact::GetList(array('ID' => 'DESC'), array(), $arSelect, 50);
         while ($arRes = $obRes->Fetch()) {
             $strImg = '';
             if (!empty($arRes['PHOTO']) && !isset($arFiles[$arRes['PHOTO']])) {
                 if ($arFile = CFile::GetFileArray($arRes['PHOTO'])) {
                     $arImg = CFile::ResizeImageGet($arFile, array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
                     if (is_array($arImg) && isset($arImg['src'])) {
                         $strImg = CHTTP::URN2URI($arImg['src'], '', true);
                     }
                 }
             }
             $arRes['SID'] = $usePrefix ? 'C_' . $arRes['ID'] : $arRes['ID'];
             $elements[] = array('title' => str_replace(array(';', ','), ' ', $arRes['FULL_NAME']), 'desc' => empty($arRes['COMPANY_TITLE']) ? '' : $arRes['COMPANY_TITLE'], 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $arRes['ID'])), 'image' => $strImg, 'type' => 'contact', 'selected' => 'N');
         }
     }
     if (isset($arSettings['COMPANY']) && $arSettings['COMPANY'] == 'Y') {
         $entityTypes[] = 'company';
         $arCompanyTypeList = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
         $arCompanyIndustryList = CCrmStatus::GetStatusListEx('INDUSTRY');
         $arSelect = array('ID', 'TITLE', 'COMPANY_TYPE', 'INDUSTRY', 'LOGO');
         $obRes = CCrmCompany::GetList(array('ID' => 'DESC'), array(), $arSelect, 50);
         $arFiles = array();
         while ($arRes = $obRes->Fetch()) {
             $strImg = '';
             if (!empty($arRes['LOGO']) && !isset($arFiles[$arRes['LOGO']])) {
                 if ($arFile = CFile::GetFileArray($arRes['LOGO'])) {
                     $arImg = CFile::ResizeImageGet($arFile, array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
                     if (is_array($arImg) && isset($arImg['src'])) {
                         $strImg = CHTTP::URN2URI($arImg['src'], '', true);
                     }
                 }
                 $arFiles[$arRes['LOGO']] = $strImg;
             }
             $arRes['SID'] = $usePrefix ? 'CO_' . $arRes['ID'] : $arRes['ID'];
             $arDesc = array();
             if (isset($arCompanyTypeList[$arRes['COMPANY_TYPE']])) {
                 $arDesc[] = $arCompanyTypeList[$arRes['COMPANY_TYPE']];
             }
             if (isset($arCompanyIndustryList[$arRes['INDUSTRY']])) {
                 $arDesc[] = $arCompanyIndustryList[$arRes['INDUSTRY']];
             }
             $elements[] = array('title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => implode(', ', $arDesc), 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $arRes['ID'])), 'image' => $strImg, 'type' => 'company', 'selected' => 'N');
         }
     }
     if (isset($arSettings['DEAL']) && $arSettings['DEAL'] == 'Y') {
         $entityTypes[] = 'deal';
         $arDealStageList = CCrmStatus::GetStatusListEx('DEAL_STAGE');
         $arSelect = array('ID', 'TITLE', 'STAGE_ID', 'COMPANY_TITLE', 'CONTACT_FULL_NAME');
         $obRes = CCrmDeal::GetList(array('ID' => 'DESC'), array(), $arSelect, 50);
         while ($arRes = $obRes->Fetch()) {
             $arRes['SID'] = $usePrefix ? 'D_' . $arRes['ID'] : $arRes['ID'];
             $clientTitle = !empty($arRes['COMPANY_TITLE']) ? $arRes['COMPANY_TITLE'] : '';
             $clientTitle .= ($clientTitle !== '' && !empty($arRes['CONTACT_FULL_NAME']) ? ', ' : '') . $arRes['CONTACT_FULL_NAME'];
             $elements[] = array('title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => $clientTitle, 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $arRes['ID'])), 'type' => 'deal', 'selected' => 'N');
         }
     }
     if (isset($arSettings['QUOTE']) && $arSettings['QUOTE'] == 'Y') {
         $entityTypes[] = 'quote';
         $arSelect = array('ID', 'QUOTE_NUMBER', 'TITLE', 'COMPANY_TITLE', 'CONTACT_FULL_NAME');
         $obRes = CCrmQuote::GetList(array('ID' => 'DESC'), array(), false, array('nTopCount' => 50), array('ID', 'QUOTE_NUMBER', 'TITLE', 'COMPANY_TITLE', 'CONTACT_FULL_NAME'));
         while ($arRes = $obRes->Fetch()) {
             $arRes['SID'] = $usePrefix ? 'Q_' . $arRes['ID'] : $arRes['ID'];
             $clientTitle = !empty($arRes['COMPANY_TITLE']) ? $arRes['COMPANY_TITLE'] : '';
             $clientTitle .= ($clientTitle !== '' && !empty($arRes['CONTACT_FULL_NAME']) ? ', ' : '') . $arRes['CONTACT_FULL_NAME'];
             $quoteTitle = empty($arRes['TITLE']) ? $arRes['QUOTE_NUMBER'] : $arRes['QUOTE_NUMBER'] . ' - ' . $arRes['TITLE'];
             $elements[] = array('title' => empty($quoteTitle) ? '' : str_replace(array(';', ','), ' ', $quoteTitle), 'desc' => $clientTitle, 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_quote_show'), array('quote_id' => $arRes['ID'])), 'type' => 'quote', 'selected' => 'N');
         }
     }
     if (isset($arSettings['PRODUCT']) && $arSettings['PRODUCT'] == 'Y') {
         $entityTypes[] = 'product';
         $arSelect = array('ID', 'NAME', 'PRICE', 'CURRENCY_ID');
         $arPricesSelect = $arVatsSelect = array();
         $arSelect = CCrmProduct::DistributeProductSelect($arSelect, $arPricesSelect, $arVatsSelect);
         $obRes = CCrmProduct::GetList(array('ID' => 'DESC'), array('ACTIVE' => 'Y'), $arSelect, 50);
         $arProducts = $arProductId = array();
         while ($arRes = $obRes->Fetch()) {
             foreach ($arPricesSelect as $fieldName) {
                 $arRes[$fieldName] = null;
             }
             foreach ($arVatsSelect as $fieldName) {
                 $arRes[$fieldName] = null;
             }
             $arProductId[] = $arRes['ID'];
             $arProducts[$arRes['ID']] = $arRes;
         }
         CCrmProduct::ObtainPricesVats($arProducts, $arProductId, $arPricesSelect, $arVatsSelect);
         unset($arProductId, $arPricesSelect, $arVatsSelect);
         foreach ($arProducts as $arRes) {
             $arRes['SID'] = $usePrefix ? 'PROD_' . $arRes['ID'] : $arRes['ID'];
             $elements[] = array('title' => $arRes['NAME'], 'desc' => CCrmProduct::FormatPrice($arRes), 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_product_show'), array('product_id' => $arRes['ID'])), 'type' => 'product', 'selected' => 'N');
         }
         unset($arProducts);
     }
     $selectorItem['USER_TYPE_ID'] = $ufInfo['USER_TYPE_ID'];
     $selectorItem['ENTITY_ID'] = $ufInfo['ENTITY_ID'];
     $selectorItem['FIELD_NAME'] = $ufInfo['FIELD_NAME'];
     $selectorItem['PREFIX'] = $usePrefix ? 'Y' : 'N';
     $selectorItem['MULTIPLE'] = 'Y';
     //$ufInfo['MULTIPLE'];
     $selectorItem['ENTITY_TYPE'] = $entityTypes;
     $selectorItem['ELEMENT'] = $elements;
     $result = $selectorItem;
     return $result;
 }
Exemple #7
0
     $arActions[] = array('ICONCLASS' => 'edit', 'TITLE' => GetMessage('CRM_PRODUCT_EDIT_TITLE'), 'TEXT' => GetMessage('CRM_PRODUCT_EDIT'), 'ONCLICK' => 'jsUtils.Redirect([], \'' . CUtil::JSEscape(CHTTP::urlAddParams($arProduct['PATH_TO_PRODUCT_EDIT'], array('list_section_id' => $arResult['BACK_URL_SECTION_ID']))) . '\');');
 }
 if ($arProduct['DELETE'] && !$arResult['INTERNAL']) {
     $arActions[] = array('SEPARATOR' => true);
     $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_PRODUCT_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_PRODUCT_DELETE'), 'ONCLICK' => 'crm_product_delete_grid(\'' . CUtil::JSEscape(GetMessage('CRM_PRODUCT_DELETE_TITLE')) . '\', \'' . CUtil::JSEscape(sprintf(GetMessage('CRM_PRODUCT_DELETE_CONFIRM'), htmlspecialcharsbx($arProduct['NAME']))) . '\', \'' . CUtil::JSEscape(GetMessage('CRM_PRODUCT_DELETE')) . '\', \'' . CUtil::JSEscape(CHTTP::urlAddParams($arProduct['PATH_TO_PRODUCT_DELETE'], array('list_section_id' => $arResult['BACK_URL_SECTION_ID']))) . '\')');
 }
 $sectionLink = '';
 if (isset($arProduct['SECTION_ID']) && array_key_exists($arProduct['SECTION_ID'], $arResult['SECTION_LIST'])) {
     $sectionData = $arResult['SECTION_LIST'][$arProduct['SECTION_ID']];
     $sectionLink = '<a href="' . htmlspecialcharsbx($sectionData['LIST_URL']) . '">' . htmlspecialcharsbx($sectionData['NAME']) . '</a>';
 }
 $obPreviewPictureFile = null;
 if (isset($arProduct['~PREVIEW_PICTURE'])) {
     $obPreviewPictureFile = new CCrmProductFile($arProduct['ID'], 'PREVIEW_PICTURE', $arProduct['~PREVIEW_PICTURE']);
 }
 $gridDataRecord = array('id' => $arProduct['TYPE'] . $arProduct['ID'], 'actions' => $arActions, 'data' => $arProduct, 'editable' => $arProduct['EDIT'] ? true : $arColumns, 'columns' => array('NAME' => '<table class="bx-crm-object-name">' . PHP_EOL . "\t" . '<tbody>' . PHP_EOL . "\t" . '<tr>' . "\t\t" . '<td style="width: 45px;">' . "\t\t\t" . '<div class="bx-crm-item-icon-container-small' . (!$obPreviewPictureFile ? ' bx-crm-item-icon icon-img' : '') . '">' . ($obPreviewPictureFile ? $obPreviewPictureFile->GetImgHtml(array('max_width' => 27, 'max_height' => 35)) : '') . '</div>' . "\t\t" . '</td>' . "\t\t" . '<td>' . "\t\t\t" . '<a target="_self" href="' . CHTTP::urlAddParams($arProduct['PATH_TO_PRODUCT_SHOW'], array('list_section_id' => $arResult['BACK_URL_SECTION_ID'])) . '">' . $arProduct['NAME'] . '</a>' . "\t\t" . '</td>' . "\t" . '</tr>' . PHP_EOL . "\t" . '</tbody>' . PHP_EOL . '</table>' . PHP_EOL, 'PRICE' => CCrmProduct::FormatPrice($arProduct), 'MEASURE' => htmlspecialcharsbx(isset($arProduct['MEASURE']) && intval($arProduct['MEASURE']) > 0 ? $arResult['MEASURE_LIST_ITEMS'][$arProduct['MEASURE']] : ''), 'SECTION_ID' => $sectionLink));
 if ($bVatMode) {
     $gridDataRecord['columns']['VAT_ID'] = htmlspecialcharsbx(isset($arProduct['VAT_ID']) ? $arResult['VAT_RATE_LIST_ITEMS'][$arProduct['VAT_ID']] : $arResult['VAT_RATE_LIST_ITEMS']['']);
 }
 // Pictures
 $arFields = array('PREVIEW_PICTURE', 'DETAIL_PICTURE');
 $html = '';
 $obFileControl = $obFile = null;
 foreach ($arFields as $fieldID) {
     if (isset($arProduct['~' . $fieldID])) {
         if ($fieldID === 'PREVIEW_PICTURE' && $obPreviewPictureFile) {
             $obFile =& $obPreviewPictureFile;
         } else {
             $obFile = new CCrmProductFile($arProduct['ID'], $fieldID, $arProduct['~' . $fieldID]);
         }
         $obFileControl = new CCrmProductFileControl($obFile, $fieldID);