Example #1
0
    return;
}
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 {