From 092247fdcfb391660d729dfed30810ad39f36930 Mon Sep 17 00:00:00 2001 From: mtollari Date: Wed, 28 Jun 2017 13:34:35 +0000 Subject: [PATCH] Patch level : 12.0 412 Files correlati : Commento : Modificata classe TAnagrafica: - Aggiunta funzione stato_residenzaISO() che ritorna il codice ISO 3166-1 alpha-2 - Modificata funzione stato_partita_IVA, adesso ritorna il codice ISO del suo paese se non trova nulla git-svn-id: svn://10.65.10.50/branches/R_10_00@23885 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- src/fe/felib.cpp | 23 +++++++++++++++++++---- src/fe/felib.h | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/fe/felib.cpp b/src/fe/felib.cpp index f80364eda..efc6f7513 100644 --- a/src/fe/felib.cpp +++ b/src/fe/felib.cpp @@ -192,6 +192,17 @@ const TString& TAnagrafica::provincia_residenza() const return provincia_di(_com_res); } +const TString& TAnagrafica::stato_residenzaISO() const +{ + if(italiano()) + return get_tmp_string() = "IT"; + else + { + TString4 u; u.format("%03d", _stato_estero); + return cache().get("%STA", u, "S10"); + } +} + void TAnagrafica::build_ind_res(const TRectype& rec, const char* ind, const char* civ) { _via_res = _ind_res = rec.get(ind); @@ -276,7 +287,7 @@ const TString& TAnagrafica::stato_estero_UNICO() const return EMPTY_STRING; TString4 u; u.format("%03d", _stato_estero); - const TString& cod = cache().get("%STA", u, "S8"); // S8=UNICO S9=ISTAT + const TString& cod = cache().get("%STA", u, "S8"); // S8=UNICO S9=ISTAT S10=ISO if (cod.len() == 3) return cod; return get_tmp_string() = u; @@ -284,10 +295,14 @@ const TString& TAnagrafica::stato_estero_UNICO() const const TString& TAnagrafica::stato_partita_IVA() const { + TString& str = get_tmp_string(); if (_stato_paiv.full()) - return _stato_paiv; - TString& str = get_tmp_string(); - if (italiano()) str = "IT"; + str = _stato_paiv; + else + { + // Propongo il codice iso del suo stato + str = stato_residenzaISO(); + } return str; } diff --git a/src/fe/felib.h b/src/fe/felib.h index 3efa9a75c..4c9f90396 100644 --- a/src/fe/felib.h +++ b/src/fe/felib.h @@ -57,6 +57,7 @@ public: const TString& codice_comune_residenza() const { return estero() ? EMPTY_STRING : _com_res; } const TString& comune_residenza() const; const TString& provincia_residenza() const; + const TString& stato_residenza() const; const TString& localita_residenza() const { return _loc_res; } const TString& indirizzo_residenza() const { return _ind_res; } const TString& via_residenza() const { return _via_res; }