Beispiel #1
0
 if ($discipline_name = $results[$i]["discipline_name"]) {
     $discipline = new CDiscipline();
     $discipline->text = strtoupper($discipline_name);
     $discipline->loadMatchingObject();
     if ($discipline->_id) {
         $mediuser->discipline_id = $discipline->_id;
     } else {
         $unfound["discipline_name"][$discipline_name] = true;
     }
 }
 // Dry run to check references
 if ($dryrun) {
     continue;
 }
 $mediuser->unescapeValues();
 $msg = $mediuser->store();
 if ($msg) {
     CAppUI::setMsg($msg, UI_MSG_ERROR);
     $results[$i]["error"] = $msg;
     $results[$i]["username"] = "";
     $results[$i]["password"] = "";
     continue;
 }
 CAppUI::setMsg("Utilisateur créé", UI_MSG_OK);
 $mediuser->insFunctionPermission();
 $mediuser->insGroupPermission();
 $results[$i]["result"] = 0;
 $results[$i]["username"] = $mediuser->_user_username;
 $results[$i]["password"] = $mediuser->_user_password;
 $number_idex = $results[$i]["idex"];
 if (!$number_idex) {
        $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
        if ($type == "sec") {
            $mediuser->_profile_id = $profile_sec;
            $mediuser->_user_type = 10;
        }
        //store
        if ($msg = $mediuser->store()) {
            CAppUI::stepAjax($msg, UI_MSG_WARNING);
            continue;
        }
        CAppUI::stepAjax("Cabinet_user_created_name%s_firstname%s_username%s_with_password_%s", UI_MSG_OK, $mediuser->_user_last_name, $mediuser->_user_first_name, $mediuser->_user_username, $mediuser->_user_password);
    }
}
CAppUI::callbackAjax("changePagePrimaryUsers", $cabinet->_id);