Patch level : 10.0
Files correlati : cg6.exe cg0.exe Ricompilazione Demo : [ ] Commento : Potenziato controllo partita IVA CEE per intra git-svn-id: svn://10.65.10.50/trunk@20285 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3abe3896c1
commit
90e78afb05
@ -807,14 +807,10 @@ const TRectype& TRecord_cache::get(long key)
|
||||
}
|
||||
|
||||
const TString& TRecord_cache::get(const char* key, const char* field)
|
||||
{
|
||||
return get(key).get(field);
|
||||
}
|
||||
{ return get(key).get(field); }
|
||||
|
||||
const TString& TRecord_cache::get(long key, const char* field)
|
||||
{
|
||||
return get(key).get(field);
|
||||
}
|
||||
{ return get(key).get(field); }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TDB_cache
|
||||
@ -889,6 +885,33 @@ const TRectype& TDB_cache::get(const TRectype& curr)
|
||||
return get(num, key);
|
||||
}
|
||||
|
||||
const TString& TDB_cache::get(int file, const char* key_tok, const char * campo)
|
||||
{ return get(file, key_tok).get(campo); }
|
||||
|
||||
const TString& TDB_cache::get(int file, long key, const char * campo)
|
||||
{ return get(file, key).get(campo); }
|
||||
|
||||
const TString& TDB_cache::get(const char* table, const char* key_tok, const char * campo)
|
||||
{ return get(table, key_tok).get(campo); }
|
||||
|
||||
const TRectype& TDB_cache::get_rec(int file, const char* key1, const char* key2, const char* key3, const char* key4)
|
||||
{
|
||||
TToken_string tok;
|
||||
if (key1 && *key1)
|
||||
tok= key1;
|
||||
if (key2)
|
||||
{
|
||||
tok.add(key2,1);
|
||||
if (key3)
|
||||
{
|
||||
tok.add(key3);
|
||||
if (key4)
|
||||
tok.add(key4);
|
||||
}
|
||||
}
|
||||
return get(file, tok);
|
||||
}
|
||||
|
||||
bool TDB_cache::discard(int file, const char* key)
|
||||
{
|
||||
return rec_cache(file).discard(key);
|
||||
|
@ -255,19 +255,17 @@ public:
|
||||
void flush(int file) { rec_cache(file).flush(); }
|
||||
void discard(int file);
|
||||
|
||||
const TRectype& get(int file, const char* 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);
|
||||
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(const char* table, const char* key_tok);
|
||||
const TRectype& get(const TRectype& key);
|
||||
|
||||
// Smarter get: no token string key needed
|
||||
const TRectype& get_rec(int file, const char* key1, const char* key2=NULL, const char* key3=NULL, const char* key4=NULL);
|
||||
|
||||
const TString& get(int file, const char* key, const char * campo)
|
||||
{ return get(file, key).get(campo); }
|
||||
const TString& get(int file, long key, const char * campo)
|
||||
{ return get(file, key).get(campo); }
|
||||
const TString& get(const char* table, const char* key, const char * campo)
|
||||
{ return get(table, key).get(campo); }
|
||||
const TString& get(int file, const char* key_tok, const char * campo);
|
||||
const TString& get(int file, long key, const char * campo);
|
||||
const TString& get(const char* table, const char* key_tok, const char* campo);
|
||||
|
||||
void test_file_changes(int file, bool t = TRUE)
|
||||
{ rec_cache(file).test_file_changes(t); }
|
||||
|
@ -71,9 +71,10 @@ HIDDEN bool _emptycopy_val(TMask_field& f, KEY)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool check_pi_estera(const TString& st, const TString& paiva)
|
||||
HIDDEN bool check_pi_estera(const TString& st, const TString& paiva)
|
||||
{
|
||||
const char* stpi[] = { "AT09", "BE09", "DE09", "DK08", "EL08", "ES09",
|
||||
/*
|
||||
const char* stpi[] = { "AT09", "BE10", "DE09", "DK08", "EL08", "ES09",
|
||||
"FI08", "FR11", "GB05", "GB09", "GB12", "IE08",
|
||||
"LU08", "NL12", "PT09", "SE12", "SM05", NULL };
|
||||
bool lenok = false;
|
||||
@ -94,12 +95,63 @@ bool check_pi_estera(const TString& st, const TString& paiva)
|
||||
}
|
||||
if (known)
|
||||
{
|
||||
if (st=="AT") // Controllo speciale per l'Austria che comincia per U
|
||||
lenok &= (paiva[0] == 'U');
|
||||
if (lenok)
|
||||
{
|
||||
if (st=="AT") // Controllo speciale per l'Austria che comincia per U
|
||||
lenok = paiva[0] == 'U' && real::is_natural(paiva.mid(1)); else
|
||||
if (st=="BE") // Controllo speciale per il Belgio che comincia per 0
|
||||
lenok = paiva[0] == '0' && real::is_natural(paiva); else
|
||||
if (st=="NL") // Controllo speciale per l'Olanda che ha una B in posizione 10
|
||||
lenok = paiva[9] == 'B' && real::is_natural(paiva.left(9));
|
||||
}
|
||||
}
|
||||
else
|
||||
lenok = true; // Gli stati ignoti hanno sempre lunghezza corretta!
|
||||
return lenok;
|
||||
*/
|
||||
const int len = paiva.len();
|
||||
const char* p = paiva;
|
||||
const bool nat = real::is_natural(p);
|
||||
|
||||
if (st == "AT")
|
||||
return len == 9 && p[0] =='U' && real::is_natural(p+1);
|
||||
if (st == "BE")
|
||||
return len == 10 && p[0] =='0' && nat;
|
||||
if (st == "DE")
|
||||
return len == 9 && nat;
|
||||
if (st == "DK")
|
||||
return len == 8 && nat;
|
||||
if (st == "EL")
|
||||
return len == 9 && nat;
|
||||
if (st == "ES")
|
||||
return len == 9 && !(isdigit(p[0] && isdigit(p[8])) && real::is_natural(paiva.mid(1,7)));
|
||||
if (st == "IT")
|
||||
return len == 11 && nat; // Ridondante ma documentante
|
||||
if (st == "HU")
|
||||
return len == 8 && nat;
|
||||
if (st == "FI")
|
||||
return len == 8 && nat;
|
||||
if (st == "FR")
|
||||
return len == 11 && real::is_natural(p+2);
|
||||
if (st == "GB")
|
||||
return (len == 5 && real::is_natural(p+2)) || ((len == 9 || len == 12) && nat);
|
||||
if (st == "IE")
|
||||
return len == 8;
|
||||
if (st == "LU")
|
||||
return len == 8 && nat;
|
||||
if (st == "NL")
|
||||
return len == 12 && paiva[9] == 'B' && real::is_natural(paiva.left(9));
|
||||
if (st == "PL")
|
||||
return len == 10 && nat;
|
||||
if (st == "PT")
|
||||
return len == 9 && nat;
|
||||
if (st == "RO")
|
||||
return len >= 2 && len <= 10 && nat;
|
||||
if (st == "SE")
|
||||
return len == 12 && nat;
|
||||
if (st == "SM")
|
||||
return len == 5;
|
||||
return paiva.full(); // Gli stati ignoti hanno sempre lunghezza corretta!
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
Loading…
x
Reference in New Issue
Block a user