Example #1
0
$patient->countBackRefs("sejours");
$patient->countINS();
$patient->loadRefPhotoIdentite();
$patient->loadRefsNotes();
$patient->loadRefsCorrespondants();
// Affecter la date de la consultation
$date = $consult->_ref_plageconsult->date;
// Tout utilisateur peut consulter en lecture seule une consultation de séjour
$consult->canDo();
if (CModule::getActive("fse")) {
    // Chargement des identifiants LogicMax
    $fse = CFseFactory::createFSE();
    if ($fse) {
        $fse->loadIdsFSE($consult);
        $fse->makeFSE($consult);
        $cps = CFseFactory::createCPS()->loadIdCPS($consult->_ref_chir);
        CFseFactory::createCV()->loadIdVitale($consult->_ref_patient);
    }
}
$consult->loadRefGrossesse();
$patient->loadRefDossierMedical();
$dossier_medical = $consult->_ref_patient->_ref_dossier_medical;
if ($dossier_medical->_id) {
    $etat_dents = $dossier_medical->loadRefsEtatsDents();
    foreach ($etat_dents as $etat) {
        $list_etat_dents[$etat->dent] = $etat->etat;
    }
    $dossier_medical->loadRefsAllergies();
    $dossier_medical->loadRefsAntecedents();
    $dossier_medical->countAntecedents(false);
    $dossier_medical->countAllergies();
 /**
  * @todo Use CStoredObject->store()
  */
 function store()
 {
     // Properties checking
     $this->updatePlainFields();
     $this->loadOldObject();
     if (CAppUI::conf("readonly")) {
         return CAppUI::tr($this->_class) . CAppUI::tr("CMbObject-msg-store-failed") . CAppUI::tr("Mode-readonly-msg");
     }
     if ($msg = $this->check()) {
         return CAppUI::tr($this->_class) . CAppUI::tr("CMbObject-msg-check-failed") . CAppUI::tr($msg);
     }
     // Trigger before event
     $this->notify("BeforeStore");
     $spec = $this->_spec;
     if ($this->fieldModified("remote", 0) && !CAppUI::$user->isAdmin()) {
         if (!$this->_user_password) {
             return "Veuillez saisir à nouveau votre mot de passe";
         }
     }
     /*
     if (!CAppUI::$user->isAdmin()) {
       if ($this->fieldModified("_user_type", 1) || (!$this->_id && $this->_user_type)) {
         return "Opération interdite";
       }
     }
     */
     /// <diff>
     // Store corresponding core user first
     $user = $this->createUser();
     if ($msg = $user->store()) {
         return $msg;
     }
     // User might have been re-created
     if ($this->user_id != $user->user_id) {
         $this->user_id = null;
     }
     // Can't use parent::store cuz user_id don't auto-increment
     if ($this->user_id) {
         $vars = $this->getPlainFields();
         $ret = $spec->ds->updateObject($spec->table, $vars, $spec->key, $spec->nullifyEmptyStrings);
     } else {
         $this->user_id = $user->user_id;
         $vars = $this->getPlainFields();
         $keyToUpdate = $spec->incremented ? $spec->key : null;
         $ret = $spec->ds->insertObject($spec->table, $this, $vars, $keyToUpdate);
     }
     /// </diff>
     if (!$ret) {
         return CAppUI::tr($this->_class) . CAppUI::tr("CMbObject-msg-store-failed") . $spec->ds->error();
     }
     /// <diff>
     // Bind CPS
     if ($this->_bind_cps && $this->_id && CModule::getActive("fse")) {
         $cps = CFseFactory::createCPS();
         if ($cps) {
             if ($msg = $cps->bindCPS($this)) {
                 return $msg;
             }
         }
     }
     /// </diff>
     // Préparation du log, doit être fait AVANT $this->load()
     $this->prepareLog();
     // Load the object to get all properties
     //$this->load(); // peut poser probleme, à tester
     // Enregistrement du log une fois le store terminé
     $this->doLog();
     // Trigger event
     $this->notify("AfterStore");
     $this->_old = null;
     return null;
 }