Reso più resistente avvio applicazione anche in assenza di LF_USER ed LF_NDITTE
git-svn-id: svn://10.65.10.50/branches/R_10_00@23039 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5cd0da4ad1
commit
26b90550ff
@ -21,6 +21,9 @@
|
||||
#define ANA_TELRF "TELRF"
|
||||
#define ANA_DVARSLORES "DVARSLORES"
|
||||
#define ANA_DVARDF "DVARDF"
|
||||
#define ANA_EVECC "EVECC"
|
||||
#define ANA_CATPAR "CATPAR"
|
||||
#define ANA_ESCPRECOMP "ESCPRECOMP"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -388,8 +388,6 @@ void TApplication::set_title(const char* t)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TApplication::set_perms()
|
||||
{
|
||||
_user_aut.set(ENDAUT, true); // Forza dimensioni corrette del bit array!
|
||||
@ -397,14 +395,15 @@ void TApplication::set_perms()
|
||||
_user_aut.set(0, true); // ... tranne la BASE
|
||||
|
||||
const TString& utente = user();
|
||||
if (utente.full())
|
||||
if (utente.full() && utente.compare(::dongle().administrator(), -1, 0) != 0)
|
||||
{
|
||||
if (utente.compare(::dongle().administrator(), -1, 0) != 0)
|
||||
int err = _iskeynotfound;
|
||||
if (use_files())
|
||||
{
|
||||
int err = _iskeynotfound;
|
||||
if (use_files())
|
||||
TSystemisamfile users(LF_USER);
|
||||
err = users.open_ex();
|
||||
if (err == NOERR)
|
||||
{
|
||||
TLocalisamfile users(LF_USER);
|
||||
users.put(USR_USERNAME, utente);
|
||||
err = users.read();
|
||||
if (err == NOERR)
|
||||
@ -417,14 +416,18 @@ void TApplication::set_perms()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (err != NOERR && utente.compare("GUEST", -1, true) == 0)
|
||||
_user_aut.set(); // abilita tutto
|
||||
}
|
||||
else
|
||||
if (err != NOERR)
|
||||
{
|
||||
_user_aut.set(); // abilita tutto
|
||||
if (utente.compare("GUEST", -1, true) != 0)
|
||||
warning_box(FR("Impossibile accedere ai permessi dell'utente %s"), (const char*)utente);
|
||||
_user_aut.set(); // abilita tutto
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_user_aut.set(); // abilita tutto
|
||||
}
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
@ -196,7 +196,7 @@ void CGetFile(logicname,filed,lockmode,dirflg)
|
||||
if (TESTLOCK(fdir[dirflg].IOR))
|
||||
{
|
||||
char msg[256];
|
||||
sprintf(msg, "Sono in attesa della directory n.ro %d", logicname);
|
||||
sprintf(msg, "Attesa dati file n.ro %d", logicname);
|
||||
xvt_dm_post_message(msg);
|
||||
|
||||
}
|
||||
|
@ -72,6 +72,7 @@
|
||||
#define CLI_DIPPUBB "DIPPUBB"
|
||||
#define CLI_ENTE "ENTE"
|
||||
#define CLI_AUTORIZ "AUTORIZ"
|
||||
#define CLI_SPLITPAY "SPLITPAY"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -398,7 +398,7 @@ bool TDongle::ssa_login(const char* mod)
|
||||
_year_assist = dn.assist_year();
|
||||
else
|
||||
_year_assist = 2121;
|
||||
for (word m = BAAUT; m < ENDAUT; m++)
|
||||
for (word m = BAAUT+1; m < ENDAUT; m++)
|
||||
{
|
||||
const TString& name = module_code2name(m);
|
||||
if (xvt_dongle_sa_test(name) == 0)
|
||||
|
@ -4189,7 +4189,7 @@ bool TForm::validate(TForm_item &cf, TToken_string &s)
|
||||
|
||||
if (code== "_PAGENO") // Messaggio per stampare il numero di pagina corrente
|
||||
{
|
||||
TString16 pg; pg << int(printer().getcurrentpage() );
|
||||
TString16 pg; pg << int(printer().getcurrentpage());
|
||||
cf.set(pg);
|
||||
return TRUE;
|
||||
}
|
||||
@ -4205,7 +4205,7 @@ bool TForm::validate(TForm_item &cf, TToken_string &s)
|
||||
{
|
||||
// Messaggio per la valutazione di espressioni numeriche e stringhe
|
||||
int comma = s.find(',');
|
||||
TExpression rval(s.mid(comma+1),code[1]=='N' ? _numexpr:_strexpr,TRUE);
|
||||
TExpression rval(s.mid(comma+1), code[1]=='N' ? _numexpr:_strexpr, true);
|
||||
cf.section().eval_expr(rval);
|
||||
if (!rval.error())
|
||||
cf.set(rval.as_string());
|
||||
|
@ -1300,8 +1300,8 @@ int TBaseisamfile::_open_ex(
|
||||
}
|
||||
else
|
||||
{
|
||||
_isam_handle = 0;
|
||||
_lasterr = get_error(_isam_handle);
|
||||
_isam_handle = 0;
|
||||
}
|
||||
return _lasterr;
|
||||
}
|
||||
@ -2229,15 +2229,21 @@ int TSystemisamfile::packfile(
|
||||
TRecnotype new_eod = 0L;
|
||||
if (!zap)
|
||||
{
|
||||
TDir d(num()); // Chi commenta muore!
|
||||
d.get(num(),_nolock, (d.is_com()) ? _comdir : _nordir, _sysdirop);
|
||||
const int lf = num();
|
||||
TDir d(lf); // Chi commenta muore!
|
||||
d.get(lf,_nolock, d.is_com() ? _comdir : _nordir, _sysdirop);
|
||||
new_eod = d.eod();
|
||||
if (d.len() <= 1) // Dati rovinati?
|
||||
{
|
||||
d.set_len(curr().len());
|
||||
d.put(lf, d.is_com() ? _comdir : _nordir, _sysdirop);
|
||||
}
|
||||
}
|
||||
|
||||
int err = DB_packfile(vis, fname, new_eod);
|
||||
|
||||
if (zap && err == NOERR)
|
||||
err = packindex(vis, FALSE);
|
||||
err = packindex(vis, false);
|
||||
if (err == NOERR && curr().has_memo())
|
||||
err = DB_packmemo(vis,fname);
|
||||
|
||||
|
@ -1713,7 +1713,7 @@ void TMask::activate(
|
||||
// @mfunc Abilita/disabilita un campo
|
||||
void TMask::enable(
|
||||
short fld_id, // @parm Identificatore del campo da abilitare (0 tutti i campi, <0 id gruppo)
|
||||
bool on) // @parm Indica l'operazione da svolgere sul campo:
|
||||
bool on) // @parm Indica se abilitare il campo
|
||||
//
|
||||
// @flag true | Abilita il campo (default)
|
||||
// @flag false | Disabilita il campo
|
||||
@ -2682,7 +2682,11 @@ void TMask::post_error_message(const char* msg, int sev)
|
||||
{
|
||||
CHECK(sev > 0 && msg, "Bad error message posted");
|
||||
if (_error_severity > 0) // C'e' gia' un messaggio d'errore in coda
|
||||
{
|
||||
if (_error_message == msg)
|
||||
return; // Ignora messaggio duplicato;
|
||||
on_idle();
|
||||
}
|
||||
_error_message = msg;
|
||||
_error_severity = sev;
|
||||
}
|
||||
|
@ -1391,7 +1391,7 @@ int TPrefix::firms(TString_array& codes)
|
||||
const TString& code = n.name_only();
|
||||
TFilename s = firm2dir(atol(code));
|
||||
s.add("dir.gen");
|
||||
if (s.exist())
|
||||
if (s.exist() && xvt_fsys_file_attr(s, XVT_FILE_ATTR_WRITE))
|
||||
codes.add(code);
|
||||
}
|
||||
xvt_slist_destroy(dirs);
|
||||
@ -1408,6 +1408,10 @@ int TPrefix::firms(TPointer_array& codes)
|
||||
|
||||
int TPrefix::firms(TArray& ditte)
|
||||
{
|
||||
TLocalisamfile* nditte = NULL;
|
||||
if (prefix_valid())
|
||||
nditte = new TLocalisamfile(LF_NDITTE);
|
||||
|
||||
ditte.destroy();
|
||||
TPointer_array codes; firms(codes);
|
||||
for (int i = 0; i < codes.items(); i++)
|
||||
@ -1416,29 +1420,32 @@ int TPrefix::firms(TArray& ditte)
|
||||
TFilename ininame = firm2dir(codditta);
|
||||
ininame.add("ditta.ini");
|
||||
TConfig ini(ininame, "Main");
|
||||
if (prefix_valid())
|
||||
if (nditte != NULL)
|
||||
{
|
||||
TLocalisamfile nditte(LF_NDITTE);
|
||||
TRectype& ditta = nditte.curr();
|
||||
TRectype& ditta = nditte->curr();
|
||||
ditta.put(NDT_CODDITTA, codditta);
|
||||
if (nditte.read() == NOERR)
|
||||
if (nditte->read() == NOERR)
|
||||
{
|
||||
for (int f = 0; f < ditta.items(); f++)
|
||||
{
|
||||
const char* fname = ditta.fieldname(f);
|
||||
const TString& value = ditta.get(fname);
|
||||
if (!value.blank())
|
||||
if (value.full())
|
||||
ini.set(fname, value);
|
||||
else
|
||||
ini.remove(fname);
|
||||
}
|
||||
}
|
||||
}
|
||||
TAssoc_array& fields = ini.list_variables();
|
||||
if (fields.empty())
|
||||
{
|
||||
ini.set(NDT_CODDITTA, codditta);
|
||||
}
|
||||
ditte.add(fields);
|
||||
}
|
||||
|
||||
if (nditte)
|
||||
delete nditte;
|
||||
|
||||
return ditte.items();
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
TFast_isamfile::TFast_isamfile(int logicnum) : TIsamfile(logicnum)
|
||||
{
|
||||
int err = open_ex(_excllock, true);
|
||||
if (err != NOERR)
|
||||
if (err != NOERR && err != -60)
|
||||
err = open(_manulock, true);
|
||||
if (err != NOERR)
|
||||
cantread_box(name());
|
||||
@ -690,9 +690,9 @@ const TObject& TFile_cache::query(const char* code)
|
||||
TRectype& curr = f.curr();
|
||||
if (_code.full())
|
||||
{
|
||||
const RecDes& recd = curr.rec_des(); // Descrizione del record della testata
|
||||
const RecDes& recd = curr.rec_des(); // Descrizione del record della testata
|
||||
const KeyDes& kd = recd.Ky[_key-1]; // Elenco dei campi della chiave
|
||||
for (int i = 0; i < kd.NkFields; i++) // Riempie la chiave selezionata
|
||||
for (int i = 0; i < kd.NkFields; i++) // Riempie la chiave selezionata
|
||||
{
|
||||
const int nf = kd.FieldSeq[i] % MaxFields;
|
||||
const RecFieldDes& rf = recd.Fd[nf];
|
||||
@ -989,7 +989,7 @@ bool TDB_cache::discard(const TRectype& curr)
|
||||
{
|
||||
const int file = curr.num(); // Numero logico del file (o tabella)
|
||||
const RecDes& recd = curr.rec_des(); // Descrizione del record della testata
|
||||
const KeyDes& kd = recd.Ky[0]; // Elenco dei campi della chiave 1
|
||||
const KeyDes& kd = recd.Ky[0]; // Elenco dei campi della chiave 1
|
||||
|
||||
TToken_string code;
|
||||
for (int i = 0; i < kd.NkFields; i++) // Riempie la chiave
|
||||
|
@ -2464,7 +2464,7 @@ const char* TFieldref::read(const TRectype& rec) const
|
||||
{
|
||||
const TRecfield rf((TRectype&)rec, _name, _from, _to-1);
|
||||
if (rf.type() == _memofld && _to > 0)
|
||||
buffer = rec.get(_name).mid(_from, _to);
|
||||
buffer = rec.get(_name).sub(_from, _to);
|
||||
else
|
||||
buffer = rf;
|
||||
}
|
||||
|
@ -1608,6 +1608,7 @@ void TReport_field::print(TBook& book) const
|
||||
}
|
||||
else
|
||||
{
|
||||
print_rect(book);
|
||||
const TString& str = formatted_text();
|
||||
if (str.full())
|
||||
{
|
||||
@ -1618,7 +1619,6 @@ void TReport_field::print(TBook& book) const
|
||||
TString8 sec_code; section().code(sec_code);
|
||||
book.draw_text(pr, str, sec_code);
|
||||
}
|
||||
print_rect(book);
|
||||
}
|
||||
break;
|
||||
case 'E':
|
||||
@ -1651,7 +1651,8 @@ void TReport_field::print(TBook& book) const
|
||||
case 'T':
|
||||
if (_picture.full())
|
||||
{
|
||||
book.set_font(print_font());
|
||||
const TReport_font& pf = print_font();
|
||||
book.set_font(pf);
|
||||
const TReport_rct& pr = print_rect(book); // Calcolo rettangolo dopo aver settato il font!
|
||||
book.set_text_align(horizontal_alignment(), vertical_alignment());
|
||||
book.set_text_color(text_color(), back_color());
|
||||
@ -1681,18 +1682,29 @@ void TReport_field::print(TBook& book) const
|
||||
const TString& str = formatted_text();
|
||||
if (str.full())
|
||||
{
|
||||
book.set_font(print_font());
|
||||
const TReport_font& pf = print_font();
|
||||
book.set_font(pf);
|
||||
book.set_text_align(horizontal_alignment(), vertical_alignment());
|
||||
book.set_text_color(text_color(), back_color());
|
||||
TString8 sec_code; section().code(sec_code);
|
||||
|
||||
if (dynamic_height() || _rct.height() > 100) // Multiriga?
|
||||
bool multiline = dynamic_height();
|
||||
if (!multiline && (pf.lpi() > 6 || get_rect().height() > 100))
|
||||
{
|
||||
const int font_height = 720 / pf.lpi();
|
||||
const int field_height = (get_rect().height() * 720) / (100 * section().report().lpi());
|
||||
multiline = field_height > 3*font_height/2;
|
||||
}
|
||||
if (multiline) // Multiriga?
|
||||
{
|
||||
TString_array para;
|
||||
TReport_rct rect = get_draw_rect();
|
||||
book.compute_text_frame(str, print_font(), rect, para);
|
||||
book.compute_text_frame(str, pf, rect, para);
|
||||
print_rect(_draw_rct, book); // Stampa eventuale cornice
|
||||
book.draw_text(_draw_rct, para, sec_code); // Stampa paragrafo
|
||||
if (para.empty())
|
||||
book.draw_text(_draw_rct, str, sec_code);
|
||||
else
|
||||
book.draw_text(_draw_rct, para, sec_code); // Stampa paragrafo
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
int size() const { return _size; }
|
||||
XVT_FONT_STYLE_MASK style() const { return _style; }
|
||||
int cpi() const { return _cpi; }
|
||||
int lpi() const { return 6 * DEFAULT_FONT_SIZE / _size; }
|
||||
XVT_FNTID get_xvt_font(const TWindow& win) const;
|
||||
XVT_FNTID get_preview_font(const TWindow& win, const TSize& res) const;
|
||||
void unmap();
|
||||
|
@ -1494,7 +1494,7 @@ bool TArray_sheet::destroy(int i)
|
||||
uncheck(-1);
|
||||
enable_row(-1);
|
||||
reset_parked();
|
||||
return _data.destroy(i, TRUE);
|
||||
return _data.destroy(i, true);
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
@ -100,7 +100,7 @@ bool fcopy(
|
||||
|
||||
// Copia il file su se stesso?
|
||||
if (xvt_str_compare_ignoring_case(orig, dest) == 0)
|
||||
return TRUE; // Or FALSE?
|
||||
return true; // Or FALSE?
|
||||
|
||||
FILE* i = fopen(orig, rflag);
|
||||
if (i == NULL)
|
||||
@ -115,13 +115,13 @@ bool fcopy(
|
||||
if (append)
|
||||
return error_box(FR("Impossibile aprire il file '%s'\nper accodare il file '%s'\nErrore %d"), dest, orig, errno);
|
||||
else
|
||||
return error_box(FR("Impossibile creare il file '%s'\nper copiare il file '%s'\nErrore %d"), dest, orig, errno);
|
||||
return error_box(FR("Impossibile scrivere il file '%s'\nper copiare il file '%s'\nErrore %d"), dest, orig, errno);
|
||||
}
|
||||
|
||||
const int size = 16*1024;
|
||||
TString buffer(size);
|
||||
|
||||
bool ok = TRUE;
|
||||
bool ok = true;
|
||||
while (ok)
|
||||
{
|
||||
const word letti = fread(buffer.get_buffer(), 1, size, i);
|
||||
|
Loading…
x
Reference in New Issue
Block a user