function testFunction(&$object, $function_name, $params = array())
 {
     $str_params = implode(",", $params);
     $result = $object->{$function_name}($str_params);
     $log = "<div class=\"message\">" . get_class($object) . "::{$function_name}({$str_params}) -> {$result}</div>" . CAppUI::getMsg();
     $this->addLog($log);
 }
/**
 * Fonction utilitaire pour la sauvegarde rapide d'un object avec génération du message
 *
 * @param CMbObject $object Objet à enregister
 *
 * @return void
 */
function storeObject($object)
{
    $title = $object->_id ? "-msg-modify" : "-msg-create";
    if ($msg = $object->store()) {
        CAppUI::setMsg($msg, UI_MSG_ERROR);
        echo CAppUI::getMsg();
        CApp::rip();
    }
    CAppUI::setMsg(CAppUI::tr(get_class($object) . $title), UI_MSG_OK);
}
/**
 * Redirect to the last page
 *
 * @return void
 */
function redirect()
{
    if (CValue::post("ajax")) {
        echo CAppUI::getMsg();
        CApp::rip();
    }
    $m = CValue::post("m");
    $tab = CValue::post("tab");
    CAppUI::redirect("m={$m}&tab={$tab}");
}
/**
 * Fonction utilitaire pour la sauvegarde rapide d'un object avec génération du message
 *
 * @param CMbObject $object Objet à enregister
 *
 * @return void
 */
function storeObject($object)
{
    $title = $object->_id ? "-msg-modify" : "-msg-create";
    if ($msg = $object->store()) {
        CAppUI::setMsg($msg, UI_MSG_ERROR);
        echo CAppUI::getMsg();
        // Il peut y avoir un msg de retour postérieur à la création de l'objet
        // On continue donc le processus de création de la naissance
        //CApp::rip();
    }
    CAppUI::setMsg(CAppUI::tr(get_class($object) . $title), UI_MSG_OK);
}
示例#5
0
 function doRedirect($demandeSynchro = false)
 {
     if ($this->ajax) {
         if ($this->synchro) {
             $del = CValue::post("del", 0);
             $tmp_repas_id = CValue::post("_tmp_repas_id", 0);
             $msgSystem = CAppUI::getMsg();
             $smarty = new CSmartyDP("modules/dPrepas");
             $smarty->assign("del", $del);
             $smarty->assign("tmp_repas_id", $tmp_repas_id);
             $smarty->assign("demandeSynchro", $demandeSynchro);
             $smarty->assign("msgSystem", $msgSystem);
             $smarty->assign("callBack", $this->callBack);
             if ($demandeSynchro) {
                 $smarty->assign("object", $this->_old);
             }
             $smarty->display("add_del_repas_offline.tpl");
         }
         CApp::rip();
     }
     if ($this->redirect !== null) {
         CAppUI::redirect($this->redirect);
     }
 }
