} $files = CAppUI::readFiles($path); ini_set("memory_limit", "512M"); CApp::setTimeLimit(360); CMbObject::$useObjectCache = false; $counter = 0; foreach ($files as $_file) { $xmlfile = file_get_contents("{$path}/{$_file}"); // Chargement du fichier XML $domEvenement->loadXML($xmlfile); // Création de l'échange $echg_hprim = new CEchangeHprim(); $data = $domEvenement->getEnteteEvenementXML($evt); $data = array_merge($data, $domEvenement->getContentsXML()); $dest_hprim = new CDestinataireHprim(); $dest_hprim->register($data['idClient']); $echg_hprim->date_production = $data['dateHeureProduction']; $echg_hprim->date_echange = date("Y-m-d H:m:s", filemtime("{$path}/{$_file}")); $echg_hprim->group_id = CGroups::loadCurrent()->_id; $echg_hprim->receiver_id = $dest_hprim->_id; $echg_hprim->type = $domEvenement->type; $echg_hprim->sous_type = $domEvenement->sous_type; $echg_hprim->_message = utf8_encode($xmlfile); $doc_valid = $domEvenement->schemaValidate(null, false, $dest_hprim->display_errors); $echg_hprim->message_valide = $doc_valid ? 1 : 0; if ($type == "pmsi") { $echg_hprim->object_class = "CSejour"; $echg_hprim->object_id = str_replace("sj", "", $data['idSourceVenue']); $echg_hprim->id_permanent = $data['idCibleVenue']; } elseif ($type == "actes") { $echg_hprim->object_class = "COperation";