From 9a13b24bc8417969dae116803fb002aa218b3e72 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Mon, 29 Mar 2021 22:32:54 +0200 Subject: [PATCH] Patch level : 12.0 1048 Files correlati : f20.trr f20.dir Commento : Invio Certificazione unica per email --- src/include/automask.h | 11 ++++++++++- src/include/utility.cpp | 27 +++++++++++++++++++++++++++ src/include/utility.h | 3 +++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/include/automask.h b/src/include/automask.h index 98130c0a2..9b3ea3f82 100755 --- a/src/include/automask.h +++ b/src/include/automask.h @@ -72,9 +72,18 @@ class TSimpleAutomask : public TAutomask public: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly) {return true;} TSimpleAutomask() { } - virtual ~TSimpleAutomask() { } + TSimpleAutomask(const char* name, int num = 0) : TAutomask(name, num) { } + virtual ~TSimpleAutomask() { } }; +class TSimpleVariableAutomask : public TVariable_automask +{ +public: + virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly) { return true; } + TSimpleVariableAutomask() { } + TSimpleVariableAutomask(const char* name, int num = 0) : TVariable_automask(name, num) { } + virtual ~TSimpleVariableAutomask() { } +}; class TIBAN_mask : public TAutomask { TString _last_iso; diff --git a/src/include/utility.cpp b/src/include/utility.cpp index f3f9b5bc3..7516a6dca 100755 --- a/src/include/utility.cpp +++ b/src/include/utility.cpp @@ -900,3 +900,30 @@ void split_IBAN(const char * iban, TString & iso, TString & cin, } } +bool send_mail(TToken_string & to, TToken_string & cc, TToken_string & ccn, + const char * subj, const char * text, TToken_string & attachment) +{ + TString subject(subj); + short flags = 0; // not UI + +#ifdef DBG + TString test_mail = ini_get_string(CONFIG_STUDIO, "Mail", "TestMail"); + + if (test_mail.full()) + { + to = test_mail; + cc.cut(0); + ccn.cut(0); + } +#endif + if (subject.blank()) + subject.cut(0) << TR("Invio di ") << attachment; + if (!(flags & 0x1) && to.empty_items() && cc.empty_items() && ccn.empty_items()) + flags |= 0x1; // Forza UI in assenza di destinatari + + static bool usePower = ini_get_bool(CONFIG_USER, "Mail", "Powershell"); + + bool ok = (usePower ? xvt_powermail_send(to, cc, ccn, subj, text, attachment, flags, user()) : + xvt_mail_send(to, cc, ccn, subj, text, attachment, flags)) != 0; + return ok; +} \ No newline at end of file diff --git a/src/include/utility.h b/src/include/utility.h index bdfae74b3..0dfbcb9b8 100755 --- a/src/include/utility.h +++ b/src/include/utility.h @@ -118,4 +118,7 @@ void build_IBAN(TString & iban, const char * iso, const char * icin, void split_IBAN(const char * iban, TString & iso, TString & icin, TString & bcin, TString & abi, TString & cab, TString & cc); +bool send_mail(TToken_string & to, TToken_string & cc, TToken_string & ccn, + const char * subj, const char * text, TToken_string & attachment); + #endif /* __UTILITY_H */