From 474c58121587e1fa477aa4a0a7da943e6abf0735 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 12 Sep 2008 11:52:57 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : *.exe Ricompilazione Demo : [ ] Commento : Potenziata gestione tabelle di modulo in modo da poter utilizzate in moduli diversi da quello di stretta appartenenza git-svn-id: svn://10.65.10.50/trunk@17234 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/recarray.cpp | 14 ++++++++++---- include/tabmod.cpp | 36 +++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/include/recarray.cpp b/include/recarray.cpp index 95ea62b02..42355f19c 100755 --- a/include/recarray.cpp +++ b/include/recarray.cpp @@ -603,8 +603,7 @@ const TObject& TFile_cache::query(const char* code) { const RecDes* recd = curr.rec_des(); // Descrizione del record della testata const KeyDes& kd = recd->Ky[_key-1]; // Elenco dei campi della chiave - const int fi = f.tab() ? 1 : (f.num() == LF_TABMOD ? 2 : 0); - for (int i = fi; 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]; @@ -796,19 +795,26 @@ TRecord_cache& TDB_cache::rec_cache(int file) int TDB_cache::build_table_key(const char* table, const char* key, TToken_string& k) const { int file = LF_TAB; + k.cut(0); if (!isalnum(*table)) // gestisco i casi come %IVA e &AUT { switch (*table) { case '%': file = LF_TABCOM; break; case '^': file = LF_TABGEN; break; - case '&': file = LF_TABMOD; break; + case '&': file = LF_TABMOD; + { + const TModule_table mt(table); + k = mt.module(); + k.add(mt.customer()); + } + break; case '$': default : file = LF_TAB; break; } table++; // Skippa il primo carattere speciale } - k = table; + k.add(table); k.add(key); return file; } diff --git a/include/tabmod.cpp b/include/tabmod.cpp index 2ef7d72a9..6a96b041a 100755 --- a/include/tabmod.cpp +++ b/include/tabmod.cpp @@ -6,27 +6,41 @@ TModule_table::TModule_table(const char* tabname, const char* module, long custo : TLocalisamfile(LF_TABMOD), _tabname(tabname), _module(module), _customer(customer) { - TFilename app = main_app().argv(0); app.ext(""); - const TFixed_string appname(app.name()); - - if (_module.blank()) - _module = appname.left(2); - _module.upper(); - - if (!isalpha(_tabname[0])) // Toglie eventuali prefissi inutili d'ora in poi + if (!isalnum(_tabname[0])) // Toglie eventuali prefissi inutili d'ora in poi _tabname.ltrim(1); _tabname.upper(); - if (_customer <= 0L && real::is_natural(appname.mid(3))) - _customer = atol(app.mid(2)); + if (_tabname.len() >= 5) + { + _module = _tabname.left(2); + _tabname.ltrim(2); + if (_tabname.len() > 3) + { + _customer = atol(_tabname); + _tabname = _tabname.right(3); + } + } + + if (_module.blank() || _customer <= 0L) + { + TFilename app = main_app().argv(0); app.ext(""); + const TFixed_string appname(app.name()); + + if (_module.blank()) + _module = appname.left(2); + + if (_customer <= 0L && real::is_natural(appname.mid(3))) + _customer = atol(app.mid(2)); + } + _module.upper(); } void TModule_table::zero_rec(TRectype& rec, char c) { rec.zero(c); - rec.put("COD", _tabname); rec.put("MOD", _module); rec.put("CUST", _customer); + rec.put("COD", _tabname); } // @cmember Vuota tutto il record