コード例 #1
0
 /**
  * Codage CCAM vers les systèmes de facturation
  *
  * @param CHPrimXMLEvenementServeurActes $messageServeurActes Message H'XML serveur actes
  *
  * @return CHPrimXMLAcquittementsServeurActes messageAcquittement 
  **/
 function evenementServeurActes($messageServeurActes)
 {
     // Création de l'échange
     $echange_hprim = new CEchangeHprim();
     $messageAcquittement = null;
     $data = array();
     // Gestion de l'acquittement
     $domAcquittement = new CHPrimXMLAcquittementsServeurActes();
     $domGetEvenement = new CHPrimXMLEvenementsServeurActes();
     try {
         // Récupération des informations du message XML
         $domGetEvenement->loadXML($messageServeurActes);
         $doc_errors = $domGetEvenement->schemaValidate(null, true);
         $data = $domGetEvenement->getEnteteEvenementXML("evenementsServeurActes");
         $domAcquittement->identifiant = $data['identifiantMessage'];
         $domAcquittement->destinataire = $data['idClient'];
         $domAcquittement->destinataire_libelle = $data['libelleClient'];
         $domAcquittement->_sous_type_evt = $domGetEvenement->sous_type;
         // Acquittement d'erreur d'un document XML recu non valide
         if ($doc_errors !== true) {
             $messageAcquittement = $domAcquittement->generateAcquittementsServeurActivitePmsi("erreur", "E002", $doc_errors);
             $doc_valid = $domAcquittement->schemaValidate();
             $echange_hprim->date_production = CMbDT::dateTime();
             $echange_hprim->emetteur = $data['idClient'] ? $dest_hprim->_id : 0;
             $echange_hprim->destinataire = CAppUI::conf('mb_id');
             $echange_hprim->group_id = CGroups::loadCurrent()->_id;
             $echange_hprim->type = "pmsi";
             $echange_hprim->sous_type = $domGetEvenement->sous_type ? $domGetEvenement->sous_type : "inconnu";
             $echange_hprim->_message = $messageServeurActes;
             $echange_hprim->_acquittement = $messageAcquittement;
             $echange_hprim->statut_acquittement = "erreur";
             $echange_hprim->message_valide = 0;
             $echange_hprim->acquittement_valide = $doc_valid ? 1 : 0;
             $echange_hprim->store();
             return $messageAcquittement;
         }
         // Récupère l'initiateur du message s'il existe
         if (CAppUI::conf('sip server')) {
             $echange_hprim->identifiant_emetteur = intval($data['identifiantMessage']);
             $echange_hprim->loadMatchingObject();
         }
         if (!$echange_hprim->_id) {
             $echange_hprim->emetteur = $dest_hprim->_id;
             $echange_hprim->destinataire = CAppUI::conf('mb_id');
             $echange_hprim->group_id = CGroups::loadCurrent()->_id;
             $echange_hprim->identifiant_emetteur = $data['identifiantMessage'];
             $echange_hprim->type = "pmsi";
             $echange_hprim->sous_type = $domGetEvenement->sous_type;
             $echange_hprim->_message = $messageServeurActes;
             $echange_hprim->message_valide = 1;
         }
         $echange_hprim->date_production = CMbDT::dateTime();
         $echange_hprim->store();
         $data = array_merge($data, $domGetEvenement->getContentsXML());
         $echange_hprim->id_permanent = $data['idSourceVenue'];
         $messageAcquittement = $domGetEvenement->serveurActes($domAcquittement, $echange_hprim, $data);
         return $messageAcquittement;
     } catch (Exception $e) {
         /*$domAcquittement = new CHPrimXMLAcquittementsServeurActes();
           $domAcquittement->identifiant = $data['identifiantMessage'];
           $domAcquittement->destinataire = $data['idClient'];
           $domAcquittement->destinataire_libelle = $data['libelleClient'];
           $domAcquittement->_sous_type_evt = "evenementServeurActe";
           
           $messageAcquittement = $domAcquittement->generateAcquittementsServeurActivitePmsi("erreur", "E009", $e->getMessage());
           $doc_valid = $domAcquittement->schemaValidate();
           
           $echange_hprim->_acquittement = $messageAcquittement;
           $echange_hprim->statut_acquittement = "erreur";
           $echange_hprim->acquittement_valide = $doc_valid ? 1 : 0;
           $echange_hprim->date_echange = CMbDT::dateTime();
           $echange_hprim->store();*/
         return $messageAcquittement;
     }
 }
コード例 #2
0
     $evt = "evenementsServeurActes";
 } else {
     CAppUI::stepAjax("Type de l'échange invalide", UI_MSG_ERROR);
 }
 $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']);