From e68d4887aa1ac0d17b2ce8f89f5f18e4a636b827 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 15 Sep 2009 11:10:06 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : ba0.exe ba1.exe Ricompilazione Demo : [ ] Commento : Resa possibile manutenzione archivi anche quando il file degli utenti risulti danneggiato o mancante git-svn-id: svn://10.65.10.50/trunk@19287 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba0100.cpp | 28 +++++++++++++++++++++++++--- ba/ba1100.cpp | 9 +++++---- ba/ba1101.cpp | 8 ++++---- ba/ba1102.cpp | 2 +- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/ba/ba0100.cpp b/ba/ba0100.cpp index edd2325bd..89ab7e6c7 100755 --- a/ba/ba0100.cpp +++ b/ba/ba0100.cpp @@ -54,6 +54,7 @@ protected: // TApplication virtual void on_firm_change(); virtual bool test_assistance_year() const; + bool test_users_file() const; bool ask_user_password(TString& utente); protected: @@ -960,12 +961,33 @@ void TMenu_application::reload_images() _menu.reload_images(); } +bool TMenu_application::test_users_file() const +{ + bool ok = prefix_valid(); + if (ok) + { + TSystemisamfile users(LF_USER); + ok = users.open_ex() == NOERR; + if (ok) + users.close(); + } + return ok; +} + bool TMenu_application::ask_user_password(TString& utente) { bool ok = false; // Disabilita le voci di personalizzazione enable_options_menu(false); + + if (!test_users_file()) + { + error_box(TR("Non e' possibile accedere al file degli utenti: necessita manutenzione")); + TExternal_app app("ba1 -0"); + app.run(true, 1, false); + return ok; // False + } TMask m("ba0100a"); m.set_handler(user_mask_handler); @@ -1082,7 +1104,7 @@ int TMenu_application::get_user_status(const char* usr) const CHECK(usr && *usr, "Utente nullo"); int status = 0; - if (prefix_valid()) + if (test_users_file()) { TLocalisamfile utonti(LF_USER); utonti.put(USR_USERNAME, usr); @@ -1109,7 +1131,7 @@ bool TMenu_application::set_user_status(const char* usr, int status) const CHECK(usr && *usr, "Utente nullo"); bool ok = false; - if (prefix_valid()) + if (test_users_file()) { TLocalisamfile utonti(LF_USER); utonti.put(USR_USERNAME, usr); @@ -1141,7 +1163,7 @@ bool TMenu_application::check_user() { TConfig campo_ini(CONFIG_INSTALL, "Main"); const bool use_system_user = campo_ini.get_bool("AutoLogin"); - if (use_system_user) + if (use_system_user && test_users_file()) ok = !cache().get(LF_USER, utente).empty(); } diff --git a/ba/ba1100.cpp b/ba/ba1100.cpp index 2e3433369..9e12a8c1d 100755 --- a/ba/ba1100.cpp +++ b/ba/ba1100.cpp @@ -653,7 +653,7 @@ void TManutenzione_app::edit_riga (long riga_sel, TToken_string& riga) switch (tasto) { case K_F4: - if (logicnum > 1) + if (logicnum >= LF_USER) { const TFilename filename(_mask->get(FLD_NOME)); const TString& tabella = _mask->get(F_TAB); @@ -694,7 +694,7 @@ void TManutenzione_app::edit_riga (long riga_sel, TToken_string& riga) f_name.ext("dbf"); if (!f_name.exist()) - f.build(eox); + f.build(); _browse->dir().get(logicnum, _nolock, _nordir, _sysdirop); } @@ -1437,8 +1437,9 @@ void TManutenzione_app::load_des() bool TManutenzione_app::set_converting() { - TIsamfile utenti(LF_USER); - utenti.open(_excllock); + TSystemisamfile utenti(LF_USER); + if (utenti.open_ex(_excllock) != NOERR) + return yesno_box(TR("Il file degli utenti risulta compromesso, si desidera proseguire ugualmente?")); bool ok = false; while (!ok) diff --git a/ba/ba1101.cpp b/ba/ba1101.cpp index 15e7c344a..f048c571e 100755 --- a/ba/ba1101.cpp +++ b/ba/ba1101.cpp @@ -153,9 +153,9 @@ HIDDEN bool len_handler(TMask_field& f, KEY key) case _longzerofld: return len <= 10; default: - return TRUE; + break; } - return TRUE; + return true; } bool TRec_sheet::fld_notify(TSheet_field& f, int r, KEY k) @@ -214,7 +214,7 @@ void TRec_sheet::save() // Il bottone "salva" salva anche il trr e dir in recdesc TFilename nf; - nf << "recdesc\\f" << _dir.num(); + nf << "recdesc/f" << _dir.num(); nf.ext("trr"); { _rec.set_des(_descr,_tab.upper()); @@ -280,7 +280,7 @@ void TRec_sheet::edit() int nkeys = _rec.keys(); for (i = 0; i < nkeys; i++) f2.row(i) = _rec.keydef(i); f2.disable_cell(0, 1); - while (TRUE) + while (true) { f1.force_update(0); // Non togliere, serve per fare l'update della descrizione quando si fa l'import!! switch (_mask->run()) diff --git a/ba/ba1102.cpp b/ba/ba1102.cpp index de6c373cd..639bb8ad8 100755 --- a/ba/ba1102.cpp +++ b/ba/ba1102.cpp @@ -161,7 +161,7 @@ bool TEdit_file::browse_cursor(TCursor& cursor, const TFilename& fname) bool TEdit_file::browse_file(int logicnum, const TFilename& name, const TString& tab) { - if (logicnum > 2) + if (logicnum >= LF_USER) { TSystemisamfile test(logicnum); int err = test.open_ex();