示例#6
0
    if ($root_name == $format_config->_class) {
        $xpath = new CMbXPath($dom);
        $nodeList = $xpath->query("//{$root_name}/*");
        $array_configs = array();
        foreach ($nodeList as $_node) {
            $config = $xpath->getValueAttributNode($_node, "config");
            $value = $xpath->getValueAttributNode($_node, "value");
            $array_configs[$config] = $value;
        }
        if ($count = array_diff_key($array_configs, $fields)) {
            CAppUI::setMsg("Trop de données ('" . count($array_configs) . "') par rapport aux \n        champs de l'objet ('" . count($fields) . "')", UI_MSG_ERROR);
        } else {
            foreach ($array_configs as $key => $value) {
                $format_config->{$key} = $value;
                if ($msg = $format_config->store()) {
                    CAppUI::setMsg("Erreur lors de l'import de la configuration : " . $msg, UI_MSG_ERROR);
                } else {
                    CAppUI::setMsg("Configuration correctement importée");
                }
            }
        }
    } else {
        CAppUI::setMsg("La classe du fichier de configuration importé ('{$root_name}'), ne correspond pas à celle \n      de la configuration choisie ('{$format_config->_class}')", UI_MSG_ERROR);
    }
    CAppUI::callbackAjax('window.parent.uploadCallback', array("message" => CAppUI::getMsg(), "sender" => array("sender_class" => $actor->_class, "sender_id" => $actor->_id)));
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("actor_guid", $actor_guid);
$smarty->assign("format_config_guid", $format_config_guid);
$smarty->display("import_config.tpl");
    /*if ($_field->formula == null) {
        continue;
      } */
    $formula_token_values[$_field->name] = array("values" => $_field->getFormulaValues(), "formula" => $_field->formula, "formulaView" => utf8_encode($_field->_formula));
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("ex_object", $ex_object);
$smarty->assign("ex_object_id", $ex_object_id);
$smarty->assign("ex_class_id", $ex_class_id);
$smarty->assign("object_guid", $object_guid);
$smarty->assign("object", $object);
$smarty->assign("_element_id", $_element_id);
$smarty->assign("event_name", $event_name);
$smarty->assign("grid", $grid);
$smarty->assign("out_of_grid", $out_of_grid);
$smarty->assign("groups", $groups);
$smarty->assign("formula_token_values", $formula_token_values);
$smarty->assign("can_delete", $can_delete);
$smarty->assign("parent_view", $parent_view);
$smarty->assign("preview_mode", $preview);
$smarty->assign("ui_msg", CAppUI::getMsg());
$smarty->assign("ex_class_event", $ex_class_event);
$smarty->assign("readonly", $readonly);
$smarty->assign("print", $print);
$smarty->assign("autoprint", $autoprint);
$smarty->assign("only_filled", $only_filled);
$smarty->assign("noheader", $noheader);
$smarty->assign("form_name", $form_name);
$smarty->assign("printer_id", $printer_id);
$smarty->display("view_ex_object_form.tpl");
示例#8
0
    unset($fields["object_id"]);
    if ($root_name == $object_config->_class) {
        $xpath = new CMbXPath($dom);
        $nodeList = $xpath->query("//{$root_name}/*");
        $array_configs = array();
        foreach ($nodeList as $_node) {
            $config = $xpath->getValueAttributNode($_node, "config");
            $value = $xpath->getValueAttributNode($_node, "value");
            $array_configs[$config] = $value;
        }
        if ($count = array_diff_key($array_configs, $fields)) {
            CAppUI::setMsg("Trop de données ('" . count($array_configs) . "') par rapport aux \n        champs de l'objet ('" . count($fields) . "')", UI_MSG_ERROR);
        } else {
            foreach ($array_configs as $key => $value) {
                $object_config->{$key} = $value;
                if ($msg = $object_config->store()) {
                    CAppUI::setMsg("Erreur lors de l'import de la configuration : " . $msg, UI_MSG_ERROR);
                } else {
                    CAppUI::setMsg("Configuration correctement importée");
                }
            }
        }
    } else {
        CAppUI::setMsg("La classe du fichier de configuration importé ('{$root_name}'), ne correspond pas à celle \n      de la configuration choisie ('{$object_config->_class}')", UI_MSG_ERROR);
    }
    CAppUI::callbackAjax('window.parent.uploadCallback', array("message" => CAppUI::getMsg(), "object_id" => $object->_id, "object_configs_guid" => $object_config->_guid));
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("object_config_guid", $object_config_guid);
$smarty->display("import_config.tpl");
示例#9
0
$name = CValue::get("file_name");
$category_id = CValue::get("category_id");
$allowed = array("CFile", "CCompteRendu");
if (!in_array($file_class, $allowed)) {
    CAppUI::stepAjax("CFile-msg-not_allowed_object_to_move", UI_MSG_ERROR);
}
/** @var CFile|CCompteRendu $file */
$file = new $file_class();
$file->load($file_id);
$file->file_category_id = $category_id && $category_id != $file->file_category_id ? $category_id : $file->file_category_id;
if ($file instanceof CFile) {
    $file->file_name = $name ? $name : $file->file_name;
}
$destination = CStoredObject::loadFromGuid($destination_guid);
if ($file->object_id == $destination->_id && $file->object_class == $destination->_class) {
    CAppUI::stepAjax("CFile-msg-from_equal_to", UI_MSG_ERROR);
}
$file->setObject($destination);
// check category
$cat = new CFilesCategory();
$cat->load($file->file_category_id);
if ($cat->class && $cat->class != $destination->_class) {
    $file->file_category_id = "";
}
if ($msg = $file->store()) {
    CAppUI::setMsg($msg, UI_MSG_ERROR);
} else {
    CAppUI::setMsg("CFile-msg-moved");
}
echo CAppUI::getMsg();
示例#10
0
 /**
  * @see parent::store()
  */
 function store()
 {
     if ($this instanceof CSejour || $this instanceof COperation) {
         global $can;
         $this->loadOldObject();
         $this->completeField("cloture_activite_1", "cloture_activite_4", 'codes_ccam');
         if (!$can->admin && CAppUI::conf("dPsalleOp CActeCCAM signature") && ($this->cloture_activite_1 || $this->cloture_activite_4) && $this->fieldModified("codes_ccam") && strcmp($this->codes_ccam, $this->_old->codes_ccam)) {
             $new_code = substr($this->codes_ccam, strlen($this->_old->codes_ccam) + 1);
             $code_ccam = new CDatedCodeCCAM($new_code);
             $code_ccam->getRemarques();
             $activites = $code_ccam->getActivites();
             if (isset($activites[1]) && $this->cloture_activite_1) {
                 CAppUI::setMsg("Impossible de rajouter un code : l'activité 1 est clôturée", UI_MSG_ERROR);
                 echo CAppUI::getMsg();
                 CApp::rip();
             }
             if (isset($activites[4]) && $this->cloture_activite_4) {
                 CAppUI::setMsg("Impossible de rajouter un code : l'activité 4 est clôturée", UI_MSG_ERROR);
                 echo CAppUI::getMsg();
                 CApp::rip();
             }
         }
     }
     // Standard store
     if ($msg = parent::store()) {
         return $msg;
     }
     if ($this->_delete_actes && $this->_id) {
         if ($msg = $this->deleteActes()) {
             return $msg;
         }
     }
     return null;
 }
