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
This commit is contained in:
guy 2009-09-15 11:10:06 +00:00
parent 12484ac921
commit e68d4887aa
4 changed files with 35 additions and 12 deletions

View File

@ -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();
}

View File

@ -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)

View File

@ -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())

View File

@ -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();