From e555a3b76e2836d8b9d405402bcdd19f426ae018 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Thu, 21 Nov 2024 15:29:36 +0100 Subject: [PATCH] Patch level : 01.00 1370 Files correlati : ba0.exe ba0100m.msk sc2.exe sc2100b.msk sc2400b.msk Commento: Invio solleciti per email --- src/sc/scselect.cpp | 52 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/src/sc/scselect.cpp b/src/sc/scselect.cpp index 6f0cbe90e..7a53cdd53 100755 --- a/src/sc/scselect.cpp +++ b/src/sc/scselect.cpp @@ -1640,7 +1640,7 @@ int TSelection_mask::send_doc(long codice, const TString & ragsoc, const TToken_ TToken_string to(email, ';'), attachment("", ';'); TString esito("Invio a "); TString subject(subj); - TString message(msg); + TString message; TString stat("Invio a "); stat << ' ' << ragsoc; @@ -1657,16 +1657,30 @@ int TSelection_mask::send_doc(long codice, const TString & ragsoc, const TToken_ if (subject.blank()) subject << (sollecito ? TR("Sollecito da ") : TR("Estratto conto da ")); subject << ' ' << prefix().firm().ragione_sociale(); - if (message.blank()) + + TToken_string key; + + key.add(who()); + key.add(codice); + + const TString & tipo = cache().get(LF_CLIFO, key, CLI_TIPOPERS); + + if (tipo == "G") + message << "Spett. "; + else + message << "Gent.mo/a "; + message << ragsoc << '\n'; + if (msg.full()) + message << msg << '\n'; + else { - message << "Spett. " << ragsoc << '\n'; if (sollecito) - message << TR("Si ricorda il rispetto delle scadenze aperte al ") << data << '\n' - << TR(" riepilogate nel file allegato ") << '\n'; - else + message << TR("Si invia in allegato l’estratto conto delle partite aperte al ") << data + << TR(" con preghiera di provvedere al saldo quanto prima.") << '\n'; + else message << TR("Invio estratto conto al ") << data << TR(" nel file allegato ") << '\n'; -// message << prefix().firm().ragione_sociale(); } + message << TR("Cordiali saluti\nAmministrazione ") << prefix().firm().ragione_sociale(); pdf.temp("cu", "pdf"); attachment.add(pdf); pr.set_export_file(pdf, true); @@ -1893,11 +1907,25 @@ bool TSelection_mask::on_field_event(TOperable_field& o, TField_event e, long jo TString ragsoc = cli.get(CLI_RAGSOC); TToken_string email; - email = cli.get(CLI_PEC); - if (email.blank()) - email = cli.get(CLI_MAIL); - if (email.blank()) - email = cli.get(CLI_DOCMAIL); + for (int i = 1; email.blank() && i <= 3; i++) + { + const char order = ini_get_string(CONFIG_USER, "Mail", "Email", "", i)[0]; + + switch (order) + { + case 'P': + email = cli.get(CLI_PEC); + break; + case 'N': + email = cli.get(CLI_MAIL); + break; + case 'D': + email = cli.get(CLI_DOCMAIL); + break; + default: + break; + } + } const int nrow = sh.set_row_cell(S_SELECTED, email.full());