示例#11
0
文件: main.php 项目: fbone/mediboard4
CApp::$chrono->stop();
CApp::preparePerformance();
// Unlocalized strings
if (!$suppressHeaders || $ajax) {
    CAppUI::$unlocalized = array_map("utf8_encode", CAppUI::$unlocalized);
    $unloc = new CSmartyDP("modules/system");
    $unloc->display("inc_unlocalized_strings.tpl");
}
// Inclusion du footer
if (!$suppressHeaders) {
    //$address = get_remote_address();
    if ($infosystem = CAppUI::pref("INFOSYSTEM")) {
        $latest_cache_key = "{$user->_guid}-latest_cache";
        $latest_cache = array("meta" => array("module" => $m, "action" => $action, "user" => $user->_view), "totals" => Cache::$totals, "hits" => Cache::$hits);
        SHM::put($latest_cache_key, $latest_cache, true);
    }
    $tplFooter = new CSmartyDP("style/{$uistyle}");
    $tplFooter->assign("offline", false);
    $tplFooter->assign("performance", CApp::$performance);
    $tplFooter->assign("infosystem", $infosystem);
    $tplFooter->assign("errorMessage", CAppUI::getMsg());
    $tplFooter->assign("navigatory_history", CViewHistory::getHistory());
    $tplFooter->display("footer.tpl");
}
// Ajax performance
if ($ajax) {
    $tplAjax = new CSmartyDP("modules/system");
    $tplAjax->assign("performance", CApp::$performance);
    $tplAjax->assign("requestID", CValue::get("__requestID"));
    $tplAjax->display("ajax_errors.tpl");
}
示例#12
0
 */
