CAppUI::setMsg(count($list) . " doublons à traiter"); } else { foreach ($list as $_mvt) { $ids = explode(",", $_mvt["ids"]); sort($ids); // IMPORTANT, must use the first movement created as a reference $first = new CMovement(); $first->load($ids[0]); $second = new CMovement(); $second->load($ids[1]); $tag = CIdSante400::getMatch($second->_class, $second->getTagMovement(), null, $second->_id); if ($tag->_id) { $tag->tag = "trash_{$tag->tag}"; $tag->last_update = CMbDT::dateTime(); $tag->store(); } else { CAppUI::setMsg("Aucun tag sur mouvement #{$second->_id}"); } $msg = $first->merge(array($second->_id => $second)); if ($msg) { CAppUI::setMsg($msg, UI_MSG_WARNING); } else { CAppUI::setMsg("Mouvements fusionnés"); } } if ($auto && count($list)) { CAppUI::js("removeMovementDuplicates()"); } } echo CAppUI::getMsg(); CApp::rip();
$dPconfig["object_handlers"] = array(); CAppUI::stepAjax("Désactivation du gestionnaire", UI_MSG_OK); $start = CValue::post("start"); $count = CValue::post("count"); $callback = CValue::post("callback"); $date = CMbDT::date(); CApp::setTimeLimit(600); CApp::setMemoryLimit("512M"); CMbObject::$useObjectCache = false; $file_import = fopen(CAppUI::conf("root_dir") . "/tmp/rapport_import_patient_{$date}.txt", "a"); importFile(CAppUI::conf("dPpatients imports pat_csv_path"), $start, $count, $file_import); fclose($file_import); $start += $count; file_put_contents(CAppUI::conf("root_dir") . "/tmp/import_patient.txt", "{$start};{$count}"); if ($callback) { CAppUI::js("{$callback}({$start},{$count})"); } echo "<tr><td colspan=\"2\">MEMORY: " . memory_get_peak_usage(true) / (1024 * 1024) . " MB" . "</td>"; CMbObject::$useObjectCache = true; CApp::rip(); /** * import the patient file * * @param string $file path to the file * @param int $start start int * @param int $count number of iterations * @param resource $file_import file for report * * @return null */ function importFile($file, $start, $count, $file_import)
} $count = $log->countList($where); $msg = '%d CLongRequestLog to be removed.'; if ($count == 1) { $msg = 'One CLongRequestLog to be removed.'; } elseif (!$count) { $msg = 'No CLongRequestLog to be removed.'; } CAppUI::stepAjax("CLongRequestLog-msg-{$msg}", UI_MSG_OK, $count); if ($just_count || !$count) { CAppUI::js("\$('clean_auto').checked = false"); CApp::rip(); } $logs = $log->loadList($where, null, $purge_limit); if (!$logs) { CAppUI::js("\$('clean_auto').checked = false"); CAppUI::stepAjax("CLongRequestLog-msg-No CLongRequestLog to be removed.", UI_MSG_OK); CApp::rip(); } $deleted_logs = 0; foreach ($logs as $_log) { if ($msg = $_log->delete()) { CAppUI::setMsg($msg, UI_MSG_WARNING); } else { CAppUI::setMsg('CLongRequestLog-msg-delete', UI_MSG_OK); $deleted_logs++; } } CAppUI::setMsg('CLongRequestLog-msg-%d CLongRequestLog to be removed.', UI_MSG_OK, $count - $deleted_logs); echo CAppUI::getMsg(); CApp::rip();
$iterator = new DirectoryIterator($directory); $count_dirs = 0; $i = 0; foreach ($iterator as $_fileinfo) { if ($_fileinfo->isDot()) { continue; } if ($_fileinfo->isDir() && strpos($_fileinfo->getFilename(), "CPatient-") === 0) { $i++; if ($i <= $start) { continue; } if ($i > $start + $step) { break; } $count_dirs++; $xmlfile = $_fileinfo->getRealPath() . "/export.xml"; if (file_exists($xmlfile)) { $importer = new CPatientXMLImport($xmlfile); $importer->setDirectory($_fileinfo->getRealPath()); if ($files_directory) { $importer->setFilesDirectory($files_directory); } $importer->import(array(), array()); } } } CAppUI::stepAjax("%d patients trouvés à importer", UI_MSG_OK, $count_dirs); if ($count_dirs) { CAppUI::js("nextStepPatients()"); }
* @category Forms * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 28187 $ * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $tmp_filename = $_FILES["import"]["tmp_name"]; $dom = new DOMDocument(); $dom->load($tmp_filename); $xpath = new DOMXPath($dom); if ($xpath->query("/mediboard-export")->length == 0) { CAppUI::js("window.parent.Group.uploadError()"); CApp::rip(); } $temp = CAppUI::getTmpPath("group_import"); $uid = preg_replace('/[^\\d]/', '', uniqid("", true)); $filename = "{$temp}/{$uid}"; CMbPath::forceDir($temp); move_uploaded_file($tmp_filename, $filename); // Cleanup old files (more than 4 hours old) $other_files = glob("{$temp}/*"); $now = time(); foreach ($other_files as $_other_file) { if (filemtime($_other_file) < $now - 3600 * 4) { unlink($_other_file); } } CAppUI::js("window.parent.Group.uploadSaveUID('{$uid}')"); CApp::rip();
* $Id$ * * @package Mediboard * @subpackage reservation * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkEdit(); $operation_id = CValue::get("operation_id"); $operation = new COperation(); $operation->load($operation_id); $praticien = $operation->loadRefChir(); $email = $praticien->_user_email; if (!$email) { CAppUI::js("alert('" . addslashes(CAppUI::tr("alert-praticien_email")) . "')"); CApp::rip(); } $operation->loadRefPlageOp(); $exchange_source = CExchangeSource::get("mediuser-" . CAppUI::$user->_id, "smtp"); $exchange_source->init(); try { $exchange_source->setRecipient($email); // Création du token $token = new CViewAccessToken(); $token->ttl_hours = 24; $token->user_id = $praticien->_id; $token->params = "m=planningOp&a=vw_edit_urgence&operation_id={$operation_id}"; if ($msg = $token->store()) { CAppUI::displayAjaxMsg($msg, UI_MSG_ERROR); }
$name_short = CValue::post("name_short"); $name_long = CValue::post("name_long"); $license = CValue::post("license"); $licenses = array("GNU GPL" => "GNU General Public License, see http://www.gnu.org/licenses/gpl.html", "OXOL" => "OXOL, see http://www.mediboard.org/public/OXOL"); $license = CValue::read($licenses, $license, $licenses["GNU GPL"]); // Only alphanumeric caracters $name_canonical = preg_replace("/[^\\w\\s]/", "", $name_canonical); $name_short = CMbString::purifyHTML($name_short); $name_long = CMbString::purifyHTML($name_long); if (is_dir("modules/{$name_canonical}")) { CAppui::stepAjax("Module '{$name_canonical}' existe déjà", UI_MSG_ERROR); } $zip_path = "dev/sample_module.zip"; $destination = "tmp/sample_module"; if (false == ($files_count = CMbPath::extract($zip_path, $destination))) { CAppui::stepAjax("Impossible d'extraire l'archive '{$zip_path}'</div>", UI_MSG_ERROR); } rename("{$destination}/sample_module", "{$destination}/{$name_canonical}"); $path = "{$destination}/{$name_canonical}"; $files = array_merge(glob("{$path}/*"), glob("{$path}/classes/*"), glob("{$path}/locales/*"), glob("{$path}/templates/*")); $translate = array('{NAME_CANONICAL}' => $name_canonical, '{NAME_SHORT}' => $name_short, '{NAME_LONG}' => $name_long, '{LICENSE}' => $license); foreach ($files as $_file) { if (is_dir($_file)) { continue; } file_put_contents($_file, strtr(file_get_contents($_file), $translate)); } rename("{$destination}/{$name_canonical}", "modules/{$name_canonical}"); CAppUI::setMsg("Module '{$name_canonical}' créé", UI_MSG_OK); CAppUI::js("location.reload()"); CApp::rip();
$obj = new $class(); $key = $obj->_spec->key; $where = array(); $where[] = "{$field_sex} IS NULL OR {$field_sex} = 'u'"; $where["prenom"] = "IS NOT NULL"; $found = $obj->countList($where); CAppUI::stepAjax("Objets concernés : " . $found); $where[$key] = " > '{$start}' "; $objs = $obj->loadList($where, "{$key} ASC", "0, {$limit}"); if (count($objs)) { foreach ($objs as $_obj) { $idex->object_id = $_obj->_id; if ($msg = $_obj->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); } else { CAppUI::stepAjax($_obj->{$field_sex} . " | " . $_obj->_view, $_obj->{$field_sex} == "u" ? UI_MSG_WARNING : UI_MSG_OK); } } if ($msg = $idex->store()) { CAppUI::stepAjax($msg, UI_MSG_ERROR); } } else { $use_callback = false; } } else { CAppUI::stepAjax("%s_not_managed_by_the_system", UI_MSG_ERROR, $class); } if ($callback && $use_callback) { CAppUI::js("getForm('{$callback}').onsubmit();"); } CApp::rip();
if ($hash == 'clean') { unlink($filename); build_error_log(); } if ($hash) { $doc = new DOMDocument(); @$doc->loadHTMLFile($filename); $xpath = new DOMXPath($doc); $elements = $xpath->query("//div[@title='{$hash}']"); foreach ($elements as $element) { $element->parentNode->removeChild($element); } $content = $doc->saveHTML(); file_put_contents(CError::LOG_PATH, $content); } $log_content = null; $log_size = 0; if (file_exists($filename)) { $log_size = filesize($filename); $log_size_limit = CError::LOG_SIZE_LIMIT; $offset = -1; if ($log_size > $log_size_limit) { $offset = $log_size - $log_size_limit; } $log_content = file_get_contents($filename, false, null, $offset); } $log_size_deca = CMbString::toDecaBinary($log_size); if (CAppUI::conf("error_logs_in_db")) { CAppUI::js("Control.Tabs.setTabCount('{$control_tabs_name}', '{$log_size_deca}')"); } echo $log_content;
CValue::setSession("praticien_id", $praticien_id); $sejour = new CSejour(); $ds = $sejour->getDS(); $where = array("praticien_id" => $ds->prepareIn($praticien_id)); if ($date_min) { $where["sortie"] = $ds->prepare("BETWEEN ?1 AND ?2", $date_min, $date_max); } else { $where["sortie"] = $ds->prepare("< ?", $date_max); } /** @var CSejour[] $sejours */ $sejours = $sejour->loadList($where, "sortie ASC", "{$start},{$step}"); foreach ($sejours as $_sejour) { $_sejour->makePDFarchive(); CAppUI::stepAjax("Archive créée pour le %s du patient '%s'", UI_MSG_OK, $_sejour->_view, $_sejour->loadRefPatient()->_view); if (CModule::getActive("dPprescription")) { $prescriptions = $_sejour->loadRefsPrescriptions(); foreach ($prescriptions as $_type => $_prescription) { if ($_prescription->_id && in_array($_type, array("pre_admission", "sortie"))) { if ($_prescription->countBackRefs("prescription_line_medicament") > 0 || $_prescription->countBackRefs("prescription_line_element") > 0 || $_prescription->countBackRefs("prescription_line_comment") > 0 || $_prescription->countBackRefs("prescription_line_mix") > 0 || $_prescription->countBackRefs("prescription_line_dmi") > 0) { $query = array("m" => "prescription", "raw" => "print_prescription", "prescription_id" => $_prescription->_id, "dci" => 0, "in_progress" => 0, "preview" => 0); $base = $_SERVER["SCRIPT_NAME"] . "?" . http_build_query($query, "", "&"); CApp::serverCall("http://127.0.0.1{$base}"); CAppUI::stepAjax("Archive créée pour la prescription de %s", UI_MSG_OK, CAppUI::tr("CPrescription.type.{$_type}")); } } } } } if (count($sejours)) { CAppUI::js("nextStepSejours()"); }
CAppUI::stepAjax("CExchangeAny-msg-delete", UI_MSG_ALERT); } CAppUI::stepAjax("CExchangeDataFormat-reprocessed"); } break; case "detect_collision": $collisions = array(); foreach ($exchanges as $_exchange) { if ($_exchange instanceof CExchangeHL7v2) { $hl7_message = new CHL7v2Message(); $hl7_message->parse($_exchange->_message); $xml = $hl7_message->toXML(null, false); $PV1 = $xml->queryNode("PV1"); $PV2 = $xml->queryNode("PV2"); $sejour = new CSejour(); $sejour->load($_exchange->object_id); $sejour_hl7 = new CSejour(); $sejour_hl7->entree_prevue = $xml->queryTextNode("PV2.8/TS.1", $PV2); $sejour_hl7->entree_reelle = $xml->queryTextNode("PV1.44/TS.1", $PV1); $sejour_hl7->sortie_prevue = $xml->queryTextNode("PV2.9/TS.1", $PV2); $sejour_hl7->sortie_reelle = $xml->queryTextNode("PV1.45/TS.1", $PV1); $collisions[] = array("hl7" => $sejour_hl7, "mb" => $sejour); } } $smarty->assign("collisions", $collisions); $smarty->display("inc_detect_collisions.tpl"); break; default: } CAppUI::js("next{$tool}()");
<?php /** * $Id$ * * @category Admin * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ $bris = new CBrisDeGlace(); $bris->date = CMbDT::dateTime(); $bris->user_id = CMediusers::get()->_id; $bris->group_id = CGroups::loadCurrent()->_id; $bris->comment = CValue::post("comment"); $bris->object_class = CValue::post("object_class"); $bris->object_id = CValue::post("object_id"); if ($msg = $bris->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); } else { CAppUI::setMsg($bris->_class . "-store", UI_MSG_OK); CAppUI::js("afterSuccessB2G()"); } echo CAppUI::getMsg(); CApp::rip();
/** * Duplicate an transformation to another (or the same) category * * @category EAI * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license OXOL, see http://www.mediboard.org/public/OXOL * @version SVN: $Id:\$ * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $eai_transformation_rule_id = CValue::post("eai_transformation_rule_id"); $eai_transformation_ruleset_id = CValue::post("eai_transformation_ruleset_id"); $transformation_ruleset_dest_id = CValue::post("transformation_ruleset_dest_id"); $transf_rule = new CEAITransformationRule(); // On duplique toutes les règles de la catégorie if ($eai_transformation_ruleset_id) { $transf_rule->eai_transformation_ruleset_id = $eai_transformation_ruleset_id; /** @var $transf_rules CEAITransformationRule[] */ $transf_rules = $transf_rule->loadMatchingList(); foreach ($transf_rules as $_transf_rule) { $msg = $_transf_rule->duplicate($transformation_ruleset_dest_id); CAppUI::displayMsg($msg, "CEAITransformationRule-msg-create"); } } else { $transf_rule->load($eai_transformation_rule_id); $msg = $transf_rule->duplicate($transformation_ruleset_dest_id); CAppUI::displayMsg($msg, "CEAITransformationRule-msg-create"); } CAppUI::js(CValue::post("callback") . "()");
if (in_array($_node->nodeName, CCompteRendu::$fields_import_export)) { $modele->{$_node->nodeName} = $_node->nodeValue; } } $modele->nom = utf8_decode($modele->nom); // Mapping de l'entête, pieds de page, introduction, conclusion foreach ($components as $_component) { if ($modele->{$_component}) { $modele->{$_component} = $modeles_ids[$modele->{$_component}]; } } // Recherche de la catégorie $cat = utf8_decode($_modele->getAttribute("cat")); if ($cat) { $categorie = new CFilesCategory(); $categorie->nom = $cat; if (!$categorie->loadMatchingObject()) { $categorie->store(); } $modele->file_category_id = $categorie->_id; } if ($msg = $modele->store()) { CAppUI::stepAjax($modele->nom . " - " . $msg, UI_MSG_ERROR); continue; } CAppUI::stepAjax($modele->nom . " - " . CAppUI::tr("CCompteRendu-msg-create"), UI_MSG_OK); // On garde la référence entre l'id provenant du xml et l'id en base $modeles_ids[$_modele->getAttribute("modele_id")] = $modele->_id; } CAppUI::js("window.opener.getForm('filterModeles').onsubmit()");
<?php /** * $Id$ * * @category Bloc * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $limit = CValue::get("limit", CAppUI::conf("dataminer_limit")); $miner_class = CValue::get("miner_class"); $phase = CValue::get("phase"); $auto = CValue::get("auto"); $miner = new $miner_class(); if (!$miner instanceof CDailySalleMiner) { trigger_error("Wrong miner class", E_USER_ERROR); return; } $report = $miner->mineSome($limit, $phase); CAppUI::stepAjax("Miner: %s. Success mining count is '%s'", UI_MSG_OK, $miner_class, $report["success"]); if ($report["failure"]) { CAppUI::stepAjax("Miner: %s. Failure mining counts is '%s'", UI_MSG_ERROR, $miner_class, $report["failure"]); } if ($auto) { CAppUI::js('submitMine();'); }
* @category Forms * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ CCanDo::checkEdit(); $tmp_filename = $_FILES["import"]["tmp_name"]; $dom = new DOMDocument(); $dom->load($tmp_filename); $xpath = new DOMXPath($dom); if ($xpath->query("/mediboard-export")->length == 0) { CAppUI::js("window.parent.ExClass.uploadError()"); CApp::rip(); } $temp = CAppUI::getTmpPath("ex_class_import"); $uid = preg_replace('/[^\\d]/', '', uniqid("", true)); $filename = "{$temp}/{$uid}"; CMbPath::forceDir($temp); move_uploaded_file($tmp_filename, $filename); // Cleanup old files (more than 4 hours old) $other_files = glob("{$temp}/*"); $now = time(); foreach ($other_files as $_other_file) { if (filemtime($_other_file) < $now - 3600 * 4) { unlink($_other_file); } } CAppUI::js("window.parent.ExClass.uploadSaveUID('{$uid}')"); CApp::rip();
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: $ */ CCanDo::checkAdmin(); $anesth_id = CValue::get("anesth_id"); $mediuser = new CMediusers(); $mediuser->load($anesth_id); if (!$mediuser->isAnesth()) { CAppUI::stepAjax("L'utilisateur n'est pas anesthesiste", UI_MSG_ERROR); } $consult = new CConsultation(); $where = array("plageconsult.chir_id" => "= '{$mediuser->_id}'", "consultation.patient_id" => "IS NOT NULL"); $ljoin = array("plageconsult" => "plageconsult.plageconsult_id = consultation.plageconsult_id"); $ids_consults = $consult->loadIds($where, null, null, null, $ljoin); $where["consultation_anesth.consultation_id"] = "IS NOT NULL"; $ljoin["consultation_anesth"] = "consultation_anesth.consultation_id = consultation.consultation_id"; $ids_consults = array_diff($ids_consults, $consult->loadIds($where, null, null, null, $ljoin)); if (count($ids_consults) == 0) { CAppUI::stepAjax("Aucune consultation sans consultation d'anesth", UI_MSG_WARNING); CAppUI::js('$V($("check_repeat_actions"), false)'); return; } $ids_consults = array_slice($ids_consults, 0, 400); foreach ($ids_consults as $_consult_id) { $consult = new CConsultation(); $consult->load($_consult_id); if ($msg = $consult->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); } CAppUI::stepAjax("Mise à jour de la consultation : #{$consult->_id}"); }