From 6eccb7926981aa6bc0edb83eb6c54b0333d0647f Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Mon, 14 Mar 2022 09:03:39 +0100 Subject: [PATCH] Patch level : 12.0 1122 Files correlati : ca3.exe ca3100.msk ca3200.msk ca3300.msk ca3600.msk ca3700.msk ca3700b.rep ca3800.msk ca3900.msk Commento : Ripristinata l'esportazione sintetica del rendiconto corretta la selezione dei report era possibile selezionare un report non compatibile --- src/include/bprintbar.h | 18 ++++++++---------- src/include/brwbut.cpp | 28 +++++++++++++++++++++++----- src/include/repapp.cpp | 30 +++++++++++++++++++----------- src/include/repapp.h | 7 +++++-- src/include/report.h | 2 +- 5 files changed, 56 insertions(+), 29 deletions(-) diff --git a/src/include/bprintbar.h b/src/include/bprintbar.h index 706c63a72..1c0ea2ff0 100644 --- a/src/include/bprintbar.h +++ b/src/include/bprintbar.h @@ -1,26 +1,24 @@ #if defined(EXPORT) || defined(EXPORT_EXCEL) || defined(EXPORT_PDF) || defined(EXPORT_DBF) || defined(EXPORT_TEXT) || defined(ALL_EXPORT) STRING DLG_OUTPUTD 255 50 BEGIN -PROMPT 1 -3 "Output " -DSELECT + PROMPT 1 -3 "Output " + DSELECT END STRING DLG_OUTPUTF 60 18 BEGIN -PROMPT 62 -3 "\" + PROMPT 62 -3 "\" END #endif STRING DLG_REPORT 256 66 BEGIN -PROMPT 1 -2 "Report " -FLAGS "B" -RSELECT CLASS_NAME -CHECKTYPE REQUIRED -WARNING "Impossibile trovare un report compatibile" + PROMPT 1 -2 "Report " + FLAGS "B" + RSELECT CLASS_NAME END STRING DLG_PROFILE 50 BEGIN -PROMPT 1 -1 "Profilo " -PSELECT + PROMPT 1 -1 "Profilo " + PSELECT END \ No newline at end of file diff --git a/src/include/brwbut.cpp b/src/include/brwbut.cpp index f376aaad3..8e804f38b 100644 --- a/src/include/brwbut.cpp +++ b/src/include/brwbut.cpp @@ -1713,20 +1713,38 @@ bool TReport_select::check(CheckTime ct) { TFilename name = field().get(); - if (ct == STARTING_CHECK || ct == FINAL_CHECK) + if (ct == STARTING_CHECK || ct == RUNNING_CHECK || ct == FINAL_CHECK) { + TString_array reps; + + list_custom_files("rep", _classe, reps); if (name.empty()) { - TString_array reps; - list_custom_files("rep", _classe, reps); if (reps.items() > 0) field().set(((TToken_string &)reps[0]).get(0)); else field().set(""); } - if (ct == FINAL_CHECK && field().get().empty()) - return false; + if (ct == RUNNING_CHECK || ct == FINAL_CHECK) + { + const TString & repname = field().get(); + + if (repname.blank() && ct == FINAL_CHECK) + return field().error_box(TR("Il report deve essere specificato")); + bool found = false; + FOR_EACH_ARRAY_ITEM(reps, r, obj) + { + TToken_string * row = (TToken_string *)obj; + + found = (repname == row->get(0)); + if (found) + break; + } + + if (!found) + return field().error_box(FR("Il report %s non è compatibile"), (const char *)repname); + } } if (field().roman()) // Must exist return name.custom_path(); diff --git a/src/include/repapp.cpp b/src/include/repapp.cpp index 478ff4538..4cdb17ed6 100644 --- a/src/include/repapp.cpp +++ b/src/include/repapp.cpp @@ -23,7 +23,7 @@ bool TReport_application::destroy() } // @cmember Esegue la stampa -void TReport_application::execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type type) +void TReport_application::execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type & type) { rep.set_export_sections(type); book.add(rep, type); @@ -181,7 +181,7 @@ void TReport_application::main_loop() name.add(fname); } } - + _user_key = ' '; switch (k) { case K_PRINT: @@ -206,6 +206,8 @@ void TReport_application::main_loop() type = _export_visualize; break; default: + type = _export_user; + _user_key = k; break; } @@ -267,8 +269,13 @@ void TReport_application::main_loop() bool ask_filename = name.blank(); export_type type = _export_printer; + _user_key = ' '; switch (k) { + case K_ENTER: + case K_PRINT: + type = _export_printer; + break; case K_EXCEL: type = _export_excel; break; @@ -288,31 +295,32 @@ void TReport_application::main_loop() type = _export_visualize; break; default: + type = _export_user; + _user_key = k; break; } execute_print(b, m, rep, type); - switch (k) + switch (type) { - case K_ENTER: - case K_PRINT: + case _export_printer: b.print_or_preview(); break; - case K_EXPORT: + case _export_generic: esporta(b, m, rep); break; - case K_EXCEL: + case _export_excel: export_excel(name, b, m, rep); break; - case K_PDF: + case _export_pdf: export_pdf(name, b, m, rep); break; - case K_TEXT: + case _export_text: export_text(name, b, m, rep); break; - case K_DBF: + case _export_dbase: export_dbase(name, b, m, rep); break; - case K_VISUALIZE: + case _export_visualize: b.preview(); break; default: diff --git a/src/include/repapp.h b/src/include/repapp.h index 8e3f24f42..8cc5074ff 100644 --- a/src/include/repapp.h +++ b/src/include/repapp.h @@ -26,6 +26,8 @@ class TReport_application : public TSkeleton_application // @access:(INTERNAL) Private Member { + KEY _user_key; + private: virtual bool create(); virtual bool destroy(); @@ -49,9 +51,10 @@ protected: // TApplication // @cmember Ritorna il report virtual TReport & get_report(const TAutomask & m) pure; - virtual void execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type type = _export_printer); + virtual void execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type & type); public: + KEY user_key() const { return _user_key; }; virtual short outputdir_id() const { return DLG_OUTPUTD; } virtual short outputfile_id() const { return DLG_OUTPUTF; } virtual short report_id() const { return DLG_REPORT; } @@ -66,7 +69,7 @@ public: virtual const char * output_name(const TAutomask & mask, const TReport & rep) const { return report_name(mask); } const char * get_output_filename(const TAutomask & mask, const TReport & rep); // @cmember Costruttore - TReport_application() { } + TReport_application() : _user_key(' ') { } // @cmember Distruttore virtual ~TReport_application() { } }; diff --git a/src/include/report.h b/src/include/report.h index c2d8e8ddd..69490c543 100755 --- a/src/include/report.h +++ b/src/include/report.h @@ -543,7 +543,7 @@ public: // Internal usage only typedef void (*FLDMSG_FUNC)(TReport_field& rf, void* jolly); -typedef enum { _export_printer, _export_generic,_export_visualize, _export_excel, _export_pdf, _export_text, _export_dbase } export_type; +typedef enum { _export_printer, _export_generic,_export_visualize, _export_excel, _export_pdf, _export_text, _export_dbase, _export_user } export_type; class TReport : public TAlex_virtual_machine {