CCanDo::checkAdmin();
$sejour = new CSejour();
$group = CGroups::loadCurrent();
// Supression de patients
$suppr = 0;
$error = 0;
$qte = CValue::get("qte", 1);
$date_min = CValue::get("date_min", CMbDT::date());
$date_min = $date_min ? $date_min : CMbDT::date();
$where = array("entree" => ">= '{$date_min} 00:00:00'", "group_id" => "= '{$group->_id}'");
$listSejours = $sejour->loadList($where, null, $qte);
foreach ($listSejours as $_sejour) {
    CAppUI::setMsg($_sejour->_view, UI_MSG_OK);
    if ($msg = $_sejour->purge()) {
        CAppUI::setMsg($msg, UI_MSG_ALERT);
        $error++;
        continue;
    }
    CAppUI::setMsg("séjour supprimé", UI_MSG_OK);
    $suppr++;
}
// Nombre de patients
$nb_sejours = $sejour->countList($where);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("resultsMsg", CAppUI::getMsg());
$smarty->assign("suppr", $suppr);
$smarty->assign("error", $error);
$smarty->assign("nb_sejours", $nb_sejours);
$smarty->display("inc_purge_sejours.tpl");
示例#13
0
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage PlanningOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$copy_operation_id = CValue::post("copy_operation_id");
$date = CValue::post("date");
$salle_id = CValue::post("salle_id");
$sejour_id = CValue::post("sejour_id");
$time_operation = CValue::post("time_operation");
$operation = new COperation();
$operation->load($copy_operation_id);
$operation->_id = $operation->_time_urgence = null;
$operation->date = $date;
$operation->salle_id = $salle_id;
$operation->sejour_id = $sejour_id;
$operation->time_operation = $time_operation;
$msg = $operation->store();
CAppUI::setMsg($msg ? $msg : CAppUI::tr("COperation-msg-modify"), $msg ? UI_MSG_ERROR : UI_MSG_OK);
CAppUI::getMsg();
CApp::rip();
示例#14
0
        if (!isset($line[1])) {
            continue;
        }
        $line = array_map("getValue", $line);
        $etab = new CEtabExterne();
        $etab->finess = getNum($line[0]);
        if ($etab->loadMatchingObject()) {
            continue;
        }
        $etab->siret = getNum($line[1]);
        $etab->ape = $line[2];
        $etab->nom = $line[3];
        $etab->raison_sociale = $line[3];
        $etab->adresse = "{$line['4']}\n{$line['5']}\n{$line['6']}";
        $etab->cp = $line[7];
        $etab->ville = $line[8];
        $etab->tel = getNum($line[9]);
        $etab->fax = getNum($line[10]);
        $etab->repair();
        $type = $etab->_id ? "modify" : "create";
        if ($msg = $etab->store()) {
            CAppUI::setMsg($msg, UI_MSG_WARNING);
        } else {
            CAppUI::setMsg("CEtabExterne-msg-{$type}", UI_MSG_OK);
        }
    }
    fclose($fp);
    unlink($_file);
}
CAppUI::callbackAjax('window.parent.$("systemMsg").show().insert', CAppUI::getMsg());
CApp::rip();
                    $totaux["impute"]["dates"]["{$reglement->date}"] = array("count" => 0, "total" => 0.0);
                }
                $totaux["impute"]["dates"]["{$reglement->date}"]["count"]++;
                $totaux["impute"]["dates"]["{$reglement->date}"]["total"] += $reglement->montant;
            }
            if ($facture->_du_restant_patient - $reglement->montant > 0) {
                $results[$i]["warning"][] = "Paiement partiel";
            }
            // Dry run to check references
            if ($dryrun) {
                continue;
            }
            // Creation
            $existing = $reglement->_id;
            if ($msg = $reglement->store()) {
                CAppUI::setMsg($msg, UI_MSG_ERROR);
                $results[$i]["errors"][] = $msg;
                continue;
            }
            CAppUI::setMsg($existing ? "CReglement-msg-modify" : "CReglement-msg-create", UI_MSG_OK);
        }
    }
    fclose($fp);
}
CAppUI::callbackAjax('$("systemMsg").insert', CAppUI::getMsg());
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("results", $results);
$smarty->assign("totaux", $totaux);
$smarty->assign("facture_class", $facture_class);
$smarty->display("vw_rapprochement_banc.tpl");
示例#16
0
                                    CAppUI::setMsg("Ligne {$line_number} : {$msg}", UI_MSG_WARNING);
                                    continue;
                                } else {
                                    CAppUI::setMsg("{$concept->_class}-msg-modify", UI_MSG_OK);
                                }
                            }
                        }
                    }
                    // TAG BINDING
                    $tag_item = new CTagItem();
                    $tag_item->setObject($concept);
                    $tag_item->tag_id = $tag2->_id;
                    $tag_item->loadMatchingObject();
                    if (!$tag_item->_id) {
                        if ($msg = $tag_item->store()) {
                            CAppUI::setMsg("Ligne {$line_number} : {$msg}", UI_MSG_WARNING);
                        } else {
                            CAppUI::setMsg("{$tag_item->_class}-msg-create", UI_MSG_OK);
                        }
                    }
                }
                break;
        }
        fclose($fp);
        CAppUI::setMsg("Import terminé", UI_MSG_OK);
    }
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("message", CAppUI::getMsg());
$smarty->display("inc_import.tpl");
示例#17
0
}
if ($indexFile) {
    // Création du fichier index.html
    $plats = new CPlat();
    $smarty = new CSmartyDP();
    $smarty->assign("plats", $plats);
    $smarty->assign("mediboardScriptStorage", mbLoadScriptsStorage());
    $smartyStyle = new CSmartyDP();
    $smartyStyle->assign("offline", true);
    $smartyStyle->assign("localeInfo", $locale_info);
    $smartyStyle->assign("mediboardShortIcon", CFaviconLoader::loadFile("style/{$uistyle}/images/icons/favicon.ico"));
    $smartyStyle->assign("mediboardStyle", CCSSLoader::loadFiles());
    $smartyStyle->assign("mediboardScript", CJSLoader::loadFiles());
    $smartyStyle->assign("messages", $messages);
    $smartyStyle->assign("infosystem", CAppUI::pref("INFOSYSTEM"));
    $smartyStyle->assign("errorMessage", CAppUI::getMsg());
    $smartyStyle->assign("uistyle", $uistyle);
    ob_start();
    $smartyStyle->display("header.tpl");
    $smarty->display("repas_offline.tpl");
    $smartyStyle->display("footer.tpl");
    $indexFile = ob_get_contents();
    ob_end_clean();
    file_put_contents("tmp/index.html", $indexFile);
    if ($typeArch == "zip") {
        $zipFile->addFile("tmp/index.html", "index.html");
    } elseif ($typeArch == "tar") {
        $zipFile->addModify("tmp/index.html", null, "tmp/");
    }
}
function delSvnAndSmartyDir($action, $fileProps)
 /**
  * Edition des journaux selon le type
  *
  * @param bool $read           lecture
  * @param bool $create_journal Création du journal
  *
  * @return void
  */
 function editJournal($read = true, $create_journal = true)
 {
     if ($create_journal) {
         $journal = new CJournalBill();
         $journal->type = $this->type_pdf;
         $journal->nom = "Journal_" . $this->type_pdf . "_" . CMbDT::date();
         $journal->_factures = $this->factures;
         if ($msg = $journal->store()) {
             mbTrace($msg);
         } else {
             $this->journal_id = $journal->_id;
         }
     }
     // Creation du PDF
     $this->pdf = new CMbPdf('l', 'mm');
     $this->pdf->setPrintHeader(false);
     $this->pdf->setPrintFooter(false);
     $this->font = "vera";
     $this->fontb = $this->font . "b";
     $this->pdf->setFont($this->font, '', 8);
     $this->page = 0;
     $this->editEntete();
     switch ($this->type_pdf) {
         case "paiement":
             $this->editPaiements();
             break;
         case "debiteur":
             $this->editDebiteur();
             break;
         case "rappel":
             $this->editRappel();
             break;
         case "checklist":
             $this->editCheckList();
             break;
     }
     if ($create_journal) {
         $file = new CFile();
         $file->file_name = $journal->nom . ".pdf";
         $file->file_type = "application/pdf";
         $file->author_id = CMediusers::get()->_id;
         $file->file_category_id = 1;
         $file->setObject($journal);
         $file->fillFields();
         $file->putContent($this->pdf->Output('Factures.pdf', "S"));
         if ($msg = $file->store()) {
             echo $msg;
         }
         if ($this->type_pdf == "checklist") {
             $user = CMediusers::get();
             $printer = new CPrinter();
             $printer->function_id = $user->function_id;
             $printer->label = "justif";
             $printer->loadMatchingObject();
             if (!$printer->_id) {
                 CAppUI::setMsg("Les imprimantes ne sont pas paramétrées", UI_MSG_ERROR);
                 echo CAppUI::getMsg();
                 return false;
             }
             $file = new CFile();
             $pdf = $this->pdf->Output('Factures.pdf', "S");
             $file_path = tempnam("tmp", "facture");
             $file->_file_path = $file_path;
             file_put_contents($file_path, $pdf);
             $printer->loadRefSource()->sendDocument($file);
             unlink($file_path);
         }
     }
     if ($read) {
         //Affichage du fichier pdf
         $this->pdf->Output('Factures.pdf', "I");
     }
 }
