Ricorretto cambio ditta che non permetteva conversione
git-svn-id: svn://10.65.10.50/branches/R_10_00@23153 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8da6ac7473
commit
062241ade5
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef __ARRAY_H
|
||||
#define __ARRAY_H
|
||||
|
||||
|
@ -189,6 +189,11 @@ bool TAssoc_array::add(
|
||||
delete o->_obj;
|
||||
o->_obj = obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
NFCHECK("deleting duplicate hash object");
|
||||
delete obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
o->_obj = obj;
|
||||
@ -197,12 +202,29 @@ bool TAssoc_array::add(
|
||||
|
||||
bool TAssoc_array::add(const char* key, const TObject& obj, bool force)
|
||||
{
|
||||
/*
|
||||
// Non inserire l'Hash_object se non lo trovi (ci pensa la add sotto)
|
||||
bool isnew = false;
|
||||
_lookup(key,isnew,false);
|
||||
if (!isnew && !force)
|
||||
return true;
|
||||
return add(key,obj.dup(),force);
|
||||
*/
|
||||
bool isnew = false;
|
||||
THash_object* o = _lookup(key, isnew, true);
|
||||
if (!isnew)
|
||||
{
|
||||
if (force)
|
||||
{
|
||||
if (o->_obj != NULL)
|
||||
delete o->_obj;
|
||||
o->_obj = obj.dup();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
o->_obj = obj.dup();
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
@ -1366,10 +1366,7 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
|
||||
{
|
||||
XI_OBJ* itf = get_interface(win);
|
||||
XI_RCT rct = coord2rct(itf, left, top, width, height);
|
||||
|
||||
//rct.top = _obj->v.text->xi_rct.bottom - 2;
|
||||
rct.top += XI_FU_MULTIPLE;
|
||||
|
||||
rct.bottom -= XI_FU_MULTIPLE / 2;
|
||||
|
||||
XI_OBJ_DEF* def = xi_add_rect_def(NULL, cid, &rct, XI_ATR_VISIBLE, 0, 0); // Ignore colors
|
||||
@ -1391,13 +1388,15 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
|
||||
_rct = xi_create(itf, def);
|
||||
CHECKD(_rct, "Can't create Groupbox_control ", cid);
|
||||
|
||||
XI_RCT& rt = _obj->v.text->rct;
|
||||
//rt.top--; rt.bottom--;
|
||||
const int txt_height = rt.bottom-rt.top;
|
||||
rt.bottom = _rct->v.rect->rct.top - 1;
|
||||
rt.top = rt.bottom - txt_height + 2;
|
||||
rt.left = _rct->v.rect->rct.left;
|
||||
rt.right = _rct->v.rect->rct.right;
|
||||
XI_RCT& rt = _obj->v.text->rct; // Rettangolo testo
|
||||
XI_RCT& rr = _rct->v.rect->rct; // Rettangolo box
|
||||
rr.top -= 2;
|
||||
|
||||
//const int txt_height = rt.bottom-rt.top;
|
||||
rt.bottom = rr.top - 1;
|
||||
//rt.top = rt.bottom - txt_height + 2;
|
||||
rt.left = rr.left;
|
||||
rt.right = rr.right;
|
||||
|
||||
xi_dequeue();
|
||||
xi_tree_free(def);
|
||||
|
@ -132,13 +132,16 @@ void TDowJones::test_cache()
|
||||
}
|
||||
|
||||
if (_euro_val.empty()) // Si son dimenticati dell'EURO?
|
||||
{
|
||||
_euro_val = "EUR";
|
||||
if (!_cache.is_key(_euro_val))
|
||||
{
|
||||
TExchangeData* euro = new TExchangeData;
|
||||
euro->_chg = UNO; euro->_dec = euro->_dec_prices = 2;
|
||||
euro->_is_euro = true;
|
||||
_euro_val = "EUR";
|
||||
_cache.add(_euro_val, euro);
|
||||
}
|
||||
}
|
||||
if (_firm_val.empty())
|
||||
_firm_val = _euro_val;
|
||||
}
|
||||
|
@ -1259,7 +1259,7 @@ int TBaseisamfile::is_valid(bool exclusive)
|
||||
{ // Ritorna NOERR se il file puo' essere aperto senza errori
|
||||
CHECKD(_isam_handle == 0, "Can't reopen file ", _logicnum);
|
||||
TFilename filename;
|
||||
TIsam_handle isam_handle = prefix().open_isamfile(_logicnum, filename, exclusive, TRUE);
|
||||
TIsam_handle isam_handle = prefix().open_isamfile(_logicnum, filename, exclusive, true);
|
||||
TCodeb_handle fhnd = isam_handle > 0 ? prefix().get_handle(isam_handle,1) : isam_handle;
|
||||
|
||||
int err = NOERR;
|
||||
@ -1276,7 +1276,11 @@ int TBaseisamfile::is_valid(bool exclusive)
|
||||
{
|
||||
const int dbfreclen = DB_reclen(fhnd);
|
||||
if (dbfreclen != trcreclen)
|
||||
{
|
||||
err = _istrcerr;
|
||||
if (_logicnum == LF_CLIFO)
|
||||
error_box("Clifo trc=%d dbf=%d", trcreclen, dbfreclen);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1867,7 +1871,8 @@ int TSystemisamfile::update(
|
||||
bool interactive) // @parm Indica se riportare i campi personalizzati
|
||||
|
||||
{
|
||||
if (newrec.len() == 0)
|
||||
//if (newrec.len() == 0)
|
||||
if (newrec.len() <= 8)
|
||||
{
|
||||
// if (interactive) error_box(FR("Il nuovo tracciato per il file %d e' vuoto"), num()); // Fastidioso per Ilaria
|
||||
setstatus(_istrcerr);
|
||||
@ -1877,9 +1882,8 @@ int TSystemisamfile::update(
|
||||
int err = NOERR;
|
||||
|
||||
TTrec wrec(newrec);
|
||||
TDir dir;
|
||||
TDir dir; dir.get(num(), _unlock, _nordir, _sysdirop);
|
||||
|
||||
dir.get(num(), _unlock, _nordir, _sysdirop);
|
||||
const bool is_com = prefix().is_com();
|
||||
const bool toconvert = is_com ? dir.is_com() : dir.is_firm();
|
||||
|
||||
@ -1908,7 +1912,7 @@ int TSystemisamfile::update(
|
||||
|
||||
if (toconvert)
|
||||
{
|
||||
err = exec_convapp(lev, TRUE); // Pre-conversion
|
||||
err = exec_convapp(lev, true); // Pre-conversion
|
||||
if (err != NOERR)
|
||||
{
|
||||
setstatus(err);
|
||||
@ -1917,7 +1921,7 @@ int TSystemisamfile::update(
|
||||
|
||||
if (!lcf && wrec == oldrec)
|
||||
{
|
||||
err = exec_convapp(lev, FALSE); // Post-conversion (SOLO se il record e' rimasto uguale)
|
||||
err = exec_convapp(lev, false); // Post-conversion (SOLO se il record e' rimasto uguale)
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
@ -1949,7 +1953,7 @@ int TSystemisamfile::update(
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!yesno_box("Il campo %s non verra' preservato, devo continuare?",
|
||||
if(!yesno_box("Il campo %s non verrà preservato: continuare?",
|
||||
(const char*)fname))
|
||||
return NOERR;
|
||||
}
|
||||
@ -1999,7 +2003,7 @@ int TSystemisamfile::update(
|
||||
TString s; s << TR("Aggiornamento") << ' ' << fname;
|
||||
|
||||
const TRecnotype nitems = items();
|
||||
TProgress_monitor p(nitems > 0 ? nitems : 1, s, is_power_station());
|
||||
TProgress_monitor p(nitems, s, is_power_station());
|
||||
|
||||
TExtrectype nrec(wrec);
|
||||
|
||||
@ -2024,7 +2028,7 @@ int TSystemisamfile::update(
|
||||
ni++;
|
||||
|
||||
if (curr().isdeleted())
|
||||
continue;
|
||||
continue; // Shold never happen
|
||||
|
||||
nrec.zero();
|
||||
for (j = outfld.last(); j >= 0; j = outfld.pred(j))
|
||||
@ -3199,7 +3203,7 @@ TRectype::TRectype(const TRectype& r)
|
||||
*_memo_data = *r._memo_data;
|
||||
}
|
||||
memcpy(_rec, r._rec, _length);
|
||||
strcpy_s(_tab, sizeof(_tab), r._tab);
|
||||
memcpy(_tab, r._tab, sizeof(_tab));
|
||||
setempty(r.empty());
|
||||
}
|
||||
|
||||
@ -3267,7 +3271,7 @@ void TRectype::init_memo(TRecnotype recno, TIsam_handle file)
|
||||
|
||||
void TRectype::settab(const char *tab)
|
||||
{
|
||||
strcpy_s(_tab, sizeof(_tab), tab);
|
||||
strcpy(_tab, tab);
|
||||
zero();
|
||||
}
|
||||
|
||||
@ -3653,12 +3657,12 @@ void TRectype::put_str(const char* fieldname, const char* val)
|
||||
if (ft == _boolfld)
|
||||
val = (*val && strchr("1STXY", toupper(*val)) != NULL) ? "T" : "F";
|
||||
|
||||
if (*val == '\0') // VERIFICARE COL REPOSITORY
|
||||
if (*val == '\0')
|
||||
{
|
||||
TRecfield f(*this, fieldname);
|
||||
if (*f.pos() == '\0') return;
|
||||
}
|
||||
if(ft == _memofld)
|
||||
if (ft == _memofld)
|
||||
{
|
||||
_memo_data->add(val, nf);
|
||||
_memo_data->set_dirty(nf);
|
||||
@ -3739,13 +3743,11 @@ void TRectype::zero(char c)
|
||||
|
||||
if(has_memo())
|
||||
init_memo( RECORD_NON_FISICO );
|
||||
setempty(TRUE);
|
||||
setempty(true);
|
||||
}
|
||||
|
||||
|
||||
// Certified 99%
|
||||
TRectype& TRectype::operator =(const TRectype& rec)
|
||||
|
||||
{
|
||||
CHECK(num() == rec.num(), "Can't assign records of different file");
|
||||
|
||||
@ -3755,7 +3757,7 @@ TRectype& TRectype::operator =(const TRectype& rec)
|
||||
init_memo(rec._memo_data->recno(), rec._memo_data->file());
|
||||
*_memo_data = *rec._memo_data;
|
||||
}
|
||||
strcpy_s(_tab, sizeof(_tab), rec._tab);
|
||||
memcpy(_tab, rec._tab, sizeof(_tab));
|
||||
setempty(rec.empty()); // Copy emptiness status
|
||||
return *this;
|
||||
}
|
||||
@ -3995,12 +3997,24 @@ bool TRectype::edit(int logicnum, const char* alternate_key_fields, const char*
|
||||
bool TRectype::set_edit_info(const char* ut, const char* dt, const char* or)
|
||||
{
|
||||
bool ok = false;
|
||||
if (num() > LF_TAB) // Inutile tentare di gestire le tabelle
|
||||
if (num() >= LF_TABCOM)
|
||||
{
|
||||
// Se esiste un campo alfanumerioco UT*
|
||||
if (ut && *ut && type(ut) == _alfafld)
|
||||
{
|
||||
put(ut, user()); // Scrivi utente corrente
|
||||
const int len = length(ut);
|
||||
TString80 usr = user();
|
||||
|
||||
TString80 s;
|
||||
xvt_sys_get_user_name(s.get_buffer(), s.size());
|
||||
const int at = s.find('@'); if (at > 0 ) s.cut(at); // Windows 8.1 / 10.0 user profile
|
||||
if (usr.len()+s.len()+1 <= len)
|
||||
usr << ':' << s;
|
||||
|
||||
xvt_sys_get_host_name(s.get_buffer(), s.size());
|
||||
if (usr.len()+s.len()+1 <= len)
|
||||
usr << '@' << s;
|
||||
put(ut, usr); // Scrivi utente corrente
|
||||
ok = true;
|
||||
|
||||
// Se esiste un campo data DT*
|
||||
@ -4020,12 +4034,20 @@ bool TRectype::set_edit_info(const char* ut, const char* dt, const char* or)
|
||||
|
||||
bool TRectype::set_modify_info()
|
||||
{
|
||||
return set_edit_info("UTCREAZ", "DTCREAZ", "ORCREAZ");
|
||||
bool done = false;
|
||||
if (num() >= LF_LVPASPLAN && exist("UTULAGG")) // Lavanderie
|
||||
done = set_edit_info("UTULAGG", "DTULAGG", "ORULAGG"); else
|
||||
if (exist("UTENTE"))
|
||||
done = set_edit_info("UTENTE", "DATAAGG", NULL);
|
||||
return done;
|
||||
}
|
||||
|
||||
bool TRectype::set_creation_info()
|
||||
{
|
||||
return set_edit_info("UTULAGG", "DTULAGG", "ORULAGG");
|
||||
bool done = set_modify_info();
|
||||
if (num() >= LF_LVPASPLAN && exist("UTCREAZ")) // Lavanderie
|
||||
done |= set_edit_info("UTCREAZ", "DTCREAZ", "ORCREAZ");
|
||||
return done;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -494,7 +494,7 @@ const TFilename& TFile_info::load_filedes()
|
||||
{
|
||||
_dir = _filedes.SysName[0] != '$' ? _comdir : _nordir;
|
||||
_name = CAddPref(_filedes.SysName);
|
||||
strncpy_s(_filedes.Des, sizeof(_filedes.Des), dictionary_translate(_filedes.Des), sizeof(_filedes.Des)-1);
|
||||
strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des)-1);
|
||||
}
|
||||
else
|
||||
_name.cut(0);
|
||||
@ -533,8 +533,8 @@ TFile_info::TFile_info(int logicnum, TFilename& name)
|
||||
int err = DB_recinfo(_name, &_filedes, (RecDes*)&rec.rec(), keys.get_buffer());
|
||||
if (err == NOERR && prefix().add_recdes(logicnum, rec, keys))
|
||||
{
|
||||
strncpy_s(_filedes.SysName, sizeof(_filedes.SysName), _name, sizeof(_filedes.SysName));
|
||||
_filedes.SysName[sizeof(_filedes.SysName)-1] = '\0';
|
||||
strncpy(_filedes.SysName, _name, sizeof(_filedes.SysName));
|
||||
_filedes.SysName[41] = '\0';
|
||||
}
|
||||
else
|
||||
_name.cut(0);
|
||||
@ -800,15 +800,12 @@ long TFile_manager::last_change(TIsam_handle name) const
|
||||
return i.last_change();
|
||||
}
|
||||
|
||||
int TFile_manager::close_closeable(bool firm_only)
|
||||
int TFile_manager::close_closeable()
|
||||
{
|
||||
_open_files = 0; // Ricalcolo per sicurezza
|
||||
for (TIsam_handle n = _fileinfo.last(); n > 0; n = _fileinfo.pred(n))
|
||||
{
|
||||
TFile_info& i = fileinfo(n);
|
||||
if (firm_only && i.dir_type() != _nordir)
|
||||
continue;
|
||||
|
||||
if (i.is_open())
|
||||
{
|
||||
_open_files++;
|
||||
@ -824,9 +821,9 @@ int TFile_manager::close_closeable(bool firm_only)
|
||||
return _open_files;
|
||||
}
|
||||
|
||||
void TFile_manager::close_all(bool firm_only)
|
||||
void TFile_manager::close_all()
|
||||
{
|
||||
const int zoccolo_duro = close_closeable(firm_only);
|
||||
const int zoccolo_duro = close_closeable();
|
||||
#ifdef DBG
|
||||
if (zoccolo_duro > 0)
|
||||
NFCHECK("%d files refuse to be closed!", zoccolo_duro);
|
||||
@ -835,8 +832,6 @@ void TFile_manager::close_all(bool firm_only)
|
||||
for (int n = _recinfo.last(); n > 0; n = _recinfo.pred(n))
|
||||
{
|
||||
const TRecord_info& r = recinfo(n);
|
||||
if (firm_only && r.dir_type() != _nordir)
|
||||
continue;
|
||||
if (r.mutable_dir())
|
||||
_recinfo.destroy(n);
|
||||
}
|
||||
@ -1021,15 +1016,14 @@ void TPrefix::set(
|
||||
return;
|
||||
if (_prefix != ".")
|
||||
{
|
||||
const bool firm_only = !xvt_str_same(name, "COM") && !xvt_str_same(name, "DEF");
|
||||
_manager.close_all(firm_only);
|
||||
_manager.close_all();
|
||||
CCloseDir(NORDIR);
|
||||
CCloseDir(COMDIR);
|
||||
CCloseRecDir(NORDIR);
|
||||
CCloseRecDir(COMDIR);
|
||||
}
|
||||
|
||||
if (xvt_str_same(name, "DEF"))
|
||||
if (strcmp(name, "DEF") == 0)
|
||||
{
|
||||
const char* prfx = CGetPref();
|
||||
xvt_fsys_parse_pathname(prfx, NULL, NULL, _prefix.get_buffer(), NULL, NULL);
|
||||
@ -1041,7 +1035,7 @@ void TPrefix::set(
|
||||
{
|
||||
const TString saved_prf = __ptprf; // Salvo __ptprf che viene cambiato da CGetPref
|
||||
char* prfx = (char*)CGetPref(); // Safe non const cast for StPath cprefix
|
||||
strcpy_s(__ptprf, sizeof(__ptprf), saved_prf);
|
||||
strcpy(__ptprf, saved_prf);
|
||||
xvt_fsys_build_pathname(prfx, NULL, __ptprf, _prefix, NULL, NULL);
|
||||
}
|
||||
else
|
||||
@ -1086,11 +1080,12 @@ bool TPrefix::exist(long codditta) const
|
||||
|
||||
bool TPrefix::test(const char* s) const
|
||||
{
|
||||
if (s && *s && !xvt_str_same(s, "DEF"))
|
||||
if (s && *s && strcmp(s, "DEF") != 0)
|
||||
{
|
||||
TFilename s1(__ptprf);
|
||||
s1.add(s);
|
||||
s1.add("dir.gen");
|
||||
|
||||
if (s1.exist())
|
||||
{
|
||||
if (xvt_fsys_access(s1, 0x2) != 0)
|
||||
@ -1171,7 +1166,7 @@ bool TPrefix::set_studio(const char* study, long ditta)
|
||||
const TString old_study(__ptprf);
|
||||
const TString old_firm(_prefix);
|
||||
|
||||
strcpy_s(__ptprf, sizeof(__ptprf), study);
|
||||
strcpy(__ptprf, study);
|
||||
const word len = strlen(__ptprf);
|
||||
if (len > 0 && __ptprf[len-1] != '\\' && __ptprf[len-1] != '/')
|
||||
{
|
||||
@ -1184,7 +1179,7 @@ bool TPrefix::set_studio(const char* study, long ditta)
|
||||
bool ok = set_codditta(ditta, TRUE);
|
||||
if (!ok)
|
||||
{
|
||||
strcpy_s(__ptprf, sizeof(__ptprf), old_study);
|
||||
strcpy(__ptprf, old_study);
|
||||
set(old_firm, true);
|
||||
}
|
||||
return ok;
|
||||
|
@ -54,8 +54,8 @@ public:
|
||||
void notify_change(TIsam_handle name);
|
||||
long last_change(TIsam_handle name) const;
|
||||
|
||||
int close_closeable(bool firm_only = false);
|
||||
void close_all(bool firm_only = false);
|
||||
int close_closeable();
|
||||
void close_all();
|
||||
void open_all();
|
||||
|
||||
TFile_manager();
|
||||
@ -138,16 +138,19 @@ public:
|
||||
// @cmember Setta lo studio corrente
|
||||
bool set_studio(const char* study, long firm = 0);
|
||||
// @cmember Ritorna il contenuto della variabile <p _prefix>
|
||||
const char* name() const { return _prefix; }
|
||||
const char* name() const
|
||||
{ return _prefix;}
|
||||
// @cmember Ritorna il livello degli archivi
|
||||
unsigned int filelevel() const { return _filelevel; }
|
||||
unsigned int filelevel() const
|
||||
{return _filelevel;}
|
||||
|
||||
// @cmember Ritorna il livello standard degli archivi
|
||||
unsigned int get_stdlevel() const { return _stdlevel; }
|
||||
void set_stdlevel(unsigned int sl) { _stdlevel = sl; }
|
||||
|
||||
// @cmember Ritorna il numero di archivi
|
||||
int items() const { return _items; }
|
||||
int items() const
|
||||
{ return _items; }
|
||||
// @cmember Ritorna la descrizione del file passato
|
||||
const char* description(const char* cod) const;
|
||||
// @cmember Ritorna la descrizione del file passato
|
||||
@ -163,7 +166,7 @@ public:
|
||||
// @cmember Riapre tutti gli archivi della ditta attiva
|
||||
void reopen() const ;
|
||||
|
||||
TIsam_handle open_isamfile(int& logicnum, TFilename& name, bool excl = false, bool idx = true)
|
||||
TIsam_handle open_isamfile(int& logicnum, TFilename& name, bool excl = FALSE, bool idx = TRUE)
|
||||
{ return _manager.open(logicnum, name, excl, idx); }
|
||||
|
||||
int close_isamfile(TIsam_handle& name)
|
||||
|
@ -552,7 +552,7 @@ bool TRelation_application::modify_mode()
|
||||
if (err != NOERR)
|
||||
{
|
||||
if (err == _islocked)
|
||||
message_box(TR("I dati sono gia' usati da un altro programma"));
|
||||
message_box(TR("I dati sono già usati da un altro utente"));
|
||||
else
|
||||
error_box(FR("Impossibile leggere i dati: errore %d"), err);
|
||||
if (!is_transaction())
|
||||
|
@ -289,12 +289,12 @@ HIDDEN bool _cf_val(TMask_field& f, KEY key)
|
||||
bool ok = true;
|
||||
|
||||
if (cf.empty()) return true;
|
||||
if (cf.len() == 11 && isdigit(cf[0]))
|
||||
if (isdigit(cf[0]) && cf.len() >= 11)
|
||||
{
|
||||
const TString& stato = get_fld_val_param(f, 0);
|
||||
if (stato.full() && stato != "IT")
|
||||
return true;
|
||||
ok = pi_check (stato, cf);
|
||||
ok = pi_check(stato, cf);
|
||||
}
|
||||
else
|
||||
ok = __cf_check(cf);
|
||||
@ -302,7 +302,7 @@ HIDDEN bool _cf_val(TMask_field& f, KEY key)
|
||||
{
|
||||
if(f.dirty())
|
||||
{
|
||||
ok = f.noyes_box(TR("Codice fiscale errato: si desidera accettarlo ugualmente?"));
|
||||
ok = f.yesno_box(TR("Codice fiscale errato: si desidera accettarlo ugualmente?"));
|
||||
if (ok) f.set_dirty(false);
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user