Patch level : 12.0 1096

Files correlati     : ba0.exe ba8.exe
Commento        :

Controllata l'esistenza delle catelle temporanee nell'avvio del menù. Se non possono essere create il menù non parte.
Aggiunta la gestione moduli ai report.
This commit is contained in:
Alessandro Bonazzi 2021-11-24 12:54:59 +01:00
parent 4ac26c95d3
commit c75ee0b387
3 changed files with 69 additions and 12 deletions

View File

@ -1,9 +1,11 @@
#include <applicat.h>
#include <colors.h>
#include <config.h>
#include <dongle.h>
#include <defmask.h>
#include <expr.h>
#include <mask.h>
#include <modaut.h>
#include <printer.h>
#include <recarray.h>
#include <reprint.h>
@ -1272,6 +1274,8 @@ void TReport_field::copy(const TReport_field& rf)
_field = rf._field; _alt_field = rf._alt_field;
_prescript = rf._prescript;
_postscript = rf._postscript;
_groups = rf._groups;
_modules = rf._modules;
_list = rf._list;
if (rf._font != NULL)
set_font(*rf._font);
@ -1764,6 +1768,30 @@ bool TReport_field::in_group(int group) const
return _groups[group];
}
void TReport_field::set_modules(const TString& modules)
{
TToken_string mod(modules, ' ');
_modules.reset();
FOR_EACH_STR_TOKEN(mod, m)
_modules.set(dongle().module_name2code(m), true);
}
TToken_string & TReport_field::modules() const
{
TToken_string & mod = get_tmp_string();
long m = _modules.last_one();
mod.separator(' ');
for (; m > BAAUT; m--)
{
if (_modules[(word)m])
mod.add(dongle().module_code2name((word)m));
}
mod.upper();
return mod;
}
void TReport_field::save(TXmlItem& root) const
{
TXmlItem& fld = root.AddChild("field");
@ -1789,6 +1817,10 @@ void TReport_field::save(TXmlItem& root) const
if (in_group(0))
fld.AddChild("groups") << groups();
const TString & mods = modules();
if (mods.full())
fld.AddChild("modules") << mods;
switch (horizontal_alignment())
{
case 'C': fld.SetAttr("align", "center"); break;
@ -1880,10 +1912,10 @@ bool TReport_field::load(const TXmlItem& fld)
set_link(fld.GetAttr("link"));
TXmlItem* src = fld.FindFirstChild("source");
if (src != NULL)
if (src != nullptr)
src->GetEnclosedText(_field);
TXmlItem* alt_src = fld.FindFirstChild("alt_source");
if (alt_src != NULL)
if (alt_src != nullptr)
alt_src->GetEnclosedText(_alt_field);
TReport_font font;
@ -1891,12 +1923,32 @@ bool TReport_field::load(const TXmlItem& fld)
set_font(font);
TXmlItem* grp = fld.FindFirstChild("groups");
if (grp != NULL)
if (grp != nullptr)
{
TString str; grp->GetEnclosedText(str);
set_groups(str);
}
TXmlItem* mod = fld.FindFirstChild("modules");
if (mod != nullptr)
{
TToken_string str("", ' ');
mod->GetEnclosedText(str);
set_modules(str);
if (str.full())
{
long m = _modules.last_one();
_hidden = true;
for (; _hidden && m > BAAUT; m--)
_hidden = !main_app().has_module((word)m);
}
}
_prescript.load(fld, "prescript");
_postscript.load(fld, "postscript");
@ -3118,6 +3170,7 @@ void TReport::msg_table_read(TVariant_stack& stack)
{
const TString& t_code = stack.pop().as_string(); // prende il codice della tabella da leggere
const int logicnum = table2logic(t_code);
if (logicnum == LF_TAB || logicnum == LF_TABCOM || logicnum == LF_TABMOD)
{
const TString& codtab = stack.pop().as_string();
@ -3621,13 +3674,13 @@ bool TReport::archive(bool signature)
return book.archive(NULL, signature);
}
bool TReport::export_text(const char * filename,bool signature, int size)
bool TReport::export_text(const char * filename, int size, bool signature)
{
TReport_book book;
TFilename name(filename);
book.add(*this);
return book.export_text(name, signature, size);
return book.export_text(name, size, signature);
}
TReport::TReport()

View File

@ -358,6 +358,7 @@ class TReport_field : public TSortable
TReport_script _prescript, _postscript;
TArray _list; // Elementi di un campo lista
TString4 _image_resize_type;
TBit_array _modules;
TReport_font *_font, *_print_font;
bool _hidden, _deactivated, _hide_zeroes, _selected;
@ -457,6 +458,9 @@ public:
const TString& groups() const;
bool in_group(int group) const;
void set_modules(const TString& modules);
TToken_string & modules() const ;
void set_codval(const char* cod) { _codval = cod; }
const TString& codval() const { return _codval; }
void set_link(const char* l) { _link = l; }
@ -537,7 +541,7 @@ public:
// Internal usage only
typedef void (*FLDMSG_FUNC)(TReport_field& rf, void* jolly);
typedef enum { _export_printer, _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_type;
class TReport : public TAlex_virtual_machine
{
@ -687,7 +691,7 @@ public:
bool print();
bool preview();
bool archive(bool signature);
bool export_text(const char * filename, bool signature, int size = 0);
bool export_text(const char * filename, int size = 0, bool signature = false);
TReport();
virtual ~TReport();

View File

@ -98,11 +98,11 @@ public:
virtual bool preview();
// esporta il book in un file dbf il tracciato record passato viene disallocato
virtual bool export_dbase(TFilename& fname, bool signature, TTrec * desc = nullptr, bool goto_url = false, bool ask_filename = false);
virtual bool export_excel(TFilename& fname, bool signature, bool goto_url = false, bool ask_filename = false);
virtual bool export_pdf(TFilename& fname, bool signature, bool goto_url = false, bool ask_filename = false);
virtual bool export_text(TFilename& fname, bool signature, int size, bool goto_url = false, bool ask_filename = false);
virtual bool send_mail(TFilename& fname, bool signature);
virtual bool export_dbase(TFilename& fname, TTrec * desc = nullptr, bool signature = false, bool goto_url = false, bool ask_filename = false);
virtual bool export_excel(TFilename& fname, bool signature = false, bool goto_url = false, bool ask_filename = false);
virtual bool export_pdf(TFilename& fname, bool signature = false, bool goto_url = false, bool ask_filename = false);
virtual bool export_text(TFilename& fname, int size = 0, bool signature = false, bool goto_url = false, bool ask_filename = false);
virtual bool send_mail(TFilename& fname, bool signature = false);
virtual bool esporta();
bool print_or_preview(); // Calls one of the above