示例#19
0
/main.css";</style>
		<link rel="shortcut icon" href="./style/<?php 
echo $uistyle;
?>
/favicon.ico" type="image/ico" charset="utf-8"/>
	</head>

	<body bgcolor="#f0f0f0" onload="//document.loginform.username.focus();">
		<?php 
include 'createuser.php';
?>

		<?php 
if ($AppUI->getVersion()) {
    ?>
			<div align="center">
				<span style="font-size:7pt">Version <?php 
    echo $AppUI->getVersion();
    ?>
</span>
			</div>
		<?php 
}
?>
		<div align="center">
			<?php 
echo '<span class="error">' . $AppUI->getMsg() . '</span>';
?>
		</div>
	</body>
</html>
 /**
  * Make JavaScript callback
  *
  * @return void
  */
 function doCallback()
 {
     $messages = CAppUI::$instance->messages;
     echo CAppUI::getMsg();
     $fields = $this->_obj->getProperties();
     $fields["_guid"] = $this->_obj->_guid;
     $fields["_class"] = $this->_obj->_class;
     foreach ($messages as &$_level) {
         $_keys = array_map("utf8_encode", array_keys($_level));
         $_values = array_map("utf8_encode", array_values($_level));
         $_level = array_combine($_keys, $_values);
     }
     $fields["_ui_messages"] = $messages;
     $id = $this->_obj->_id ? $this->_obj->_id : 0;
     if ($this->callBack) {
         CAppUI::callbackAjax($this->callBack, $id, $fields);
     } else {
         $guid = "{$this->className}-{$id}";
         CAppUI::callbackAjax("Form.onSubmitComplete", $guid, $fields);
     }
     if (!CAppUI::$mobile) {
         CApp::rip();
     }
 }
