$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,
Exemplo n.º 2
0
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) {