if (count($arAditFields) > 0) { CSaleOrder::Update($orderId, $arAditFields); } } else { $this->strError .= "\n" . GetMessage("CC_BSC1_ORDER_NOT_FOUND", array("#ID#" => $orderId)); } } } } $position = false; $loader = new OrderLoader(); $o = new CXMLFileStream(); $o->registerElementHandler("/" . GetMessage("CC_BSC1_COM_INFO"), array($loader, "elementHandler")); $o->registerNodeHandler("/" . GetMessage("CC_BSC1_COM_INFO") . "/" . GetMessage("CC_BSC1_DOCUMENT"), array($loader, "nodeHandler")); $o->setPosition(false); if ($o->openFile($new_file_name)) { while ($o->findNext()) { } } echo "success\n"; if (strlen($loader->strError) > 0) { echo $loader->strError; } } else { echo "failure\n" . GetMessage("CC_BSC1_EMPTY_CML"); } } } else { echo "failure\n", GetMessage("CC_BSC1_ERROR_UNKNOWN_COMMAND"); } }
} elseif ($_GET["mode"] == "import" && $ABS_FILE_NAME) { if (file_exists($ABS_FILE_NAME) && filesize($ABS_FILE_NAME) > 0) { if (!is_array($_SESSION["BX_CML2_EXPORT"]) || !array_key_exists("last_xml_entry", $_SESSION["BX_CML2_EXPORT"])) { $_SESSION["BX_CML2_EXPORT"]["last_xml_entry"] = ""; } $position = false; $loader = new CSaleOrderLoader(); $loader->arParams = $arParams; $loader->bNewVersion = true; $startTime = time(); $o = new CXMLFileStream(); $o->registerElementHandler("/" . GetMessage("CC_BSC1_COM_INFO"), array($loader, "elementHandler")); $o->registerNodeHandler("/" . GetMessage("CC_BSC1_COM_INFO") . "/" . GetMessage("CC_BSC1_DOCUMENT"), array($loader, "nodeHandler")); $o->registerNodeHandler("/" . GetMessage("CC_BSC1_COM_INFO") . "/" . GetMessage("CC_BSC1_AGENTS") . "/" . GetMessage("CC_BSC1_AGENT"), array($loader, "nodeHandler")); $o->setPosition($_SESSION["BX_CML2_EXPORT"]["last_xml_entry"]); if ($o->openFile($ABS_FILE_NAME)) { while ($o->findNext()) { if ($arParams["INTERVAL"] > 0) { $_SESSION["BX_CML2_EXPORT"]["last_xml_entry"] = $o->getPosition(); if (time() - $startTime > $arParams["INTERVAL"]) { break; } } } } if (!$o->endOfFile()) { echo "progress"; } else { $_SESSION["BX_CML2_EXPORT"]["last_xml_entry"] = ""; echo "success"; }