示例#21
0
 /**
  * Impression des factures
  *
  * @param bool $ts tiers soldant
  *
  * @return void
  */
 function printBill($ts = false)
 {
     if (count($this->factures)) {
         $user = CMediusers::get();
         $printer_bvr = new CPrinter();
         $printer_bvr->function_id = $user->function_id;
         $printer_bvr->label = "bvr";
         $printer_bvr->loadMatchingObject();
         $printer_justif = new CPrinter();
         $printer_justif->function_id = $user->function_id;
         $printer_justif->label = "justif";
         $printer_justif->loadMatchingObject();
         if (!$printer_bvr->_id || !$printer_justif->_id) {
             CAppUI::setMsg("Les imprimantes ne sont pas paramétrées", UI_MSG_ERROR);
             echo CAppUI::getMsg();
             return false;
         }
         $file = new CFile();
         foreach ($this->factures as $facture) {
             $facture_pdf = new CEditPdf();
             $facture_pdf->factures = array($facture);
             $pdf = "";
             $pdf = $facture_pdf->editFactureBVR($ts, "S");
             $file_path = tempnam("tmp", "facture");
             $file->_file_path = $file_path;
             file_put_contents($file_path, $pdf);
             $printer_bvr->loadRefSource()->sendDocument($file);
             unlink($file_path);
             $pdf = "";
             $pdf = $facture_pdf->editJustificatif($ts, "S");
             $file_path = tempnam("tmp", "facture");
             $file->_file_path = $file_path;
             file_put_contents($file_path, $pdf);
             $printer_justif->loadRefSource()->sendDocument($file);
             unlink($file_path);
         }
     }
 }
