diff --git a/lv/lv4500.cpp b/lv/lv4500.cpp index 9b567235a..889def4ff 100755 --- a/lv/lv4500.cpp +++ b/lv/lv4500.cpp @@ -67,11 +67,14 @@ TLaundry_recordset::TLaundry_recordset(const int rec_lenght) class TConti_cache : public TCache { TLog_report * _log; + bool _errors; + protected: virtual TObject* key2obj(const char* key); public: + const bool errors() const { return _errors; } const TBill& decodifica_conti(const long mastro, const long conto); - TConti_cache(TLog_report * log) : _log(log) {} + TConti_cache(TLog_report * log) : _log(log), _errors(false) {} }; //KEY2OBJ: ridefinisco il metodo virtuale key2obj in modo che mi restituisca quello di cui ho bisogno @@ -88,6 +91,7 @@ TObject* TConti_cache::key2obj(const char* key) mastro = mastro.left(6); _log->log(2, format(FR("Mastro %6s Conto %6s assente"), (const char *) mastro, (const char *) conto)); + _errors = true; return new TBill; } @@ -111,6 +115,7 @@ class TDecodifica_codici : public TObject TAssoc_array _tab; TConti_cache _conti; TLog_report * _log; + bool _errors; protected: void riempi_array(); @@ -123,6 +128,7 @@ public: const TString& decodifica_regiva(const int regiva_cog); const TString& decodifica_valute(const int val_cog); const TBill& decodifica_conto(const long mastro, const long conto); + const bool errors() const { return _errors || _conti.errors(); } TDecodifica_codici(TLog_report * log); }; @@ -175,6 +181,7 @@ const TString& TDecodifica_codici::decodifica(const char* tabella, const int cod return *data; } _log->log(2, format(FR("Tabella %s codice %ld assente"), tabella, codice)); + _errors = true; return EMPTY_STRING; } @@ -215,7 +222,7 @@ const TBill& TDecodifica_codici::decodifica_conto(const long mastro, const long } //costruttore -TDecodifica_codici::TDecodifica_codici(TLog_report * log) : _log(log), _conti(log) +TDecodifica_codici::TDecodifica_codici(TLog_report * log) : _log(log), _conti(log), _errors(false) {} //////////////////////////////// @@ -596,7 +603,11 @@ void TImporta_fat_app::transfer(const TFilename& file) book.add(*_log); book.print_or_preview(); _log->reset(); - elabora_file(tmpdir); + bool ok = true; + if (_codici->errors()) + ok = yesno_box("Sono stati rilevati errori, si desidera proseguire con l'importazione"); + if (ok) + elabora_file(tmpdir); } bool TImporta_fat_app::create()