/**
  * Try to validate the document against a schema will trigger errors when not validating
  *
  * @param string $filename       Path of schema, use document inline schema if null
  * @param bool   $returnErrors   Return errors
  * @param bool   $display_errors Display errors
  *
  * @return boolean
  */
 function schemaValidate($filename = null, $returnErrors = false, $display_errors = true)
 {
     if (!CAppUI::conf("hprimxml " . $this->evenement . " validation")) {
         return true;
     }
     return parent::schemaValidate($filename, $returnErrors, $display_errors);
 }
 function schemaValidate($filename = null, $returnErrors = false)
 {
     if (!CAppUI::conf("dPurgences rpu_xml_validation")) {
         return true;
     }
     return parent::schemaValidate($filename, $returnErrors);
 }
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) {
    $e->stepAjax();
}
Beispiel #4
0
 /**
  * Valide le CDA
  *
  * @param String $cda                   CDA
  * @param Bool   $schematron_validation Validation par schémtron
  *
  * @throws CMbException
  * @return void
  */
 static function validateCDA($cda, $schematron_validation = true)
 {
     $dom = new CMbXMLDocument("UTF-8");
     $returnErrors = $dom->loadXMLSafe($cda, null, true);
     if ($returnErrors !== true) {
         throw new CMbException("Erreur lors de la conception du document");
     }
     $validateSchematron = null;
     if ($schematron_validation) {
         $returnErrors = $dom->schemaValidate("modules/cda/resources/CDA.xsd", true, false);
         $validateSchematron = self::validateSchematron($cda);
     }
     if ($returnErrors !== true || $validateSchematron) {
         mbLog($returnErrors);
         throw new CMbException("Problème de conformité, vérifiez les informations nécessaires pour le CDA");
     }
 }
 /**
  * Try to validate the document against a schema will trigger errors when not validating
  *
  * @param bool $returnErrors   Return errors
  * @param bool $display_errors Display errors
  *
  * @return boolean
  */
 function schemaValidate($returnErrors = false, $display_errors = true)
 {
     $this->patharchiveschema = "modules/hl7/resources/hl7v3_{$this->hl7v3_version}";
     $this->schemafilename = "{$this->patharchiveschema}/{$this->dirschemaname}.xsd";
     return parent::schemaValidate($this->schemafilename, $returnErrors, $display_errors);
 }
$docReference = new CMbXMLDocument();
$docReference->load("modules/dPlabo/remote/prescription.xml");
$docReference->setSchema("modules/dPlabo/remote/prescription.xsd");
$doc->setSchema("modules/dPlabo/remote/prescription.xsd");
if (!$doc->checkSchema()) {
    return;
}
// Chargement de la prescription
$mb_prescription_id = CValue::post("mb_prescription_id", 2);
if ($mbPrescription->load($mb_prescription_id)) {
    $mbPrescription->loadRefs();
}
$doc->setDocument("tmp/Prescription-" . $mbPrescription->_id . ".xml");
$prescription = $doc->addElement($doc, "prescription");
$doc->addAttribute($prescription, "id", $mbPrescription->_id);
$doc->addAttribute($prescription, "date", CMbDT::date());
$nomPraticien = $doc->addElement($prescription, "nomPraticien", $mbPrescription->_ref_praticien->_user_last_name);
$prenomPraticien = $doc->addElement($prescription, "prenomPraticien", $mbPrescription->_ref_praticien->_user_first_name);
$nomPatient = $doc->addElement($prescription, "nomPatient", $mbPrescription->_ref_patient->nom);
$prenomPatient = $doc->addElement($prescription, "prenomPatient", $mbPrescription->_ref_patient->prenom);
$date = $doc->addElement($prescription, "date", CMbDT::date($mbPrescription->date));
$analyses = $doc->addElement($prescription, "analyses");
foreach ($mbPrescription->_ref_examens as $curr_analyse) {
    $analyse = $doc->addElement($analyses, "analyse");
    $doc->addAttribute($analyse, "id", $curr_analyse->_id);
    $identifiant = $doc->addElement($analyse, "identifiant", $curr_analyse->identifiant);
    $libelle = $doc->addElement($analyse, "libelle", $curr_analyse->libelle);
}
$docReference->schemaValidate();
$doc->schemaValidate();
$doc->addFile($mbPrescription);
if (null == ($remote_url = CAppUI::conf("{$m} CPackExamensLabo 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_packs.xml";
CMbPath::forceDir(dirname($tmpPath));
$doc->save($tmpPath);
$doc->load($tmpPath);
if (!$doc->schemaValidate("modules/{$m}/remote/packs.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 packs
$packs = new SimpleXMLElement($content);
try {
    importPacks($packs);
} catch (CMbException $e) {
    $e->stepAjax();
}