/**
  * @see parent::updatePlainFields()
  */
 function updatePlainFields()
 {
     parent::updatePlainFields();
     if ($this->nom) {
         $this->nom = CMbString::upper($this->nom);
     }
     if ($this->nom_jeune_fille) {
         $this->nom_jeune_fille = CMbString::upper($this->nom_jeune_fille);
     }
     if ($this->prenom) {
         $this->prenom = CMbString::capitalize(CMbString::lower($this->prenom));
     }
 }
Exemplo n.º 2
0
 /**
  * @see parent::updatePlainFields()
  */
 function updatePlainFields()
 {
     parent::updatePlainFields();
     $soundex2 = new soundex2();
     $anonyme = is_numeric($this->nom);
     if ($this->nom) {
         $this->nom = self::applyModeIdentitoVigilance($this->nom, false, null, $anonyme);
         $this->nom_soundex2 = $soundex2->build($this->nom);
     }
     if ($this->nom_jeune_fille) {
         $this->nom_jeune_fille = self::applyModeIdentitoVigilance($this->nom_jeune_fille, false, null, $anonyme);
         $this->nomjf_soundex2 = $soundex2->build($this->nom_jeune_fille);
     }
     if ($this->prenom) {
         $this->prenom = self::applyModeIdentitoVigilance($this->prenom, true, null, $anonyme);
         $this->prenom_soundex2 = $soundex2->build($this->prenom);
     }
     if ($this->cp === "00000") {
         $this->cp = "";
     }
     if ($this->assure_nom) {
         $this->assure_nom = self::applyModeIdentitoVigilance($this->assure_nom);
     }
     if ($this->assure_nom_jeune_fille) {
         $this->assure_nom_jeune_fille = self::applyModeIdentitoVigilance($this->assure_nom_jeune_fille);
     }
     if ($this->assure_prenom) {
         $this->assure_prenom = self::applyModeIdentitoVigilance($this->assure_prenom, true);
     }
     if ($this->assure_cp === "00000") {
         $this->assure_cp = "";
     }
     if ($this->_pays_naissance_insee) {
         $this->pays_naissance_insee = $this->updatePatNumPaysInsee($this->_pays_naissance_insee);
     }
     if ($this->pays) {
         $this->pays_insee = $this->updatePatNumPaysInsee($this->pays);
     }
     if ($this->_assure_pays_naissance_insee) {
         $this->assure_pays_naissance_insee = $this->updatePatNumPaysInsee($this->_assure_pays_naissance_insee);
     }
     if ($this->assure_pays) {
         $this->assure_pays_insee = $this->updatePatNumPaysInsee($this->assure_pays);
     }
     // Détermine la civilité du patient automatiquement (utile en cas d'import)
     // Ne pas vérifier que la civilité est null (utilisation de updatePlainField dans le loadmatching)
     $this->completeField("civilite");
     if ($this->civilite === "guess") {
         $this->naissance = CMbDT::dateFromLocale($this->naissance);
         $this->evalAge();
         $this->civilite = $this->_annees < CAppUI::conf("dPpatients CPatient adult_age") ? "enf" : ($this->sexe === "m" ? "m" : "mme");
     }
     // Détermine la civilité de l'assure automatiquement (utile en cas d'import)
     $this->completeField("assure_civilite");
     if ($this->assure_civilite === "guess") {
         $this->assure_naissance = CMbDT::dateFromLocale($this->assure_naissance);
         $this->evalAgeAssure();
         $sexe = $this->assure_sexe ? $this->assure_sexe : $this->sexe;
         $this->assure_civilite = $this->_age_assure < CAppUI::conf("dPpatients CPatient adult_age") ? "enf" : ($sexe === "m" ? "m" : "mme");
     }
 }
Exemplo n.º 3
0
 /**
  * @see parent::updatePlainFields()
  */
 function updatePlainFields()
 {
     parent::updatePlainFields();
     // To prevent from recalculate new salt and re-hash password
     if ($this->_merging) {
         return;
     }
     $this->user_password = null;
     // If no raw password or already hashed, nothing to do
     if (!$this->_user_password || preg_match('/^[0-9a-f]{32}$/i', $this->_user_password)) {
         return;
     }
     // If the new password hashing system is not ready yet
     if (!$this->loginSaltReady()) {
         CValue::setSessionAbs("_pass_deferred", $this->_user_password);
         $this->user_password = md5($this->_user_password);
         return;
     }
     // If user is logging, get the salt value in table
     if (!$this->_is_logging || $this->_is_changing) {
         $this->generateUserSalt();
         return;
     }
     // If user is trying to log in, we have to compare hashes with corresponding user in table
     $where = array("user_username" => " = '{$this->user_username}'");
     $_user = new CUser();
     $_user->loadObject($where);
     // If user exists, we compare hashes
     if ($_user->_id) {
         // Password is a SHA256 hash, we get user's salt
         if ($this->_user_password && strlen($_user->user_password) == 64) {
             $this->user_password = hash("SHA256", $_user->user_salt . $this->_user_password);
             return;
         }
         // Password is an old MD5 hash, we have to update
         if ($_user->user_password == md5($this->_user_password)) {
             $this->generateUserSalt();
             $_user->_user_password = $this->_user_password;
             $_user->_user_salt = $this->user_salt;
             $_user->store();
         } else {
             // Won't load anything
             $this->user_password = "******";
         }
     }
 }