CAppUI::stepAjax("Remote name not configured", UI_MSG_ERROR);
}
if (null == ($remote_url = $clCconfig["remote_url"])) {
    CAppUI::stepAjax("Remote URL not configured", UI_MSG_ERROR);
}
if (false === ($content = file_get_contents($remote_url))) {
    CAppUI::stepAjax("Couldn't connect to remote url", UI_MSG_ERROR);
}
// Check imported catalogue document
$doc = new CMbXMLDocument();
if (!$doc->loadXML($content)) {
    CAppUI::stepAjax("Document is not well formed", UI_MSG_ERROR);
}
$tmpPath = "tmp/dPlabo/import_catalogue.xml";
CMbPath::forceDir(dirname($tmpPath));
$doc->save($tmpPath);
$doc->load($tmpPath);
if (!$doc->schemaValidate("modules/{$m}/remote/catalogue.xsd")) {
    CAppUI::stepAjax("Document is not valid", UI_MSG_ERROR);
}
CAppUI::stepAjax("Document is valid", UI_MSG_OK);
// Check access to idSante400
$canSante400 = CModule::getCanDo("dPsante400");
if (!$canSante400->edit) {
    CAppUI::stepAjax("No permission for module 'dPsante400' or module not installed", UI_MSG_ERROR);
}
// Import catalogue
$cat = new SimpleXMLElement($content);
try {
    importCatalogue($cat);
} catch (CMbException $e) {
 /**
  * @see parent::saveFinalFile
  */
 function saveFinalFile()
 {
     $this->documentfinalfilename = "{$this->finalpath}/{$this->documentfinalprefix}-{$this->now}.xml";
     CMbPath::forceDir(dirname($this->documentfinalfilename));
     parent::save($this->documentfinalfilename);
 }