diff --git a/cd/test/bs0722.txt b/cd/test/bs0722.txt new file mode 100644 index 000000000..682dfb286 --- /dev/null +++ b/cd/test/bs0722.txt @@ -0,0 +1,4 @@ +bs0.exe +bs0300a.msk + +Resa obbligatoria gestione CONAI in SKNT \ No newline at end of file diff --git a/cd/test/bs0722a.ini b/cd/test/bs0722a.ini new file mode 100644 index 000000000..11b2671a4 --- /dev/null +++ b/cd/test/bs0722a.ini @@ -0,0 +1,22 @@ +[Main] +Demo=0 + +[bs1] +File(0) = bs0.exe|X +File(3) = bs0300a.msk|X +Patch = 722 +Versione = 21511200 + +[bs] +Data = 06-03-2019 +Descrizione = Bee Store +Dischi = 1 +Moduli = ve +OEM = +Patch = 722 +PostProcess = +PreProcess = +Prezzo(1) = +Prezzo(2) = +Versione = 21511200 + diff --git a/cd/test/bs0722a1.zip b/cd/test/bs0722a1.zip new file mode 100644 index 000000000..a137e83cb Binary files /dev/null and b/cd/test/bs0722a1.zip differ diff --git a/cd/test/fp0724.txt b/cd/test/fp0724.txt new file mode 100644 index 000000000..8891b108c --- /dev/null +++ b/cd/test/fp0724.txt @@ -0,0 +1,7 @@ +fp0.exe +fp0400a.msk +fp0500a.msk + +Aggiunti filtri fatture elaborate e non per monitor fatture passive +Aggiunta possibilità di modificare il corpo delle mail da inviare per mancata consegna +Corretta lettura codice IVA incasso (ripatchato) diff --git a/cd/test/fp0724a.ini b/cd/test/fp0724a.ini new file mode 100644 index 000000000..0b3af2359 --- /dev/null +++ b/cd/test/fp0724a.ini @@ -0,0 +1,21 @@ +[Main] +Demo=0 + +[fp1] +File(0) = fp0.exe|X +File(4) = fp0400a.msk|X +File(5) = fp0500a.msk|X +Patch = 0724 +Versione = 21511200 + +[fp] +Data = 07-03-2019 +Descrizione = Fattura Elettronica +Dischi = 1 +Moduli = cg,ve +OEM = +Patch = 724 +PostProcess = +PreProcess = +Versione = 21511200 + diff --git a/cd/test/fp0724a1.zip b/cd/test/fp0724a1.zip new file mode 100644 index 000000000..08a6b3f62 Binary files /dev/null and b/cd/test/fp0724a1.zip differ diff --git a/src/fp/fp0.cpp b/src/fp/fp0.cpp index 0c89b13a1..215e7eba1 100644 --- a/src/fp/fp0.cpp +++ b/src/fp/fp0.cpp @@ -11,7 +11,7 @@ int main(int argc, char** argv) case 1: rt = fp0200(argc, argv); break; // Inserimento massivo PEC e Cod Sdi clifo case 2: rt = fp0300(argc, argv); break; // Gestione fatture attive (PAA, Ex Fattura PA) case 3: rt = fp0400(argc, argv); break; // Monitor fatture passive - case 4: rt = fp0500(argc, argv); break; // Elenco mancate consegna + //case 4: rt = fp0500(argc, argv); break; // Elenco mancate consegna default: rt = fp0100(argc, argv); break; // Configurazione } return rt; diff --git a/src/fp/fp0.h b/src/fp/fp0.h index afdcb9b22..c08010ca7 100644 --- a/src/fp/fp0.h +++ b/src/fp/fp0.h @@ -5,6 +5,6 @@ int fp0100(int argc, char* argv[]); int fp0200(int argc, char* argv[]); int fp0300(int argc, char* argv[]); int fp0400(int argc, char* argv[]); -int fp0500(int argc, char* argv[]); +//int fp0500(int argc, char* argv[]); #endif diff --git a/src/fp/fp0400.cpp b/src/fp/fp0400.cpp index 1df08a10c..caafb86fb 100644 --- a/src/fp/fp0400.cpp +++ b/src/fp/fp0400.cpp @@ -167,8 +167,6 @@ void TPassive_mask::aggiungi_riga(TLocalisamfile& clifo, TSheet_field& sf, TShee const TString paa_codsdi = fp_db().sq_get("COD_SDI"); TString prot = fp_db().sq_get("TIPO_PROT"); TString filter_elab = get(F_FATTSEL); - - TToken_string& row = sf.row(-1); clifo.zero(); clifo.put(CLI_TIPOCF, 'F'); @@ -176,6 +174,7 @@ void TPassive_mask::aggiungi_riga(TLocalisamfile& clifo, TSheet_field& sf, TShee forn_code = find_fornitore(clifo); if( filter_elab.blank() && forn_code != 0 || filter_elab == "E" && forn_code == 0 || filter_elab == "A") { + TToken_string& row = sf.row(-1); if (denom.blank()) { denom = fp_db().sq_get("NOME"); denom << " " << fp_db().sq_get("COGNOME"); diff --git a/src/fp/fp0500.cpp b/src/fp/fp0500.cpp index 23692f45d..744337660 100644 --- a/src/fp/fp0500.cpp +++ b/src/fp/fp0500.cpp @@ -26,7 +26,8 @@ class TMancati_mask : public TAutomask { - + int _idx; + protected: enum {_codnum, _tipodoc, _dastato, _astato, _tiposdi}; @@ -45,8 +46,9 @@ protected: public: TMancati_mask() : TAutomask("fp0500a"), _filter_changed(true) { - disable(DLG_OK); - load_all_fields(); + disable(DLG_OK); + _idx = -1; + load_all_fields(); } void save_all_fields() const; }; @@ -59,6 +61,20 @@ void TMancati_mask::save_all_fields() const // Salvo lo sheet TFP_selected_docs selected_docs; selected_docs.save_sheet(sfield(F_DOCUMENTI_TIPO)); + // Salvo messaggio corpo mail + TToken_string msg(get(F_BODYMAIL), '\n'); + int idx = 0; + + for(const char* row = msg.get(); row; row = msg.get()) + fp_settings().set_body_mail(row, idx++); + + if(idx < _idx) + { + for(int i=idx; i<_idx; i++) + { + fp_settings().remove_para_ini(idx); + } + } } void TMancati_mask::load_all_fields() @@ -106,6 +122,19 @@ void TMancati_mask::load_all_fields() } sheet.force_update(); sheet.show(); + + // Carico messaggio corpo mail già salvato o vuoto se mai inserito + TString msg; + + int idx = 0; + for(TString row = fp_settings().get_body_mail(idx); row != "STOpsTOP"; row = fp_settings().get_body_mail(idx)) + { + if (idx++ > 0) + msg << '\n'; + msg << row; + } + _idx = idx; + set(F_BODYMAIL, msg); } void TMancati_mask::fill() @@ -170,6 +199,7 @@ void TMancati_mask::fill() || filter_selected == "A") { TToken_string& row = docs.row(-1); + row = ""; row.add(rec.get(DOC_ANNO).as_int(), 1); row.add(rec.get(DOC_CODNUM).as_string()); @@ -261,11 +291,8 @@ void TMancati_mask::next_page(int p) { TAutomask::next_page(p); if (curr_page() == 1) - { enable(DLG_OK); - } else enable(DLG_OK, false); - } } @@ -338,6 +365,7 @@ void TMancati_app::main_loop() { TString_array& sht = mask.sfield(F_DOCS).rows_array(); TFp_mail_sender mail_sender; + const TString& msg = mask.get(F_BODYMAIL); if ( !mail_sender.set_alleg(fp_settings().get_allega_fat()) ) { @@ -372,7 +400,7 @@ void TMancati_app::main_loop() bool sent = TString(riga->get(mask.sfield(F_DOCS).cid2index(S_SENT))) == "X"; mail_sender.set_doc(anno, ndoc, codnum, tipodoc, codcf, mail, accord, ragsoc, sent); - if (mail_sender.send()) { + if (mail_sender.send(msg)) { riga->add("", 0); // Se l'invio avviene con successo sfleggo la riga riga->add("X", 11); // E segno inviata } diff --git a/src/fp/fp0500a.h b/src/fp/fp0500a.h index 8525fd41a..aadcc8604 100644 --- a/src/fp/fp0500a.h +++ b/src/fp/fp0500a.h @@ -5,6 +5,7 @@ #define F_SETDEFCOD 404 #define F_SETCODEST 405 #define F_VALCODEST 406 +#define F_BODYMAIL 407 #define END_MASK 499 diff --git a/src/fp/fp0500a.uml b/src/fp/fp0500a.uml index 190312044..f93367b7b 100644 --- a/src/fp/fp0500a.uml +++ b/src/fp/fp0500a.uml @@ -54,6 +54,11 @@ BEGIN ITEM "Tipo SDI" END +MEMO F_BODYMAIL 78 10 +BEGIN + PROMPT 1 12 "Messaggio del corpo della EMail (senza firma)" +END + ENDPAGE PAGE "Elenco Fatture" 0 2 0 0 diff --git a/src/fp/fplib.h b/src/fp/fplib.h index 03e70df59..1dac8af55 100644 --- a/src/fp/fplib.h +++ b/src/fp/fplib.h @@ -226,6 +226,7 @@ public: const TString& get_esp_est_cod() const; const bool is_f8() const; const bool get_check_not_block() const; + const TString& get_body_mail(int idx = -1) const; // Setters void set_db_indirizzo(const TString& ind) const; @@ -242,6 +243,9 @@ public: void set_esp_est_cod(const TString& esp_est_cod) const; void set_f8(bool f8) const; void set_check_not_block(bool not_block) const; + void set_body_mail(const char* msg, int idx = -1) const; + + void remove_para_ini(int idx); }; inline TFP_settings& fp_settings() @@ -326,10 +330,10 @@ class TFp_mail_sender public: void set_doc(const int anno, const long ndoc, const TFixed_string& codnum, const TFixed_string& tipodoc, const long codcf, TString mail, bool accord, TString ragsoc, bool sent); bool genera_pdf(); - bool send(); + bool send(const TString& msg); bool get_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn, TString& subj, TString& text, TToken_string& attach, short& flags); - bool spotlite_send_mail(const TFilename& pdf); - bool spotlite_send_mail(); + bool spotlite_send_mail(const TFilename& pdf, const TString& msg); + bool spotlite_send_mail(const TString& msg); bool set_alleg(const bool allega_fat); TFp_mail_sender() { _error = -1; } diff --git a/src/fp/fplib01.cpp b/src/fp/fplib01.cpp index 8c7f83064..ea7a3e9a7 100644 --- a/src/fp/fplib01.cpp +++ b/src/fp/fplib01.cpp @@ -27,8 +27,7 @@ void set_connection(SSimple_query& s) TString ip = fp_settings().get_db_indirizzo(); if (ip.upper() != "TESTCAMPO2012") { - if (s.sq_connect("TESTCAMPO2012@campo_fp", - "fp", + if (s.sq_connect("TESTCAMPO2012@campo_fp", "fp", "fp", TSDB_MSSQL) != NOERR) fatal_box("Impossibile connettersi al DB esterno"); @@ -193,12 +192,13 @@ bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString& return coddest.full(); } -inline const TString& no_special(const char a) +inline const TString& no_special(char a) { TString& r = get_tmp_string().cut(0); + switch(a) if(a != '\'') { - r << a; + r << a; } return r; } @@ -1834,7 +1834,6 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) paf1800f.set("PI_PRZTOTALE", ZERO); set_IVA(_codivadefault, paf1800f); ok &= insert(paf1800f) && insert(paf3000f); - riga++; } } // Se il bollo va fatto pagare bisogna aggiungere una riga! @@ -1854,7 +1853,6 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) paf1800f.set("PI_PRZTOTALE", converti_prezzo(doc.get_real("BOLLI"))); set_IVA(doc.codiva_bolli(), paf1800f); ok &= insert(paf1800f) && insert(paf3000f); - riga++; } // OMAGGI???? // Aggiungo le spese incasso @@ -1876,7 +1874,6 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) set_IVA(ini_get_string(CONFIG_DITTA, "ve", "SPINCODIVA"), paf1800f); ok &= insert(paf1800f) && insert(paf3000f); - riga++; } // Conai assolto if(doc.clifor().vendite().get_bool("CONAIASS")) @@ -1895,7 +1892,6 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) paf1800f.set("PI_PRZTOTALE", ZERO); set_IVA(_codivadefault, paf1800f); ok &= insert(paf1800f) && insert(paf3000f); - riga++; } // Riga sconto di testata @@ -1927,7 +1923,6 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) paf1800f.set("PI_PRZTOTALE", -abs(riva.sconto_perc())); set_IVA(riva.cod_iva().codice(), paf1800f); ok &= insert(paf1800f) && insert(paf3000f); - riga++; } } diff --git a/src/fp/fplib02.cpp b/src/fp/fplib02.cpp index 9e0a0b369..2fbee2bdd 100644 --- a/src/fp/fplib02.cpp +++ b/src/fp/fplib02.cpp @@ -20,6 +20,7 @@ #define FP_ESP_EST_COD "espestcod" #define FP_F8 "f8" #define FP_CHECK_NOT_BLOCK "checknotblock" +#define FP_MAIL "mail" // Sheet fp0300 #define FP_SLD_COD "SLD" @@ -118,6 +119,11 @@ const bool TFP_settings::get_check_not_block() const return ini_get_bool(FILE_CONFIG, FILE_SECTION, FP_CHECK_NOT_BLOCK); } +const TString& TFP_settings::get_body_mail(int idx) const +{ + return ini_get_string(FILE_CONFIG, FILE_SECTION, FP_MAIL, "STOpsTOP", idx); +} + void TFP_settings::set_db_indirizzo(const TString& ind) const { ini_set_string(FILE_CONFIG, FILE_SECTION, FP_IP, ind); @@ -188,6 +194,16 @@ void TFP_settings::set_check_not_block(const bool not_block) const ini_set_bool(FILE_CONFIG, FILE_SECTION, FP_CHECK_NOT_BLOCK, not_block); } +void TFP_settings::set_body_mail(const char* msg, int idx) const +{ + ini_set_string(FILE_CONFIG, FILE_SECTION, FP_MAIL, msg, idx); +} + +void TFP_settings::remove_para_ini(int idx) +{ + ini_remove(FILE_CONFIG, FILE_SECTION, FP_MAIL, idx); +} + TRectype TFP_selected_docs::fill_rectype() const { TRectype r(LF_TABMOD); diff --git a/src/fp/fplib03.cpp b/src/fp/fplib03.cpp index 06962c865..7697bb403 100644 --- a/src/fp/fplib03.cpp +++ b/src/fp/fplib03.cpp @@ -3,6 +3,7 @@ #include #include #include "modaut.h" +#include "fp0500a.h" class TExternal_app; @@ -48,7 +49,7 @@ bool TFp_mail_sender::genera_pdf() } // Creo se non c'è il pdf e lo allego alla mail per l'invio -bool TFp_mail_sender::send() +bool TFp_mail_sender::send(const TString& msg) { // Controllo per sicurezza quando si prova a rifare l'invio di una fattura già spedita if (_sent) @@ -76,16 +77,16 @@ bool TFp_mail_sender::send() else if (genera_pdf()) // Genero pdf se non esiste già (in tempdir) { // Manda già un messaggio di errore generazione se fallisce la generazione TFilename newf_pdf; newf_pdf << _pdf_path << _pdf_name; - ok = spotlite_send_mail(newf_pdf); + ok = spotlite_send_mail(newf_pdf, msg); } else { - TString msg; msg << "Inviare lo stesso la mail senza il pdf allegato?"; - if (noyes_box(msg)) // Se la generazione fallisce chiedo se procedere lo stesso - ok = spotlite_send_mail(); // Se sì, procedo con mail senza pdf + TString msg_err; msg_err << "Inviare lo stesso la mail senza il pdf allegato?"; + if (noyes_box(msg_err)) // Se la generazione fallisce chiedo se procedere lo stesso + ok = spotlite_send_mail(msg); // Se sì, procedo con mail senza pdf } // Se no, esco senza inviare } else if (!_alleg && _accord) - ok = spotlite_send_mail(); + ok = spotlite_send_mail(msg); if(ok) { @@ -140,10 +141,11 @@ bool TFp_mail_sender::get_mail(TToken_string& to, TToken_string& cc, TToken_stri return true; } // Funzione per spedire un pdf via mail -bool TFp_mail_sender::spotlite_send_mail(const TFilename& pdf) +bool TFp_mail_sender::spotlite_send_mail(const TFilename& pdf, const TString& msg) { TToken_string to(15, ';'), cc(15, ';'), ccn(15, ';'), attach(pdf, ';'); - TString subj, text; + TString subj; + TString text; text << msg << "\n\n"; short flags = 0x1; // UI bool ok = get_mail(to, cc, ccn, subj, text, attach, flags); @@ -157,10 +159,11 @@ bool TFp_mail_sender::spotlite_send_mail(const TFilename& pdf) return ok; } -bool TFp_mail_sender::spotlite_send_mail() +bool TFp_mail_sender::spotlite_send_mail(const TString& msg) { TToken_string to(15, ';'), cc(15, ';'), ccn(15, ';'), attach(15, ';'); - TString subj, text; + TString subj; + TString text; text << msg << "\n\n"; short flags = 0x1; // UI bool ok = get_mail(to, cc, ccn, subj, text, attach, flags); diff --git a/src/include/config.cpp b/src/include/config.cpp index 9244d1013..a1beb7a3a 100755 --- a/src/include/config.cpp +++ b/src/include/config.cpp @@ -899,7 +899,7 @@ TConfig::~TConfig() const TString& ini_get_string(const char* file, const char* paragraph, const char* name, const char* defval, int idx) { DECLARE_VARNAME(name, idx); - TString& tmp = get_tmp_string(); + TString& tmp = get_tmp_string(255); const int len = xvt_sys_get_profile_string(file, paragraph, varname, defval, tmp.get_buffer(), tmp.size()); if (len > tmp.size()) { @@ -922,6 +922,13 @@ bool ini_set_string(const char* file, const char* paragraph, const char* name, c return xvt_sys_set_profile_string(file, paragraph, varname, val) != 0; } +bool ini_remove(const char* file, const char* para, const char* name, int idx) +{ + TConfig c(file,para); + + return c.remove(name, idx); +} + bool ini_get_bool(const char* file, const char* para, const char* name, bool defval, int idx) { const char b = ini_get_string(file, para, name, defval ? "1" : "0", idx)[0]; @@ -960,7 +967,13 @@ const TString& ini_get_string(int cfg, const char* paragraph, const char* name, bool ini_set_string(int cfg, const char* paragraph, const char* name, const char* val, int idx) { DECLARE_FILENAME(cfg); - return ini_set_string(filename, paragraph, name, val); + return ini_set_string(filename, paragraph, name, val, idx); +} + +bool ini_remove(int cfg, const char* para, const char* name, int idx) +{ + DECLARE_FILENAME(cfg); + return ini_remove(filename, para, name, idx); } int ini_get_int(int cfg, const char* paragraph, const char* name, int defval, int idx) diff --git a/src/include/config.h b/src/include/config.h index 15bfed7ea..738e8bfbd 100755 --- a/src/include/config.h +++ b/src/include/config.h @@ -191,7 +191,7 @@ const TString& ini_get_string(const char* file, const char* para, const char* na bool ini_set_bool (const char* file, const char* para, const char* name, bool val, int idx = -1); bool ini_set_int (const char* file, const char* para, const char* name, int val, int idx = -1); bool ini_set_string(const char* file, const char* para, const char* name, const char* val, int idx = -1); - +bool ini_remove (const char* file, const char* para, const char* name, int idx = -1); // High level utilities bool ini_get_bool (int cfg, const char* para, const char* name, bool defval = false, int idx = -1); int ini_get_int (int cfg, const char* para, const char* name, int defval = 0, int idx = -1); @@ -199,6 +199,7 @@ const TString& ini_get_string(int cfg, const char* para, const char* name, const bool ini_set_bool (int cfg, const char* para, const char* name, bool val, int idx = -1); bool ini_set_int (int cfg, const char* para, const char* name, int val, int idx = -1); bool ini_set_string(int cfg, const char* para, const char* name, const char* val, int idx = -1); +bool ini_remove (int cfg, const char* para, const char* name, int idx = -1); const TString& get_oem_info(const char* varname, const char* defval = ""); // ini_get_string(CONFIG_OEM, "OEM_?", varname, defval); bool is_aga_version(bool power_user_only = false);