Patch level : 10.0

Files correlati     : ve1.exe
Ricompilazione Demo : [ ]
Commento            :
Migliorata generazione di grandi quantita' di file PDF (Cliente Sailog)


git-svn-id: svn://10.65.10.50/trunk@19038 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-06-16 14:37:58 +00:00
parent ad6b1097e8
commit aa4accbc4c
2 changed files with 39 additions and 29 deletions

View File

@ -528,13 +528,13 @@ bool TMotore_application::user_create( )
for (int i = 2; i < args; i++) for (int i = 2; i < args; i++)
{ {
const TString arg(argv(i)); const TFixed_string arg(argv(i));
if (arg.starts_with("-def")) if (arg.starts_with("-def"))
{ {
TToken_string str(arg.mid(4), ','); TToken_string str(arg.mid(4), ',');
const TString16 codnum(str.get()); const TString4 codnum(str.get());
const TString16 tipodoc(str.get()); const TString4 tipodoc(str.get());
const TString16 paragraph(str.get()); const TString16 paragraph(str.get());
if (paragraph.blank()) if (paragraph.blank())
@ -545,7 +545,6 @@ bool TMotore_application::user_create( )
else else
{ {
TConfig c(CONFIG_DITTA, paragraph); TConfig c(CONFIG_DITTA, paragraph);
_codnum = c.get(codnum); _codnum = c.get(codnum);
_tipodoc = c.get(tipodoc); _tipodoc = c.get(tipodoc);
} }
@ -556,7 +555,6 @@ bool TMotore_application::user_create( )
if (b != NULL || bdes != NULL) if (b != NULL || bdes != NULL)
{ {
TString filter = b->get_filter(); TString filter = b->get_filter();
if (filter.full()) if (filter.full())
{ {
filter.insert("("); filter.insert("(");
@ -569,7 +567,6 @@ bool TMotore_application::user_create( )
else else
{ {
const TString newfilter(arg.mid(5)); const TString newfilter(arg.mid(5));
if (b != NULL) if (b != NULL)
b->set_filter(newfilter); b->set_filter(newfilter);
if (bdes != NULL) if (bdes != NULL)

View File

@ -9,7 +9,9 @@
#include <progind.h> #include <progind.h>
#include <reprint.h> #include <reprint.h>
#include <reputils.h> #include <reputils.h>
#include <spotlite.h>
#include <statbar.h> #include <statbar.h>
#include <utility.h>
#include <clifo.h> #include <clifo.h>
#include <cfven.h> #include <cfven.h>
@ -915,12 +917,11 @@ bool TReport_doc_app::get_next_pdf(int anno, long ditta, const char* codnum, lon
return ok; return ok;
} }
const TString & TReport_doc_app::get_mail_address() const const TString& TReport_doc_app::get_mail_address() const
{ {
TString key; TString8 key; key << _tipocf << '|' << _codcf;
const TString& maddr = cache().get(LF_CLIFO, key, CLI_DOCMAIL);
key << _tipocf << '|' << _codcf; return maddr;
return cache().get(LF_CLIFO, key, CLI_DOCMAIL);
} }
bool TReport_doc_app::get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn, bool TReport_doc_app::get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn,
@ -938,7 +939,7 @@ bool TReport_doc_app::get_next_mail(TToken_string& to, TToken_string& cc, TToken
doc.riferimento(subj); doc.riferimento(subj);
if (subj.blank()) if (subj.blank())
subj = doc.tipo().descrizione(); subj = doc.tipo().descrizione();
text << "Invio documento " << subj; text << TR("Invio documento ") << subj;
ui = false; ui = false;
} }
} }
@ -1034,6 +1035,11 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
TLog_report log(TR("Invio documenti per email")); TLog_report log(TR("Invio documenti per email"));
TProgind pi(docs, TR("Elaborazione documenti..."), true, true); TProgind pi(docs, TR("Elaborazione documenti..."), true, true);
bool attach_mail = mode==out_mail || mode==out_signed_mail;
if (attach_mail && is_power_station())
attach_mail = yesno_box(TR("Si desidera spedire veramente i documenti via mail?\n"
"Rispondendo NO verranno solo salvati gli allegati."));
for (int i = 0; i < docs; i++) for (int i = 0; i < docs; i++)
{ {
if (!pi.addstatus(1)) if (!pi.addstatus(1))
@ -1068,11 +1074,15 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
if (ok) if (ok)
{ {
int copies = _msk->get_int(F_NCOPIE); int copies = 1;
if (copies <= 0 && is_definitive) if (!paperless)
copies = tipo.ncopie(); {
if (copies <= 0 || paperless) copies = _msk->get_int(F_NCOPIE);
copies = 1; if (copies <= 0 && is_definitive)
copies = tipo.ncopie();
if (copies <= 0)
copies = 1;
}
TReport_doc& report = reports.get(profilo); TReport_doc& report = reports.get(profilo);
@ -1082,7 +1092,7 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
if (!report.print(doc, *mail_book, is_definitive, 1, true, arc, signature)) if (!report.print(doc, *mail_book, is_definitive, 1, true, arc, signature))
break; break;
TString mesg; TString mesg;
mesg << tipo.descrizione() << TR(" n. ") << doc.get(DOC_NDOC).as_int() mesg << tipo.descrizione() << TR(" n. ") << doc.get(DOC_NDOC)
<< TR(" a ") << get_mail_address(); << TR(" a ") << get_mail_address();
log.log(0, mesg); log.log(0, mesg);
} }
@ -1131,12 +1141,16 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
if (mail_book->pages() > 0) if (mail_book->pages() > 0)
{ {
TFilename attachment; TFilename attachment;
attachment.tempdir(); attachment.tempdir();
attachment << SLASH << _anno <<'_' << _codnum << '_' << _ndoc; attachment << SLASH << _anno <<'_' << _codnum << '_' << _ndoc;
attachment.ext("pdf"); attachment.ext("pdf");
mail_book->send_mail(attachment, mode == out_signed_mail);
remove(attachment); bool ok = mail_book->export_pdf(attachment, mode == out_signed_mail);
if (attach_mail) // Ho chiesto la spedizione vera e propria
{
ok = spotlite_send_mail(attachment);
remove(attachment);
}
} }
delete mail_book; delete mail_book;
mail_book = NULL; mail_book = NULL;
@ -1158,7 +1172,6 @@ bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
pdf.tempdir(); pdf.tempdir();
pdf << SLASH << _anno <<'_' << _codnum << '_' << _ndoc; pdf << SLASH << _anno <<'_' << _codnum << '_' << _ndoc;
pdf.ext("pdf"); pdf.ext("pdf");
if (book.export_pdf(pdf, mode == out_signed_pdf)) if (book.export_pdf(pdf, mode == out_signed_pdf))
xvt_sys_goto_url(pdf, "open"); xvt_sys_goto_url(pdf, "open");
} }
@ -1194,13 +1207,13 @@ TReport_doc_app::TOutput_mode TReport_doc_app::key2mode(KEY k) const
switch (k) switch (k)
{ {
case 'A': mode = out_preview; break; case 'A': mode = out_preview; break;
case 'E': mode = out_mail; break; case 'E': mode = out_mail; break;
case 'e': mode = out_signed_mail; break; case 'e': mode = out_signed_mail; break;
case 'P': mode = out_pdf; break; case 'P': mode = out_pdf; break;
case 'p': mode = out_signed_pdf; break; case 'p': mode = out_signed_pdf; break;
case 'S': case 'S':
default : mode = out_print; break; default : mode = out_print; break;
} }
return mode; return mode;
} }