diff --git a/cg/conto.cpp b/cg/conto.cpp index 6224cb003..ee66e0f69 100755 --- a/cg/conto.cpp +++ b/cg/conto.cpp @@ -106,11 +106,9 @@ int TBill::compare(const TSortable& s) const // Certified 95% -const char* TBill::describe() +void TBill::describe() { int err = NOERR; - const char* desc = NULL; - TFixed_string ragsoc(&__tmp_string[256], 50); if ((_tipo != 'C' && _tipo != 'F') || _sottoconto == 0L) { @@ -124,7 +122,7 @@ const char* TBill::describe() if (err == NOERR) { _tipo_cr = pcon.get_int("TIPOSPRIC"); - desc = pcon.get("DESCR"); + _descrizione = pcon.get("DESCR"); } } if ((_tipo == 'C' || _tipo == 'F') && _sottoconto != 0L) @@ -137,24 +135,16 @@ const char* TBill::describe() err = clifo.read(); if (err == NOERR) { - char tipoa = clifo.get_char("TIPOAPER"); - + _descrizione = clifo.get("RAGSOC"); + const char tipoa = clifo.get_char("TIPOAPER"); if (tipoa == 'F') { - TString80 cognome, nome; - ragsoc = clifo.get("RAGSOC"); - cognome = ragsoc.mid(0,30); - nome = ragsoc.mid(30,20); - cognome.trim(); nome.trim(); - - ragsoc = cognome; - ragsoc << " " << nome; - - desc = ragsoc; + TString80 nome = _descrizione.mid(30); + _descrizione.cut(30); + _descrizione.trim(); nome.trim(); + _descrizione << ' ' << nome; } - else - desc = clifo.get("RAGSOC"); - if (_conto == 0) + if (_gruppo == 0 || _conto == 0) { _gruppo = clifo.get_int("GRUPPO"); _conto = clifo.get_int("CONTO"); @@ -163,8 +153,6 @@ const char* TBill::describe() _tipo_cr = 0; } } - - return desc; } @@ -208,15 +196,13 @@ int TBill::tipo_att() return tipo_att; } -// Certified 99% (describe uses __tmp_string) +// Certified 99% const TString& TBill::descrizione() { if (_descrizione.empty()) { - const char* d = describe(); - if (d) - _descrizione = *d ? d : " "; - else + describe(); + if (_descrizione.empty()) _descrizione = "Sconosciuto"; } return _descrizione; @@ -225,10 +211,7 @@ const TString& TBill::descrizione() int TBill::tipo_cr() { if (_tipo_cr < 0) - { - _descrizione = ""; - descrizione(); - } + describe(); return _tipo_cr; }