示例#1
0
 public function testCountFilesHasRightReturn()
 {
     mkdir(__DIR__ . "/test");
     touch(__DIR__ . "/test/file1");
     touch(__DIR__ . "/test/file2");
     $this->assertEquals(2, $this->stub->countFiles(__DIR__ . "/test"));
     @unlink(__DIR__ . "/test/file2");
     @unlink(__DIR__ . "/test/file1");
     @rmdir(__DIR__ . "/test");
 }
 /**
  * Traitement des retours en erreur d'xml d'un praticien
  *
  * @param int $chir_id praticien de la consultation
  *
  * @return void|string
  */
 static function traitementDossier($chir_id)
 {
     $files = array();
     $fs_source_reception = CExchangeSource::get("reception-tarmed-CMediusers-{$chir_id}", "file_system", true, null, false);
     if (!$fs_source_reception->_id || !$fs_source_reception->active) {
         return null;
     }
     $count_files = CMbPath::countFiles($fs_source_reception->host);
     if ($count_files < 100) {
         try {
             $files = $fs_source_reception->receive();
         } catch (CMbException $e) {
             return CAppUI::tr($e->getMessage());
         }
     }
     $delfile_read_reject = CAppUI::conf("dPfacturation Other delfile_read_reject", CGroups::loadCurrent());
     foreach ($files as $_file) {
         $fs = new CSourceFileSystem();
         $rejet = new self();
         $rejet->praticien_id = $chir_id;
         $rejet->file_name = basename($_file);
         if ($msg = $rejet->store()) {
             return $msg;
         }
         $rejet->readXML($fs->getData($_file));
         //Sauvegarde du XML en CFile
         $new_file = new CFile();
         $new_file->setObject($rejet);
         $new_file->file_name = basename($_file);
         $new_file->file_type = "application/xml";
         $new_file->author_id = CAppUI::$user->_id;
         $new_file->fillFields();
         $new_file->updateFormFields();
         $new_file->forceDir();
         $new_file->putContent(trim($fs->getData($_file)));
         if ($msg = $new_file->store()) {
             mbTrace($msg);
         }
         //Suppression du fichier selon configuration
         if ($delfile_read_reject) {
             $fs->delFile($_file);
         }
     }
     return null;
 }
示例#3
0
$chir_id = CValue::getOrSession("chir_id");
$traitement = CValue::get("traitement", 0);
$list = CValue::get("list", 0);
if ($traitement && $chir_id) {
    CFactureRejet::traitementDossier($chir_id);
}
// Liste des chirurgiens
$user = new CMediusers();
$listChir = $user->loadPraticiens(PERM_EDIT);
//Listing des fichiers
$count_files = 0;
$files = array();
$erreur = null;
$fs_source_reception = CExchangeSource::get("reception-tarmed-CMediusers-{$chir_id}", "file_system", true, null, false);
if ($fs_source_reception->_id && $fs_source_reception->active) {
    $count_files = CMbPath::countFiles($fs_source_reception->host);
    if ($count_files < 1000) {
        try {
            $files = $fs_source_reception->receive();
        } catch (CMbException $e) {
            $erreur = CAppUI::tr($e->getMessage());
        }
    }
}
$rejet = new CFactureRejet();
$rejet->praticien_id = $chir_id;
$rejet->file_name = CValue::getOrSession("file_name");
$rejet->num_facture = CValue::getOrSession("num_facture");
$rejet->date = CValue::getOrSession("date");
$rejet->motif_rejet = CValue::getOrSession("motif_rejet");
$rejet->statut = CValue::getOrSession("statut");
    } catch (CMbException $e) {
        $e->stepAjax(UI_MSG_ERROR);
    }
    CAppUI::stepAjax("CSourceFileSystem-host-is-a-dir", UI_MSG_OK, $exchange_source->host);
} else {
    if ($type_action == "sendFile") {
        try {
            $exchange_source->setData("Test source file system in Mediboard", false);
            $exchange_source->send();
        } catch (CMbException $e) {
            $e->stepAjax(UI_MSG_ERROR);
        }
        CAppUI::stepAjax("Le fichier 'testSendFile{$exchange_source->fileextension}' a été copié dans le dossier '{$exchange_source->host}'");
    } else {
        if ($type_action == "getFiles") {
            $count_files = CMbPath::countFiles($exchange_source->host);
            CAppUI::stepAjax("Le dossier '{$exchange_source->host}' contient : {$count_files} fichier(s)");
            $files = array();
            if ($count_files < 1000) {
                try {
                    $files = $exchange_source->receive();
                } catch (CMbException $e) {
                    $e->stepAjax(UI_MSG_ERROR);
                }
            } else {
                CAppUI::stepAjax("Le dossier '{$exchange_source->host}' contient trop de fichiers pour être listé", UI_MSG_WARNING);
            }
            // Création du template
            $smarty = new CSmartyDP();
            $smarty->assign("exchange_source", $exchange_source);
            $smarty->assign("files", $files);
示例#5
0
 * Exchange to file
 *
 * @category Hprimxml
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$path = CValue::get("path");
$do_import = CValue::get("do_import");
$type = CValue::get("type");
$limit = CValue::get("limit");
$path = CAppUI::conf("dPfiles CFile upload_directory") . "/{$path}";
$count = CMbPath::countFiles($path);
if (!$do_import) {
    CAppUI::stepAjax("{$count} fichiers '{$type}' à passer en échanges HPRIM");
} else {
    if ($count <= 0) {
        CAppUI::stepAjax("Aucun fichier à passer en échange HPRIM", UI_MSG_ERROR);
    }
    $evt = $class = null;
    if ($type == "pmsi") {
        $domEvenement = new CHPrimXMLEvenementsPmsi();
        $evt = "evenementsPMSI";
    } elseif ($type == "actes") {
        $domEvenement = new CHPrimXMLEvenementsServeurActes();
        $evt = "evenementsServeurActes";
    } else {
        CAppUI::stepAjax("Type de l'échange invalide", UI_MSG_ERROR);