use Bitrix\Main; use Bitrix\Main\Localization\Loc; use Bitrix\Sale\Location\Migration; use Bitrix\Sale\Location\Admin\Helper; use Bitrix\Sale\Location\Admin\LocationHelper; require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php"); require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/sale/prolog.php'); $saleModulePermissions = $APPLICATION->GetGroupRight("sale"); if ($saleModulePermissions < "W") $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); Main\Loader::includeModule('sale'); include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/sale/lib/location/migration/migration.php"); Loc::loadMessages(__FILE__); $result = true; $errors = array(); try { $migration = new Migration\MigrationProcess(); $migration->hideNotifier(); // action: process ajax if(isset($_REQUEST['AJAX_MODE'])) { $data = array(); if($_REQUEST['step'] == 0) $migration->reset(); try { $data['PERCENT'] = $migration->performStage(); $data['NEXT_STAGE'] = $migration->getStageCode(); } catch(Main\SystemException $e) { $result = false; $errors[] = $e->getMessage(); } header('Content-Type: application/x-javascript; charset='.LANG_CHARSET); print(CUtil::PhpToJSObject(array( 'result' => $result, 'errors' => $errors, 'data' => $data ), false, false, true)); die(); } $migration->reset(); // reset cached data } catch(Main\SystemException $e) { $result = false; $errors[] = $e->getMessage(); } require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/sale/prolog.php"); $APPLICATION->SetTitle(Loc::getMessage('SALE_LOCATION_MIGRATION_TITLE')); require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php"); ?> htmlspecialcharsbx(implode(', ', $errors)), 'type' => 'ERROR'))?> $aTabs = array( array( "DIV" => "migration", "TAB" => Loc::getMessage("SALE_LOCATION_MIGRATION_TAB_MIGRATION_TITLE"), "ICON" => "sale", "TITLE" => Loc::getMessage("SALE_LOCATION_MIGRATION_TAB_MIGRATION_TITLE") ), ); $tabControl = new CAdminTabControl("tabctrl_migration", $aTabs, true, true); CJSCore::Init(); $APPLICATION->AddHeadScript('/bitrix/js/sale/core_ui_widget.js'); $APPLICATION->AddHeadScript('/bitrix/js/sale/core_iterator.js'); ?>