From cfe57d63b3b21dd69937ccb70fbf5590244ee00d Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 17 Apr 2009 14:13:47 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : ve1 Ricompilazione Demo : [ ] Commento : Corretta gestione MESSAGE _TABLEREAD sulle tabelle di modulo git-svn-id: svn://10.65.10.50/trunk@18729 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/recset.cpp | 19 +++++++++++++++---- include/relation.cpp | 25 +++++++++++++++++-------- include/relation.h | 5 ++++- include/report.cpp | 2 +- include/report.h | 1 - 5 files changed, 37 insertions(+), 15 deletions(-) diff --git a/include/recset.cpp b/include/recset.cpp index 16c35648d..0e827af22 100755 --- a/include/recset.cpp +++ b/include/recset.cpp @@ -1218,12 +1218,23 @@ TCursor_parser::TCursor_parser(istream& instr, TArray& col) if (table.ends_with(".DBF")) { TFilename dbf = table; - if (dbf.is_relative_path()) + if (table[0] == '$' || table[0] == '%') { - if (!dbf.custom_path()) + if (table[0] == '%') + dbf = firm2dir(0); + else + dbf = firm2dir(prefix().get_codditta()); + dbf.add(table.mid(1)); + } + else + { + if (dbf.is_relative_path()) { - dbf.tempdir(); - dbf.add(table); + if (!dbf.custom_path()) + { + dbf.tempdir(); + dbf.add(table); + } } } dbf.lower(); diff --git a/include/relation.cpp b/include/relation.cpp index 8ffc3fad5..0eedaa495 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -1999,7 +1999,6 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp) const char* TSorted_cursor::fill_sort_key(TString& k) { - TString16 fmt; TString sf; k.cut(0); for (TString80 s = _order_expr.get(0); s.not_empty(); s = _order_expr.get()) @@ -2012,17 +2011,27 @@ const char* TSorted_cursor::fill_sort_key(TString& k) const TFieldref f(s,0); sf = f.read(*relation()); const TRectype& frec = curr(f.file()); - const TFieldtypes fld_type = frec.type(f.name()); - if (fld_type == _datefld) // Se il campo e' di tipo data, la converte in ANSI! + TFieldtypes fld_type = frec.type(f.name()); + int fld_len = f.len(frec); + // Converte in ANSI i campi data ed i sottocampi con una data! + if (fld_type == _datefld || (f.is_subfield() && TDate::isdate(sf))) { - TDate d(sf); - sf=d.string(ANSI); + const TDate d(sf); + sf = d.string(ANSI); + fld_type = _datefld; + fld_len = 10; } - if (is_up) sf.upper(); + else + { + if (is_up) + sf.upper(); + } + + TString8 fmt; if (fld_type == _alfafld || fld_type == _datefld) - fmt.format("%%-%ds",f.len(frec)); + fmt.format("%%-%ds", fld_len); else - fmt.format("%%%ds",f.len(frec)); + fmt.format("%%%ds", fld_len); k << format(fmt, (const char*)sf); } return k; diff --git a/include/relation.h b/include/relation.h index 3ddea7b69..cd299505b 100755 --- a/include/relation.h +++ b/include/relation.h @@ -564,7 +564,10 @@ public: // @cmember Controlla la validita' dell'oggetto (TRUE se il numero del file e' valido) virtual bool ok() const - { return _name.not_empty(); } + { return _name.full(); } + + virtual bool is_subfield() const + { return _name.find(':') > 0; } // @cmember Ritorna il numero del file int file() const diff --git a/include/report.cpp b/include/report.cpp index cfa5225c5..8deff5204 100755 --- a/include/report.cpp +++ b/include/report.cpp @@ -2785,7 +2785,7 @@ void TReport::msg_table_read(TVariant_stack& stack) { const TString& t_code = stack.pop().as_string(); // prende il codice della tabella da leggere const int logicnum = table2logic(t_code); - if (logicnum == LF_TAB || logicnum == LF_TABCOM) + if (logicnum == LF_TAB || logicnum == LF_TABCOM || logicnum == LF_TABMOD) { const TString& codtab = stack.pop().as_string(); TVariant var; diff --git a/include/report.h b/include/report.h index 4f7f032b9..c81d20511 100755 --- a/include/report.h +++ b/include/report.h @@ -578,7 +578,6 @@ public: void report2mask(TMask & m) const; void mask2report(const TMask & m); - void destroy(); bool print_or_preview();