示例#22
0
/**
 * 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)
{
    $fp = fopen($file, 'r');
    $csv_file = new CCSVFile($fp);
    $csv_file->column_names = $csv_file->readLine();
    if ($start == 0) {
        $start++;
    } elseif ($start > 1) {
        $csv_file->jumpLine($start);
    }
    $group_id = CGroups::loadCurrent()->_id;
    $treated_line = 0;
    while ($treated_line < $count) {
        $treated_line++;
        $patient = new CPatient();
        $_patient = $csv_file->readLine(true);
        if (!$_patient) {
            CAppUI::stepAjax('Importation terminée', UI_MSG_OK);
            CApp::rip();
        }
        $patient->bind($_patient);
        $patient->loadFromIPP($group_id);
        if ($patient->_id) {
            $start++;
            continue;
        }
        $nom = $_patient['nom'] ? $_patient['nom'] : $_patient['nom_jeune_fille'];
        if (!$patient->nom) {
            if ($patient->nom_jeune_fille) {
                $patient->nom = $patient->nom_jeune_fille;
            } else {
                CMbDebug::log("Ligne #{$start} : Pas de nom");
                $start++;
                continue;
            }
        }
        $naissance = null;
        if ($patient->naissance) {
            $naissance = preg_replace('/(\\d{2})\\/(\\d{2})\\/(\\d{4})/', '\\3-\\2-\\1', $patient->naissance);
            $patient->naissance = $naissance;
        }
        $patient->repair();
        if (!$patient->naissance) {
            CMbDebug::log($_patient);
            CMbDebug::log("Ligne #{$start} : Date de naissance invalide ({$_patient['naissance']})");
            $start++;
            continue;
        }
        $patient->loadMatchingPatient();
        if (!$patient->_id) {
            $patient->bind($_patient);
            $patient->nom = $nom;
            $patient->naissance = $naissance;
            $patient->tel = preg_replace("/[^0-9]/", "", $patient->tel);
            $patient->tel_autre = preg_replace("/[^0-9]/", "", $patient->tel_autre);
            $patient->sexe = strtolower($patient->sexe);
            $patient->repair();
            if ($msg = $patient->store()) {
                CMbDebug::log($patient, null, true);
                CMbDebug::log("Ligne #{$start} :{$msg}");
                $start++;
                continue;
            }
        }
        $ipp = CIdSante400::getMatch($patient->_class, CPatient::getTagIPP($group_id), $patient->_IPP, $patient->_id);
        if ($ipp->_id && $ipp->id400 != $patient->_IPP) {
            CMbDebug::log("Ligne #{$start} : Ce patient possède déjà un IPP ({$ipp->id400})");
            $start++;
            continue;
        }
        if (!$ipp->_id) {
            if ($msg = $ipp->store()) {
                CMbDebug::log("Ligne #{$start} :{$msg}");
                $start++;
                continue;
            }
        }
        CAppUI::setMsg('CPatient-msg-create', UI_MSG_OK);
    }
    echo CAppUI::getMsg();
}
示例#23
0
/**
 * $Id: do_prescription_export.php 19460 2013-06-07 09:39:26Z kgrisel $
 *
 * @package    Mediboard
 * @subpackage Labo
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 19460 $
 */
function redirect()
{
    echo CAppUI::getMsg();
    CApp::rip();
}
示例#24
0
if (!$username) {
    CAppUI::setMsg("Auth-failed-nousername", UI_MSG_ERROR);
} else {
    if ($user->user_type == 1 && (!$ldap_connection || $allow_login_as_ldap)) {
        // If admin: no need to give a password
        $_REQUEST['loginas'] = $username;
        CAppUI::login();
    } else {
        if (!$password) {
            CAppUI::setMsg("Auth-failed-nopassword", UI_MSG_ERROR);
        } else {
            $_REQUEST['loginas'] = $username;
            if (CAppUI::conf("admin LDAP ldap_connection")) {
                $_REQUEST['passwordas'] = $password;
                CAppUI::login(true);
            } else {
                if (!CUser::checkPassword($username, $password)) {
                    CAppUI::setMsg("Auth-failed-combination", UI_MSG_ERROR);
                } else {
                    CAppUI::login(true);
                }
            }
        }
    }
}
if ($msg = CAppUI::getMsg()) {
    echo $msg;
    return;
} else {
    CAppUI::callbackAjax('UserSwitch.reload');
}
示例#25
0
                CAppUI::stepAjax($msg, UI_MSG_ERROR);
            }
            continue;
        }
    }
    foreach ($dests as $_dest) {
        $destinataire = new CUserMessageDest();
        $destinataire->user_message_id = $usermessage->_id;
        $destinataire->from_user_id = $usermessage->creator_id;
        $destinataire->to_user_id = $_dest;
        $destinataire->loadMatchingObject();
        if ($send_it) {
            $destinataire->datetime_sent = $date;
        }
        if ($msg = $destinataire->store()) {
            CAppUI::stepAjax($msg, UI_MSG_ERROR);
        }
    }
    $msg = $_POST["usermessage_id"] ? 'CUserMessage-msg-modify' : 'CUserMessage-msg-create';
    if ($send_it) {
        $msg = 'CUserMessage-msg-sent';
    }
}
CAppUI::setMsg($msg, UI_MSG_OK);
$smarty = new CSmartyDP();
$messages = CAppUI::getMsg();
$smarty->assign('messages', $messages);
$smarty->display('inc_callback_modal.tpl');
if ($callback) {
    CAppUI::callbackAjax($callback, 'internal', $message_id);
}