diff --git a/include/report.cpp b/include/report.cpp index e8459f6da..67fca8db9 100755 --- a/include/report.cpp +++ b/include/report.cpp @@ -1967,7 +1967,11 @@ TReport_field::~TReport_field() /////////////////////////////////////////////////////////// void TReport::build_section_key(char type, int level, TString& key) const -{ key.format("%c%d", type, level); } +{ + CHECK(strchr("BHF", type), "Invalid section type"); + CHECKD(level >= 0 && level <= 999999, "Invalid section level ", level); + key.format("%c%d", type, level); +} TReport_section* TReport::find_section(char type, int level) const { @@ -2422,44 +2426,45 @@ bool TReport::execute_dot(const TVariant& var) return TAlex_virtual_machine::execute_dot(var); } +bool TReport::compile_prescript() +{ + bool ok = false; + warm_restart(); + if (_prescript.ok()) + ok = _prescript.compile(*this); + return ok; +} + bool TReport::execute_prescript() { bool ok = true; + if (compile_prescript()) + ok = _prescript.execute(*this); - warm_restart(); - if (_prescript.ok()) - { - ok = _prescript.execute(*this); - if (recordset() != NULL) - recordset()->ask_variables(false); - } - else - { - bool bAsk = true; - - // Script dei poveri: lancia la maschera associata al report - if (use_mask()) - { - TFilename msk = _path.name(); msk.ext("msk"); - if (msk.custom_path()) + bool bAsk = ok; + + // Script dei poveri: lancia la maschera associata al report + if (bAsk && use_mask()) + { + TFilename msk = _path.name(); msk.ext("msk"); + if (msk.custom_path()) + { + TFilename ini = msk; ini.ext("ini"); + // Attenzione: se esiste il .ini allora e' una maschera delle vendite! + if (!ini.exist()) { - TFilename ini = msk; ini.ext("ini"); - // Attenzione: se esiste il .ini allora e' una maschera delle vendite! - if (!ini.exist()) - { - bAsk = false; // Non richiedere variabili - const KEY key = run_form(msk.name()); - ok = key != K_ESC && key != K_QUIT; - } + bAsk = false; // Non richiedere variabili + const KEY key = run_form(msk.name()); + ok = key != K_ESC && key != K_QUIT; } } + } - if (bAsk) - { - // Script dei poverissimi: chiede le eventuali variabili - if (recordset() != NULL) - recordset()->ask_variables(false); - } + if (bAsk) + { + // Script dei poverissimi: chiede le eventuali variabili + if (recordset() != NULL) + recordset()->ask_variables(false); } return ok; diff --git a/include/report.h b/include/report.h index 822ab37b6..f7d73e5f3 100755 --- a/include/report.h +++ b/include/report.h @@ -619,7 +619,9 @@ public: void set_prescript(const char* src); const TString& postscript() const; void set_postscript(const char* src); + virtual bool execute_dot(const TVariant& var); + virtual bool compile_prescript(); virtual bool execute_prescript(); virtual bool execute_postscript();