diff --git a/src/cg/cg2100.cpp b/src/cg/cg2100.cpp index 93be54af9..4f37f8059 100755 --- a/src/cg/cg2100.cpp +++ b/src/cg/cg2100.cpp @@ -910,8 +910,9 @@ void TPrimanota_application::init_insert_mode(TMask& m) TRegistro& reg = causale().reg(); const TString4 codreg = reg.name(); const int regyear = reg.year(); - TRegistro r(codreg, regyear); - const long protiva = r.protocol() + 1; + + reg.force_read(codreg, regyear); + const long protiva = reg.protocol() + 1; m.set(F_PROTIVA, protiva, true); // Aggiorna protocollo IVA } diff --git a/src/cg/cglib01.cpp b/src/cg/cglib01.cpp index b360445aa..4bc5e8061 100755 --- a/src/cg/cglib01.cpp +++ b/src/cg/cglib01.cpp @@ -417,6 +417,14 @@ bool TRegistro::read(const char* cod, int year) return !_rec.empty(); } +bool TRegistro::force_read(const char* cod, int year) +{ + TString8 chiave; chiave.format("%04d%s", year, cod); + + cache().discard("REG", chiave); + return read(cod, year); +} + bool TRegistro::reread() { if (ok()) diff --git a/src/cg/cglib01.h b/src/cg/cglib01.h index 9cebb5e99..ce4eb3996 100755 --- a/src/cg/cglib01.h +++ b/src/cg/cglib01.h @@ -93,6 +93,7 @@ protected: public: bool read(const char* code, int year); + bool force_read(const char* code, int year); bool reread(); TRegistro& operator =(const TRegistro& r);