/* $arResult['FIELDS']['tab_params'][] = array( 'id' => 'C_LANG_'.$arSysLangs[$i], 'value' => '<b>['.$arSysLangs[$i].'] '.$arSysLangNames[$i].'</b>', 'colspan' => true, 'type' => 'label' ); */ $arResult['FIELDS']['tab_params'][] = array('id' => 'COUNTRY_NAME_' . $arSysLangs[$i], 'name' => GetMessage('CRM_LOC_FIELD_NAME'), 'value' => htmlspecialcharsEx($arCountry["NAME"]), 'required' => true, 'type' => 'text'); $arResult['FIELDS']['tab_params'][] = array('id' => 'COUNTRY_SHORT_NAME_' . $arSysLangs[$i], 'name' => GetMessage('CRM_LOC_FIELD_SHORT_NAME'), 'value' => htmlspecialcharsEx($arCountry["SHORT_NAME"]), 'type' => 'text'); } /* REGION SECTION */ $arResult['FIELDS']['tab_params'][] = array('id' => 'loc_region', 'name' => GetMessage('CRM_LOC_SECTION_REGION'), 'type' => 'section'); $arRegionList[CRM_LOC_NEW_REGION] = '< ' . GetMessage('CRM_LOC_NEW_REGION') . ' >'; $arRegionList[CRM_LOC_WITHOUT_REGION] = '< ' . GetMessage('CRM_LOC_WITHOUT_REGION') . ' >'; $arRegionArr = CCrmLocations::getRegionsNames($arLoc['COUNTRY_ID']); foreach ($arRegionArr as $regionID => $region) { $arRegionList[$regionID] = $region; } $arResult['FIELDS']['tab_params'][] = array('id' => 'REGION_ID', 'name' => GetMessage('CRM_LOC_FIELD_REGION_ID'), 'value' => intval($arLoc['REGION_ID']) > 0 ? $arLoc['REGION_ID'] : '', 'type' => 'list', 'required' => true, 'items' => $arRegionList); $arResult['FIELDS']['tab_params'][] = array('id' => 'REGION_NAME', 'name' => GetMessage('CRM_LOC_FIELD_NAME'), 'value' => htmlspecialcharsEx($arLoc['REGION_NAME_ORIG']), 'required' => true, 'type' => 'text'); $arResult['FIELDS']['tab_params'][] = array('id' => 'REGION_SHORT_NAME', 'name' => GetMessage('CRM_LOC_FIELD_SHORT_NAME'), 'value' => htmlspecialcharsEx($arLoc['REGION_SHORT_NAME']), 'type' => 'text'); for ($i = 0; $i < $countLang; $i++) { $arRegion = CSaleLocation::GetRegionLangByID($arLoc['REGION_ID'], $arSysLangs[$i]); /* $arResult['FIELDS']['tab_params'][] = array( 'id' => 'R_LANG_'.$arSysLangs[$i], 'value' => '<b>['.$arSysLangs[$i].'] '.$arSysLangNames[$i].'</b>', 'colspan' => true, 'type' => 'label' );
global $USER, $APPLICATION; $arParams['PATH_TO_LOCATIONS_LIST'] = CrmCheckPath('PATH_TO_LOCATIONS_LIST', $arParams['PATH_TO_LOCATIONS_LIST'], ''); $arParams['PATH_TO_LOCATIONS_ADD'] = CrmCheckPath('PATH_TO_LOCATIONS_ADD', $arParams['PATH_TO_LOCATIONS_ADD'], '?add'); $arParams['PATH_TO_LOCATIONS_EDIT'] = CrmCheckPath('PATH_TO_LOCATIONS_EDIT', $arParams['PATH_TO_LOCATIONS_EDIT'], '?loc_id=#loc_id#&edit'); $arParams['PATH_TO_LOCATIONS_IMPORT'] = CrmCheckPath('PATH_TO_LOCATIONS_IMPORT', $arParams['PATH_TO_LOCATIONS_IMPORT'], '?import'); if (!isset($arParams['TYPE'])) { $arParams['TYPE'] = 'list'; } $arResult['BUTTONS'] = array(); $locID = isset($arParams['LOC_ID']) ? strval($arParams['LOC_ID']) : ''; $CrmPerms = new CCrmPerms($USER->GetID()); $locAdd = $locEdit = $locDelete = $locImport = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE'); if (CSaleLocation::isLocationProMigrated()) { $exists = intval($locID > 0) && CCrmLocations::CheckLocationExists($locID); } else { $exists = intval($locID > 0) && is_array(CCrmLocations::GetByID($locID)); } ######################## ######################## ######################## // LIST if ($arParams['TYPE'] == 'list') { $parentId = false; // STEP UP IN LIST if (CSaleLocation::isLocationProEnabled()) { $filterParentId = false; if (isset($_REQUEST['PARENT_ID'])) { $filterParentId = intval($_REQUEST['PARENT_ID']); } else { $gridOpts = new CCrmGridOptions('CRM_LOC_LIST'); $filter = $gridOpts->GetFilter(array());
$showUrl = isset($entityFields['UF_QUOTE_SHOW_URL']) ? $entityFields['UF_QUOTE_SHOW_URL'] : ''; if ($showUrl === '') { $showUrl = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Quote, $v, true); } if ($showUrl === '') { $entityData[$k] = array('type' => 'text', 'data' => array('text' => $caption)); } else { $entityData[$k] = array('type' => 'link', 'data' => array('text' => $caption, 'url' => $showUrl)); } } } elseif ($k === 'RESPONSIBLE_ID') { $entityData['RESPONSIBLE_ID'] = __CrmQuickPanelViewPrepareResponsible($entityFields, $userProfilePath, $nameTemplate, $enableInstantEdit, $arResult['INSTANT_EDITOR_ID'], $arResult['SERVICE_URL'], 'RESPONSIBLE', false); } elseif ($k === 'PR_LOCATION') { //HACK: EDIT FORM REFERS 'PR_LOCATION' BY 'LOCATION_ID' $k = 'LOCATION_ID'; $entityData[$k] = array('type' => 'text', 'data' => array('text' => $v > 0 ? CCrmLocations::getLocationString($v) : GetMessage('CRM_ENTITY_QPV_LOCATION_NOT_ASSIGNED'))); } elseif ($k === 'PAY_SYSTEM_ID') { $entityData[$k] = array('type' => 'text', 'data' => array('text' => isset($entityFields['PAY_SYSTEM_NAME']) ? $entityFields['PAY_SYSTEM_NAME'] : GetMessage('CRM_ENTITY_QPV_PAY_SYSTEM_NOT_ASSIGNED'))); } elseif ($k === 'COMMENTS') { $entityData[$k] = array('type' => 'html', 'editable' => $enableInstantEdit, 'data' => array('html' => $entityFields[$k], 'serviceUrl' => $arResult['SERVICE_URL'])); } else { $entityData[$k] = array('type' => 'text', 'editable' => $enableInstantEdit, 'data' => array('text' => $entityFields[$k])); } if ($k === 'PAY_VOUCHER_DATE' || $k === 'PAY_VOUCHER_NUM' || $k == 'REASON_MARKED_SUCCESS') { $entityData[$k]['visible'] = $isSuccessfullStatus; } elseif ($k === 'DATE_MARKED' || $k === 'REASON_MARKED') { $entityData[$k]['visible'] = $isFailedStatus; } $caption = isset($formFieldNames[$k]) ? $formFieldNames[$k] : ''; if ($caption === '') { $caption = CCrmInvoice::GetFieldCaption($k);
$arResult['EDITABLE_FIELDS'][] = 'OPENED'; } $arResult['FIELDS']['tab_1'][] = array('id' => 'OPENED', 'name' => GetMessage('CRM_QUOTE_FIELD_OPENED'), 'type' => 'label', 'params' => array(), 'value' => $arResult['ELEMENT']['~OPENED'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'), 'isTactile' => true); // <-- OPENED //<-- QUOTE SECTION // CONTACT INFO SECTION --> $arResult['FIELDS']['tab_1'][] = array('id' => 'section_contact_info', 'name' => GetMessage('CRM_SECTION_CLIENT_INFO'), 'type' => 'section', 'isTactile' => true); // CONTACT_ID --> $arResult['FIELDS']['tab_1'][] = array('id' => 'CONTACT_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_CONTACT_TITLE'), 'value' => isset($arResult['ELEMENT']['CONTACT_FULL_NAME']) ? $CCrmQuote->cPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'READ') ? $arResult['ELEMENT']['CONTACT_FULL_NAME'] : '<a href="' . $arResult['PATH_TO_CONTACT_SHOW'] . '" id="balloon_' . $arResult['GRID_ID'] . '_C_' . $arResult['ELEMENT']['CONTACT_ID'] . '">' . $arResult['ELEMENT']['CONTACT_FULL_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip("CONTACT_' . $arResult['ELEMENT']['~CONTACT_ID'] . '", "balloon_' . $arResult['GRID_ID'] . '_C_' . $arResult['ELEMENT']['CONTACT_ID'] . '", "/bitrix/components/bitrix/crm.contact.show/card.ajax.php", "crm_balloon_contact", true);</script>' : '', 'type' => 'custom', 'isTactile' => true); //<-- CONTACT_ID // COMAPANY_ID --> $arResult['FIELDS']['tab_1'][] = array('id' => 'COMPANY_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_COMPANY_TITLE'), 'value' => isset($arResult['ELEMENT']['COMPANY_TITLE']) ? $CCrmQuote->cPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'READ') ? $arResult['ELEMENT']['COMPANY_TITLE'] : '<a href="' . $arResult['PATH_TO_COMPANY_SHOW'] . '" id="balloon_' . $arResult['GRID_ID'] . '_CO_' . $arResult['ELEMENT']['COMPANY_ID'] . '">' . $arResult['ELEMENT']['COMPANY_TITLE'] . '</a>' . '<script type="text/javascript">BX.tooltip("COMPANY_' . $arResult['ELEMENT']['~COMPANY_ID'] . '", "balloon_' . $arResult['GRID_ID'] . '_CO_' . $arResult['ELEMENT']['COMPANY_ID'] . '", "/bitrix/components/bitrix/crm.company.show/card.ajax.php", "crm_balloon_company", true);</script>' : '', 'type' => 'custom', 'isTactile' => true); //<-- COMAPANY_ID // LOCATION_ID --> if ($bTaxMode) { $arResult['FIELDS']['tab_1'][] = array('id' => 'LOCATION_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_LOCATION_ID'), 'params' => array('size' => 50), 'type' => 'label', 'value' => isset($arResult['ELEMENT']['LOCATION_ID']) ? CCrmLocations::getLocationString($arResult['ELEMENT']['LOCATION_ID']) : '', 'isTactile' => true); } //<-- LOCATION_ID // Client fields foreach (CCrmQuote::GetClientFields() as $fieldName) { if ($fieldName === 'CLIENT_TPA_ID' && LANGUAGE_ID !== 'ru') { continue; } $clientField = array('id' => $fieldName, 'name' => GetMessage('CRM_QUOTE_FIELD_' . $fieldName), 'params' => array('size' => 255), 'value' => isset($arResult['ELEMENT']['~' . $fieldName]) ? $arResult['ELEMENT']['~' . $fieldName] : '', 'type' => 'label', 'isTactile' => true); if ($fieldName === 'CLIENT_CONTACT') { $clientField['visible'] = isset($arPersonTypes['COMPANY']) && $arResult['ELEMENT']['PERSON_TYPE_ID'] == $arPersonTypes['COMPANY']; } $arResult['FIELDS']['tab_1'][] = $clientField; } unset($bHideClientContact, $clientField, $fieldName); // FILES -->
if ($ID <= 0) { break; } $arCountry = CSaleLocation::GetCountryByID($ID); $arCountry['COUNTRY_NAME'] = $arCountry['NAME']; $arCountry['COUNTRY_SHORT_NAME'] = $arCountry['SHORT_NAME']; unset($arCountry['NAME']); unset($arCountry['SHORT_NAME']); $countLang = count($arSysLangs); for ($i = 0; $i < $countLang; $i++) { $arLngCountry = CSaleLocation::GetCountryLangByID($ID, $arSysLangs[$i]); $arCountry['COUNTRY_NAME_' . $arSysLangs[$i]] = $arLngCountry['NAME']; $arCountry['COUNTRY_SHORT_NAME_' . $arSysLangs[$i]] = $arLngCountry['SHORT_NAME_']; } $arReturn['COUNTRY'] = $arCountry; $arRegions = CCrmLocations::getRegionsNames($ID); $arReturn['COUNTRY']['REGIONS'] = array(); foreach ($arRegions as $id => $region) { $arReturn['COUNTRY']['REGIONS'][] = array($id, $region); } break; case 'get_region_params': $arRegion = CSaleLocation::GetRegionByID($ID); $arRegion['REGION_NAME'] = $arRegion['NAME']; $arRegion['REGION_SHORT_NAME'] = $arRegion['SHORT_NAME']; unset($arRegion['NAME']); unset($arRegion['SHORT_NAME']); $countLang = count($arSysLangs); for ($i = 0; $i < $countLang; $i++) { $arLngCountry = CSaleLocation::GetRegionLangByID($ID, $arSysLangs[$i]); $arRegion['REGION_NAME_' . $arSysLangs[$i]] = $arLngCountry['NAME'];
$arActions[] = array('ICONCLASS' => 'view', 'TITLE' => GetMessage('CRM_TAX_EDIT_TITLE'), 'TEXT' => GetMessage('CRM_TAX_EDIT'), 'ONCLICK' => 'jsUtils.Redirect([], \'' . CUtil::JSEscape($arTax['PATH_TO_TAX_EDIT']) . '\');', 'DEFAULT' => true); } if ($arResult['CAN_DELETE']) { $arActions[] = array('SEPARATOR' => true); $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_TAX_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_TAX_DELETE'), 'ONCLICK' => 'crm_tax_delete_grid(\'' . CUtil::JSEscape(GetMessage('CRM_TAX_DELETE_TITLE')) . '\', \'' . CUtil::JSEscape(sprintf(GetMessage('CRM_TAX_DELETE_CONFIRM'), htmlspecialcharsbx($arTax['NAME']))) . '\', \'' . CUtil::JSEscape(GetMessage('CRM_TAX_DELETE')) . '\', \'' . CUtil::JSEscape($arTax['PATH_TO_TAX_DELETE']) . '\')'); } $arResult['GRID_DATA'][] = array('id' => $key, 'actions' => $arActions, 'data' => $arTax, 'editable' => $arResult['CAN_EDIT'] ? true : $arColumns, 'columns' => array('NAME' => '<a target="_self" href="' . $arTax['PATH_TO_TAX_EDIT'] . '">' . htmlspecialcharsbx($arTax['NAME']) . '</a>', 'TIMESTAMP_X' => $arTax['TIMESTAMP_X'], 'LID' => $arTax['LID'], 'CODE' => $arTax['CODE'], 'STAV' => $arTax['STAV'])); } unset($arTax); $APPLICATION->IncludeComponent('bitrix:main.interface.grid', '', array('GRID_ID' => $arResult['GRID_ID'], 'HEADERS' => $arResult['HEADERS'], 'SORT' => $arResult['SORT'], 'SORT_VARS' => $arResult['SORT_VARS'], 'ROWS' => $arResult['GRID_DATA'], 'FOOTER' => array(array('title' => GetMessage('CRM_ALL'), 'value' => $arResult['ROWS_COUNT'])), 'EDITABLE' => $arResult['CAN_EDIT'], 'ACTIONS' => array('delete' => $arResult['CAN_DELETE'], 'list' => array()), 'ACTION_ALL_ROWS' => true, 'NAV_OBJECT' => $arResult['TAXIES'], 'FORM_ID' => $arResult['FORM_ID'], 'TAB_ID' => $arResult['TAB_ID'], 'AJAX_MODE' => 'N'), $component); ?> <script type="text/javascript"> <?php if (!CCrmLocations::isLocationsCreated()) { ?> crmShowSetLocationsDialog(); <?php } ?> function crm_tax_delete_grid(title, message, btnTitle, path) { var d = new BX.CDialog( { title: title, head: '', content: message, resizable: false,