Merge remote-tracking branch 'origin/R_10_00' into R_10_00
This commit is contained in:
commit
fc3af2e0d0
17
lib/.gitignore
vendored
Normal file
17
lib/.gitignore
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*.pdb
|
||||||
|
/*.exp
|
||||||
|
/*.bsc
|
||||||
|
/AgaLib.lib
|
||||||
|
/cb6.lib
|
||||||
|
/gfm.lib
|
||||||
|
/pdflib.lib
|
||||||
|
/vedoc.lib
|
||||||
|
/vedocext.lib
|
||||||
|
/xi.lib
|
||||||
|
/xvaga.lib
|
||||||
|
/xvapp.lib
|
||||||
|
/ServerLib.lib
|
||||||
|
/Uno.lib
|
||||||
|
/hlw32_mc.lib
|
||||||
|
/pdflibwrap.lib
|
||||||
|
/xid.lib
|
BIN
lib/AgaLib.lib
BIN
lib/AgaLib.lib
Binary file not shown.
Binary file not shown.
BIN
lib/Uno.lib
BIN
lib/Uno.lib
Binary file not shown.
BIN
lib/cb6.exp
BIN
lib/cb6.exp
Binary file not shown.
BIN
lib/cb6.lib
BIN
lib/cb6.lib
Binary file not shown.
BIN
lib/gfm.exp
BIN
lib/gfm.exp
Binary file not shown.
BIN
lib/gfm.lib
BIN
lib/gfm.lib
Binary file not shown.
BIN
lib/hlw32_mc.lib
BIN
lib/hlw32_mc.lib
Binary file not shown.
BIN
lib/pdflib.exp
BIN
lib/pdflib.exp
Binary file not shown.
BIN
lib/pdflib.lib
BIN
lib/pdflib.lib
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/vedoc.lib
BIN
lib/vedoc.lib
Binary file not shown.
BIN
lib/vedocext.lib
BIN
lib/vedocext.lib
Binary file not shown.
BIN
lib/xi.bsc
BIN
lib/xi.bsc
Binary file not shown.
BIN
lib/xi.exp
BIN
lib/xi.exp
Binary file not shown.
BIN
lib/xi.lib
BIN
lib/xi.lib
Binary file not shown.
BIN
lib/xid.exp
BIN
lib/xid.exp
Binary file not shown.
BIN
lib/xid.lib
BIN
lib/xid.lib
Binary file not shown.
BIN
lib/xvaga.bsc
BIN
lib/xvaga.bsc
Binary file not shown.
BIN
lib/xvaga.exp
BIN
lib/xvaga.exp
Binary file not shown.
BIN
lib/xvaga.lib
BIN
lib/xvaga.lib
Binary file not shown.
BIN
lib/xvapp.lib
BIN
lib/xvapp.lib
Binary file not shown.
@ -743,14 +743,13 @@ bool TDoc2Paf::create()
|
|||||||
{
|
{
|
||||||
open_files(LF_TAB, LF_TABCOM, LF_TABMOD, LF_ANAG,
|
open_files(LF_TAB, LF_TABCOM, LF_TABMOD, LF_ANAG,
|
||||||
LF_CLIFO, LF_CFVEN, LF_CFBAN, LF_NDITTE,
|
LF_CLIFO, LF_CFVEN, LF_CFBAN, LF_NDITTE,
|
||||||
LF_DOC, LF_RIGHEDOC, 0);
|
LF_DOC, LF_RIGHEDOC, LF_CODCORR, LF_ANAMAG, 0);
|
||||||
|
|
||||||
TRectype cfven(LF_CFVEN);
|
const TRectype cfven(LF_CFVEN);
|
||||||
if (cfven.length(CFV_PADESTIN) != 7) // Nuova lunghezza per privati
|
if (cfven.length(CFV_PADESTIN) != 7) // Nuova lunghezza per privati
|
||||||
return error_box(TR("Database non convertito per fatturazione F.P."));
|
return error_box(TR("Database non convertito per fatturazione F.P."));
|
||||||
|
|
||||||
return check_tables() && TSkeleton_application::create();
|
return check_tables() && TSkeleton_application::create();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TDoc2Paf::destroy()
|
bool TDoc2Paf::destroy()
|
||||||
|
@ -389,7 +389,8 @@ private:
|
|||||||
enum TFP_operator { error, eq, neq, gt, ls, gteq, lseq, and, or };
|
enum TFP_operator { error, eq, neq, gt, ls, gteq, lseq, and, or };
|
||||||
|
|
||||||
// Etrattori
|
// Etrattori
|
||||||
static void extract_info(const TString& expr, TString& tabella, TString& campo, TToken_string* search);
|
static void extract_info(const TString& expr, TString& tabella, TString& campo);
|
||||||
|
static void extract_info(const TString& expr, TString& tabella, TString& campo, TToken_string& search, int& key);
|
||||||
static bool calc_table(const TString& tabella, int& file);
|
static bool calc_table(const TString& tabella, int& file);
|
||||||
static void split_condition(const TString& cond, TString& cond_sx, TString& cond_dx, TFP_operator& symb);
|
static void split_condition(const TString& cond, TString& cond_sx, TString& cond_dx, TFP_operator& symb);
|
||||||
static TVariant& get_value(const TRectype& rec, const TString& campo);
|
static TVariant& get_value(const TRectype& rec, const TString& campo);
|
||||||
|
@ -51,6 +51,7 @@ bool set_connection(SSimple_query& s)
|
|||||||
#endif
|
#endif
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSimple_query& fp_db()
|
SSimple_query& fp_db()
|
||||||
{
|
{
|
||||||
static SSimple_query* db = nullptr;
|
static SSimple_query* db = nullptr;
|
||||||
@ -63,6 +64,7 @@ SSimple_query& fp_db()
|
|||||||
}
|
}
|
||||||
return *db;
|
return *db;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool run_fp_psw_mask()
|
bool run_fp_psw_mask()
|
||||||
{
|
{
|
||||||
static TMask* m;
|
static TMask* m;
|
||||||
|
@ -255,8 +255,6 @@ TFP_custom_cache::TFP_custom_cache()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TFP_expression
|
* TFP_expression
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
@ -364,7 +362,7 @@ bool TFP_expression::check_condition(const TString& cond, TRiga_documento& rdoc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFP_expression::extract_info(const TString& expr, TString& tabella, TString& campo, TToken_string* search)
|
void TFP_expression::extract_info(const TString& expr, TString& tabella, TString& campo)
|
||||||
{
|
{
|
||||||
// Prendo la stringa pulita della parte sinistra
|
// Prendo la stringa pulita della parte sinistra
|
||||||
TString clean_expr = expr.mid(expr.find('(') + 1);
|
TString clean_expr = expr.mid(expr.find('(') + 1);
|
||||||
@ -377,13 +375,38 @@ void TFP_expression::extract_info(const TString& expr, TString& tabella, TString
|
|||||||
// Trimmare sempre come se non sapessi fare altro nella vita
|
// Trimmare sempre come se non sapessi fare altro nella vita
|
||||||
tabella.cut(0) << info.remove(0); tabella.trim();
|
tabella.cut(0) << info.remove(0); tabella.trim();
|
||||||
campo.cut(0) << info.remove(0); campo.trim();
|
campo.cut(0) << info.remove(0); campo.trim();
|
||||||
if (search != nullptr)
|
|
||||||
{
|
|
||||||
// Prendo il resto
|
|
||||||
search->cut(0) << info;
|
|
||||||
search->trim();
|
|
||||||
search->restart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TFP_expression::extract_info(const TString& expr, TString& tabella, TString& campo, TToken_string& search, int& key)
|
||||||
|
{
|
||||||
|
// Prendo la stringa pulita della parte sinistra
|
||||||
|
TString clean_expr = expr.mid(expr.find('(') + 1);
|
||||||
|
// Tolgo eventuali spazi ai lati
|
||||||
|
clean_expr.trim();
|
||||||
|
// Tolgo la virgola finale
|
||||||
|
clean_expr.rtrim(1);
|
||||||
|
TToken_string info(clean_expr, ',');
|
||||||
|
|
||||||
|
// Trimmare sempre come se non sapessi fare altro nella vita
|
||||||
|
tabella.cut(0) << info.remove(0); tabella.trim();
|
||||||
|
if(tabella.contains('.'))
|
||||||
|
{
|
||||||
|
TToken_string app(tabella, '.');
|
||||||
|
tabella = app.get();
|
||||||
|
key = atoi(app.get());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
key = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
campo.cut(0) << info.remove(0); campo.trim();
|
||||||
|
|
||||||
|
// Prendo il resto e lo devolvo nella ricerca
|
||||||
|
search.cut(0) << info;
|
||||||
|
search.trim();
|
||||||
|
search.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TFP_expression::calc_table(const TString& tabella, int& file)
|
bool TFP_expression::calc_table(const TString& tabella, int& file)
|
||||||
@ -549,17 +572,26 @@ TVariant& TFP_expression::parse_var(const TString& str)
|
|||||||
TVariant& TFP_expression::parse_read(const TString& str, TRiga_documento& rdoc)
|
TVariant& TFP_expression::parse_read(const TString& str, TRiga_documento& rdoc)
|
||||||
{
|
{
|
||||||
TString tabella, campo;
|
TString tabella, campo;
|
||||||
extract_info(str, tabella, campo, nullptr);
|
extract_info(str, tabella, campo);
|
||||||
return do_read(tabella, campo, rdoc);
|
return do_read(tabella, campo, rdoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
TVariant& TFP_expression::do_read(const TString& tabella, const TString& campo, TRiga_documento& rdoc)
|
TVariant& TFP_expression::do_read(const TString& tabella, const TString& campo, TRiga_documento& rdoc)
|
||||||
{
|
{
|
||||||
|
const TDocumento& doc = rdoc.doc();
|
||||||
// Prima di tutto controllo se è una delle tabelle multitracciato che supporto
|
// Prima di tutto controllo se è una delle tabelle multitracciato che supporto
|
||||||
if(tabella == "%TIP")
|
if(tabella == "%TIP")
|
||||||
{
|
{
|
||||||
return get_value(rdoc.doc().tipo(), campo);
|
return get_value(doc.tipo(), campo);
|
||||||
|
}
|
||||||
|
if(tabella == "%NUM")
|
||||||
|
{
|
||||||
|
return get_value(doc.codice_numerazione(), campo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tabella == "%CPG")
|
||||||
|
{
|
||||||
|
return get_value(cache().get("%CPG", doc.get(DOC_CODPAG)), campo);
|
||||||
}
|
}
|
||||||
|
|
||||||
int file;
|
int file;
|
||||||
@ -568,17 +600,19 @@ TVariant& TFP_expression::do_read(const TString& tabella, const TString& campo,
|
|||||||
switch (file)
|
switch (file)
|
||||||
{
|
{
|
||||||
case LF_DOC:
|
case LF_DOC:
|
||||||
return get_value(rdoc.doc(), campo);
|
return get_value(doc, campo);
|
||||||
case LF_RIGHEDOC:
|
case LF_RIGHEDOC:
|
||||||
return get_value(rdoc, campo);
|
return get_value(rdoc, campo);
|
||||||
case LF_CLIFO:
|
case LF_CLIFO:
|
||||||
return get_value(rdoc.doc().clifor(), campo);
|
return get_value(doc.clifor(), campo);
|
||||||
case LF_CFVEN:
|
case LF_CFVEN:
|
||||||
return get_value(rdoc.doc().clifor().vendite(), campo);
|
return get_value(doc.clifor().vendite(), campo);
|
||||||
case LF_LETINT:
|
case LF_LETINT:
|
||||||
return get_value(rdoc.doc().clifor().lettera(), campo);
|
return get_value(doc.clifor().lettera(), campo);
|
||||||
case LF_ANAMAG:
|
case LF_ANAMAG:
|
||||||
return get_value(rdoc.articolo(), campo);
|
return get_value(rdoc.articolo(), campo);
|
||||||
|
case LF_CODCORR:
|
||||||
|
return get_value(cache().get(LF_CODCORR, rdoc.articolo().codice()), campo);
|
||||||
default:
|
default:
|
||||||
static TVariant null_var(EMPTY_STRING);
|
static TVariant null_var(EMPTY_STRING);
|
||||||
return null_var;
|
return null_var;
|
||||||
@ -588,10 +622,10 @@ TVariant& TFP_expression::do_read(const TString& tabella, const TString& campo,
|
|||||||
TVariant& TFP_expression::parse_search(const TString& str, TRiga_documento& rdoc)
|
TVariant& TFP_expression::parse_search(const TString& str, TRiga_documento& rdoc)
|
||||||
{
|
{
|
||||||
TString tabella, campo;
|
TString tabella, campo;
|
||||||
TToken_string input_search, search;
|
TToken_string input_search("", ';'), search;
|
||||||
int file;
|
int file, key;
|
||||||
|
|
||||||
extract_info(str, tabella, campo, &input_search);
|
extract_info(str, tabella, campo, input_search, key);
|
||||||
const bool multi_table = calc_table(tabella, file);
|
const bool multi_table = calc_table(tabella, file);
|
||||||
|
|
||||||
// Parso ogni singolo token della ricerca
|
// Parso ogni singolo token della ricerca
|
||||||
@ -602,10 +636,10 @@ TVariant& TFP_expression::parse_search(const TString& str, TRiga_documento& rdoc
|
|||||||
|
|
||||||
if (multi_table)
|
if (multi_table)
|
||||||
{
|
{
|
||||||
return get_value(cache().get(tabella, search), campo);
|
return get_value(cache().get(tabella, search, key), campo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return get_value(cache().get(file, search), campo);
|
return get_value(cache().get(file, search, key), campo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -957,13 +957,42 @@ int TDB_cache::build_table_key(const char* table, const char* key, TToken_string
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TRectype& TDB_cache::get(const char* table, const char* key)
|
const TRectype& TDB_cache::get(const int file, const char* key_tok, const int key)
|
||||||
|
{
|
||||||
|
// Prendo la vecchia chiave
|
||||||
|
const int old_key = rec_cache(file).key_number();
|
||||||
|
// Setto la nuova chiave
|
||||||
|
rec_cache(file).set_key(key);
|
||||||
|
// Poi chiamo la get normale
|
||||||
|
const TRectype& app = get(file, key_tok);
|
||||||
|
// Ripristino la vecchia chiave per mantenere la compatibilità con i metodi vecchi
|
||||||
|
// non vorrei rischiare che altre applicazioni si basano sulla chiave vecchia
|
||||||
|
rec_cache(file).set_key(old_key);
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TRectype& TDB_cache::get(const char* table, const char* key_tok)
|
||||||
{
|
{
|
||||||
TToken_string tabkey;
|
TToken_string tabkey;
|
||||||
const int file = build_table_key(table, key, tabkey);
|
const int file = build_table_key(table, key_tok, tabkey);
|
||||||
return rec_cache(table).get(tabkey);
|
return rec_cache(table).get(tabkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TRectype& TDB_cache::get(const char* table, const char* key_tok, const int key)
|
||||||
|
{
|
||||||
|
TToken_string tabkey;
|
||||||
|
const int file = build_table_key(table, key_tok, tabkey);
|
||||||
|
|
||||||
|
// Per il giro della vecchia chiave guardare get(const int, const char*, const int)
|
||||||
|
const int old_key = rec_cache(file).key_number();
|
||||||
|
rec_cache(table).set_key(key);
|
||||||
|
const TRectype& app = rec_cache(table).get(tabkey);
|
||||||
|
|
||||||
|
rec_cache(file).set_key(old_key);
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const TRectype& TDB_cache::get(const TRectype& curr)
|
const TRectype& TDB_cache::get(const TRectype& curr)
|
||||||
{
|
{
|
||||||
const int num = curr.num(); // Numero logico del file (o tabella)
|
const int num = curr.num(); // Numero logico del file (o tabella)
|
||||||
|
@ -184,6 +184,7 @@ public:
|
|||||||
int io_result();
|
int io_result();
|
||||||
const int key_number() const
|
const int key_number() const
|
||||||
{ return _key; }
|
{ return _key; }
|
||||||
|
void set_key(const int key) { _key = key; }
|
||||||
|
|
||||||
bool already_loaded(const char* code) const;
|
bool already_loaded(const char* code) const;
|
||||||
bool already_loaded(long code) const;
|
bool already_loaded(long code) const;
|
||||||
@ -263,9 +264,11 @@ public:
|
|||||||
void flush(int file) { rec_cache(file).flush(); }
|
void flush(int file) { rec_cache(file).flush(); }
|
||||||
void discard(int file);
|
void discard(int file);
|
||||||
|
|
||||||
|
const TRectype& get(int file, const char* key_tok, const int key);
|
||||||
const TRectype& get(int file, const char* key_tok) { return rec_cache(file).get(key_tok); }
|
const TRectype& get(int file, const char* key_tok) { return rec_cache(file).get(key_tok); }
|
||||||
const TRectype& get(int file, long key) { return rec_cache(file).get(key); }
|
const TRectype& get(int file, long key) { return rec_cache(file).get(key); }
|
||||||
const TRectype& get(const char* table, const char* key_tok);
|
const TRectype& get(const char* table, const char* key_tok);
|
||||||
|
const TRectype& get(const char* table, const char* key_tok, const int key);
|
||||||
const TRectype& get(const TRectype& key);
|
const TRectype& get(const TRectype& key);
|
||||||
const TRectype& get_rec(int file, char c, long n);
|
const TRectype& get_rec(int file, char c, long n);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user