static function initJs() { static $done = false; if (!$done) { $done = true; \CJSCore::RegisterExt('input', array('js' => '/bitrix/js/sale/input.js', 'lang' => '/bitrix/modules/sale/lang/' . LANGUAGE_ID . '/lib/internals/input.php')); \CJSCore::Init(array('input')); print '<div style="display:none">'; $GLOBALS['APPLICATION']->IncludeComponent("bitrix:sale.location.selector." . \Bitrix\Sale\Location\Admin\LocationHelper::getWidgetAppearance(), "", array("ID" => '', "CODE" => '', "INPUT_NAME" => 'SALE_LOCATION_SELECTOR_RESOURCES', "PROVIDE_LINK_BY" => 'code', "FILTER_BY_SITE" => 'Y', "SHOW_DEFAULT_LOCATIONS" => 'Y', "SEARCH_BY_PRIMARY" => 'Y', "JS_CONTROL_GLOBAL_ID" => 'SALE_LOCATION_SELECTOR_RESOURCES', "USE_JS_SPAWN" => 'Y'), false, array('HIDE_ICONS' => 'Y')); print '</div>'; } }
} } $tabControl->ShowUserFieldsWithReadyData(CompanyTable::getUfId(), $fields, false, 'ID'); $tabControl->AddCheckBoxField("ACTIVE", GetMessage("COMPANY_ACTIVE"), false, 'Y', $fields['ACTIVE'] == 'Y'); $tabControl->AddEditField("NAME", GetMessage("COMPANY_NAME"), true, array(), htmlspecialcharsbx($fields['NAME'])); $tabControl->BeginCustomField('LOCATIONS', GetMessage("COMPANY_LOCATION_ID")); if ($saleModulePermissions >= 'W') { ?> <tr> <td><strong><?php echo GetMessage("COMPANY_LOCATION_ID"); ?> </strong></td> <td> <?php $APPLICATION->IncludeComponent("bitrix:sale.location.selector." . \Bitrix\Sale\Location\Admin\LocationHelper::getWidgetAppearance(), "", array("ID" => "", "CODE" => $fields['LOCATION_ID'], "INPUT_NAME" => "LOCATION_ID", "PROVIDE_LINK_BY" => "code", "SHOW_ADMIN_CONTROLS" => 'Y', "SELECT_WHEN_SINGLE" => 'N', "FILTER_BY_SITE" => 'Y', "FILTER_SITE_ID" => Application::getInstance()->getContext()->getSite(), "SHOW_DEFAULT_LOCATIONS" => 'N', "SEARCH_BY_PRIMARY" => 'Y'), false); ?> </td> </tr> <?php } else { $res = \Bitrix\Sale\Location\LocationTable::getPathToNodeByCode($fields['LOCATION_ID'], array('select' => array('CHAIN' => 'NAME.NAME'), 'filter' => array('NAME.LANGUAGE_ID' => $lang))); $path = array(); while ($item = $res->fetch()) { $path[] = $item['CHAIN']; } $path = implode(', ', array_reverse($path)); ?> <tr> <td><?php echo GetMessage("COMPANY_LOCATION");
<?php define("STOP_STATISTICS", true); define('NO_AGENT_CHECK', true); define("DisableEventsCheck", true); require_once $_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/main/include/prolog_before.php'; use Bitrix\Main; use Bitrix\Sale\Location\Admin\LocationHelper as Helper; Main\Loader::includeModule('sale'); $APPLICATION->ShowHeadStrings(); $APPLICATION->ShowCSS(); $properties = $_REQUEST['PROPERTIES']; $APPLICATION->IncludeComponent("bitrix:sale.location.selector." . Helper::getWidgetAppearance(), "", array("ID" => intval($properties['ID']) ? intval($properties['ID']) : '', "CODE" => strlen($properties['CODE']) ? $properties['CODE'] : '', "INPUT_NAME" => $properties['INPUT_NAME'], "PROVIDE_LINK_BY" => $properties['PROVIDE_LINK_BY'] == 'id' ? 'id' : 'code', "FILTER_SITE_ID" => $properties['FILTER_SITE_ID'], "SHOW_DEFAULT_LOCATIONS" => 'Y', "SEARCH_BY_PRIMARY" => $properties['SEARCH_BY_PRIMARY'], "JS_CONTROL_GLOBAL_ID" => 'SALE_LOCATION_SELECTOR_RESOURCES', "USE_JS_SPAWN" => 'Y'), false, array('HIDE_ICONS' => 'Y'));
</option> <?endforeach?> </select> <?elseif($code == 'PARENT_ID'):?> <div style="max-width: 500px"> <?/*$APPLICATION->IncludeComponent( "bitrix:map.yandex.view", "", Array(), false );*/?> <?$APPLICATION->IncludeComponent("bitrix:sale.location.selector.".Helper::getWidgetAppearance(), "", array( "ID" => $value, "CODE" => "", "INPUT_NAME" => "element[PARENT_ID]", "PROVIDE_LINK_BY" => "id", "SHOW_ADMIN_CONTROLS" => 'Y', "SELECT_WHEN_SINGLE" => 'N', "FILTER_BY_SITE" => 'N', "SHOW_DEFAULT_LOCATIONS" => 'N', "SEARCH_BY_PRIMARY" => 'Y', "EXCLUDE_SUBTREE" => $nodeId, ), false );?>
} elseif ($code == 'PARENT_ID') { ?> <div style="max-width: 500px"> <?php /*$APPLICATION->IncludeComponent( "bitrix:map.yandex.view", "", Array(), false );*/ ?> <?php $APPLICATION->IncludeComponent("bitrix:sale.location.selector." . Helper::getWidgetAppearance(), "", array("ID" => $value, "CODE" => "", "INPUT_NAME" => "element[PARENT_ID]", "PROVIDE_LINK_BY" => "id", "SHOW_ADMIN_CONTROLS" => 'Y', "SELECT_WHEN_SINGLE" => 'N', "FILTER_BY_SITE" => 'N', "SHOW_DEFAULT_LOCATIONS" => 'N', "SEARCH_BY_PRIMARY" => 'Y', "EXCLUDE_SUBTREE" => $nodeId), false); ?> </div> <?php } else { ?> <input type="text" name="element[<?php echo $code; ?> ]" value="<?php echo $value; ?> " <?php
foreach ($arResult['FIELDS'] as $field) { if (!$geoHeadingShown && ($field['id'] == 'LATITUDE' || $field['id'] == 'LONGITUDE')) { $arTabs['tab_params']['fields'][] = array('id' => 'geo_heading', 'name' => Loc::getMessage('CRM_CLE2_HEADING_GEO'), 'type' => 'section'); $geoHeadingShown = true; } if (!$nameHeadingShown && strpos($field['id'], 'NAME') !== false) { $arTabs['tab_params']['fields'][] = array('id' => 'name_heading', 'name' => Loc::getMessage('CRM_CLE2_HEADING_NAMES'), 'type' => 'section'); $nameHeadingShown = true; } if ($field['id'] == 'ID') { $field['type'] = 'label'; $field['value'] = intval($field['value']) ? intval($field['value']) : Loc::getMessage('CRM_CLE2_NEW_ITEM'); } elseif ($field['id'] == 'PARENT_ID') { $field['type'] = 'custom'; ob_start(); $APPLICATION->IncludeComponent("bitrix:sale.location.selector." . Helper::getWidgetAppearance(), "", array("ID" => intval($field['value']) ? intval($field['value']) : '', "INPUT_NAME" => "PARENT_ID", "PROVIDE_LINK_BY" => "id", "SHOW_ADMIN_CONTROLS" => 'N', "SELECT_WHEN_SINGLE" => 'N', "FILTER_BY_SITE" => 'N', "SHOW_DEFAULT_LOCATIONS" => 'N', "SEARCH_BY_PRIMARY" => 'N', "ADMIN_MODE" => 'Y'), false); $field['value'] = ob_get_contents(); ob_end_clean(); } elseif ($field['id'] == 'TYPE_ID') { $field['type'] = 'list'; $field['items'] = array(); $field['items'][''] = Loc::getMessage('CRM_CLE2_NOT_SELECTED'); foreach ($arResult['TYPES'] as $id => $value) { $field['items'][$id] = htmlspecialcharsbx($value); } } elseif ($field['id'] == 'EXTERNAL') { $field['type'] = 'custom'; $field['name'] = Loc::getMessage('CRM_CLE2_TAB_EXTERNAL'); ob_start(); ?>