/**
  * Create the mediuser
  *
  * @param CMediusers $mediuser mediuser
  *
  * @return int
  */
 function createDoctor(CMediusers $mediuser)
 {
     $sender = $this->_ref_sender;
     $function = new CFunctions();
     $function->text = CAppUI::conf("hl7 importFunctionName");
     $function->group_id = $sender->group_id;
     $function->loadMatchingObjectEsc();
     if (!$function->_id) {
         $function->type = "cabinet";
         $function->compta_partagee = 0;
         $function->color = "ffffff";
         $function->store();
     }
     $mediuser->function_id = $function->_id;
     $mediuser->makeUsernamePassword($mediuser->_user_first_name, $mediuser->_user_last_name, null, true);
     $mediuser->_user_type = 13;
     // Medecin
     $mediuser->actif = CAppUI::conf("hl7 doctorActif") ? 1 : 0;
     $user = new CUser();
     $user->user_last_name = $mediuser->_user_last_name;
     $user->user_first_name = $mediuser->_user_first_name;
     // On recherche par le seek
     $users = $user->seek("{$user->user_last_name} {$user->user_first_name}");
     if (count($users) == 1) {
         $user = reset($users);
         $user->loadRefMediuser();
         $mediuser = $user->_ref_mediuser;
     } else {
         // Dernière recherche si le login est déjà existant
         $user = new CUser();
         $user->user_username = $mediuser->_user_username;
         if ($user->loadMatchingObject()) {
             // On affecte un username aléatoire
             $mediuser->_user_username .= rand(1, 10);
         }
         $mediuser->store();
     }
     return $mediuser->_id;
 }
示例#2
0
    }
}
CAppUI::stepAjax("Cabinet_msg_cabinet%s_created_num%d", UI_MSG_OK, $cabinet->text, $cabinet->_id);
// --------------------------------
// praticien(s) && secretaires
$profile_prat = CValue::post("profile_prat");
$profile_sec = CValue::post("profile_sec");
foreach ($_POST["user"] as $type => $_user_list) {
    foreach ($_user_list as $_user) {
        if (!$_user['lastname'] || !$_user['firstname']) {
            continue;
        }
        $mediuser = new CMediusers();
        $mediuser->_user_last_name = trim($_user['lastname']);
        $mediuser->_user_first_name = trim($_user['firstname']);
        $mediuser->makeUsernamePassword($mediuser->_user_first_name, $mediuser->_user_last_name);
        $where = array();
        $ljoin["users"] = "users_mediboard.user_id = users.user_id";
        $where['users.user_username'] = "******" . $mediuser->_user_username . "'";
        $mediuser->loadObject($where, null, null, $ljoin);
        if ($mediuser->_id) {
            CAppUI::stepAjax("Cabinet_mediuser_prenom%s_nom%s_username%s_already_exist", UI_MSG_WARNING, $mediuser->_user_first_name, $mediuser->_user_last_name, $mediuser->_user_username);
            continue;
        }
        $mediuser->function_id = $cabinet->_id;
        //praticien
        if ($type == "prat") {
            $mediuser->_profile_id = $profile_prat;
            $mediuser->_user_type = 13;
        }
        //secretaire
示例#3
0
 if (!is_numeric($mediuser->_user_type) || !array_key_exists($mediuser->_user_type, CUser::$types)) {
     $unfound["user_type"][$mediuser->_user_type] = true;
 }
 if (CAppUI::conf("ref_pays") == 1) {
     $mediuser->adeli = $results[$i]["adeli"];
     $mediuser->rpps = $results[$i]["rpps"];
 } else {
     $mediuser->ean = $results[$i]["ean"];
     $mediuser->rcc = $results[$i]["rcc"];
 }
 $mediuser->actif = 1;
 $mediuser->remote = $results[$i]["remote"];
 // On force la regénération du mot de passe
 $mediuser->_force_change_password = true;
 // Password
 $mediuser->makeUsernamePassword($results[$i]["firstname"], $results[$i]["lastname"]);
 if ($results[$i]["password"]) {
     $mediuser->_user_password = $results[$i]["password"];
 }
 // Username
 if ($results[$i]["username"]) {
     $mediuser->_user_username = $results[$i]["username"];
 }
 $user = new CUser();
 $user->user_username = $mediuser->_user_username;
 if ($user->loadMatchingObject()) {
     $unfound["user"][$mediuser->_user_last_name] = true;
 }
 // Profil
 if ($profil_name = $results[$i]["profil_name"]) {
     $profil = new CUser();
 /**
  * Création du praticien
  *
  * @param CMediusers $mediuser Mediuser
  *
  * @return int
  */
 function createPraticien(CMediusers $mediuser)
 {
     $sender = $this->_ref_echange_hprim->_ref_sender;
     $functions = new CFunctions();
     $functions->text = CAppUI::conf("hprimxml functionPratImport");
     $functions->group_id = $sender->group_id;
     $functions->loadMatchingObject();
     if (!$functions->loadMatchingObject()) {
         $functions->type = "cabinet";
         $functions->compta_partagee = 0;
         $functions->store();
     }
     $mediuser->function_id = $functions->_id;
     $mediuser->makeUsernamePassword($mediuser->_user_first_name, $mediuser->_user_last_name, null, true);
     $user_type = CAppUI::conf("hprimxml user_type");
     $mediuser->_user_type = $user_type ? $user_type : 13;
     // Medecin
     $mediuser->actif = CAppUI::conf("hprimxml medecinActif") ? 1 : 0;
     $user = new CUser();
     $user->user_last_name = $mediuser->_user_last_name;
     $user->user_first_name = $mediuser->_user_first_name;
     $listPrat = $user->seek("{$user->user_last_name} {$user->user_first_name}");
     if (count($listPrat) == 1) {
         $user = reset($listPrat);
         $user->loadRefMediuser();
         $mediuser = $user->_ref_mediuser;
     } else {
         $mediuser->store();
     }
     return $mediuser->_id;
 }