Patch level : 2.2

Files correlati     : ve0 ve1
Ricompilazione Demo : [ ]
Commento            :

Corretta gestione nome dei profili di stampa (principale ed aggiuntivo)
Non funzionanva corretamente in presenza di profilo principale lungo meno di 8 caratteri
quando si specificava anche un profilo aggiuntivo (non vuoto).

Attenzione: ricompilare per benino anche vedoc.lib


git-svn-id: svn://10.65.10.50/trunk@13496 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2005-11-15 12:04:34 +00:00
parent f22e8df6d2
commit cc5fcc3c2e
5 changed files with 120 additions and 99 deletions

View File

@ -547,17 +547,18 @@ void TMotore_application::print()
if (_print_directly || save(TRUE)) // Registra il record corrente
{
TDocumento& doc = (TDocumento&)get_relation()->curr();
const bool da_stampare = doc.stampabile();
const TTipo_documento& tipo = doc.tipo();
TFilename rep(tipo.main_print_profile());
rep.ext("rep");
TFilename rep;
if (tipo.main_print_profile(rep))
{
const bool da_stampare = doc.stampabile();
TString commandline;
if (rep.custom_path()) // Esiste il nuovo report :-)
commandline = "ve1 -2";
else // Esiste il vecchio form :-(
commandline = "ve1 -0";
if (rep.ends_with(".rep"))
commandline = "ve1 -2"; // Esiste il nuovo report :-)
else
commandline = "ve1 -0"; // Esiste il vecchio form :-(
commandline << ' ' << doc.get(DOC_CODNUM) << ' ' << doc.get(DOC_ANNO) << ' ';
commandline << doc.get(DOC_PROVV) << ' ' << doc.get(DOC_NDOC) << ' ' << doc.get(DOC_NDOC);
@ -581,6 +582,7 @@ void TMotore_application::print()
}
}
}
}
}
int ve0100( int argc, char* argv[])

View File

@ -167,35 +167,32 @@ void TDocumento_form::set_doc_ext(TRectype* doc)
static TTipi_documento_cache __tipi;
TDocumento_form::TDocumento_form(TRectype& doc, TRelation& rel, bool definitiva, bool interattivo, bool aggiuntivo)
: _firmrel(rel), _sorted_cur(NULL), _docfile(NULL), _rdocfile(NULL), _doc(NULL), _valid(FALSE)
: _firmrel(rel), _sorted_cur(NULL), _docfile(NULL), _rdocfile(NULL), _doc(NULL), _valid(false)
{
_form = this;
const TString4 tipodoc(doc.get(DOC_TIPODOC));
TFilename nomeform;
const TTipo_documento & tipo = __tipi.tipo(tipodoc);
const TTipo_documento& tipo = __tipi.tipo(tipodoc);
if (tipo.empty())
{
error_box(FR("Tipo di documento non valido: '%s'"), (const char*)tipodoc);
return;
}
if (tipo.printable())
{ // se non ci sono errori procede con la stampa
nomeform = aggiuntivo ? tipo.additional_print_profile() : tipo.main_print_profile(); // legge il nome del form di stampa
nomeform.trim();
TFilename test(nomeform); test.ext("frm");
if (!test.custom_path())
bool found = false;
TFilename nomeform;
if (aggiuntivo)
found = tipo.additional_print_profile(nomeform);
else
found = tipo.main_print_profile(nomeform);
found &= nomeform.ends_with(".frm");
if (!found)
{
error_box(FR("Nome form di stampa '%s' non valido per il tipo documento %s"), (const char*)nomeform, (const char*)tipodoc);
return;
}
}
else
return;
_valid = TRUE;
_valid = true;
read(nomeform);
_cli_loaded= FALSE;
set_doc_ext(&doc); // istanzia TDocumentoEsteso
@ -1439,12 +1436,14 @@ void TStampaDoc_application::print_selected()
extdoc.scadenze_reset();
// Stampa eventuali documenti allegati
const TFilename formagg = extdoc.tipo().additional_print_profile();
TFilename formagg;
if (extdoc.tipo().additional_print_profile(formagg))
{
const int ncopie2 = extdoc.tipo().get_int("I2");
if (!formagg.blank() && ncopie2 > 0) // Se esiste un tipo documento da accodare
if (ncopie2 > 0) // Se esiste un tipo documento da accodare
{
TDocumento_form* secform = new TDocumento_form(cur.curr(), *_firmrel, _definitiva, _interattivo, TRUE);
TDocumento_form* secform = new TDocumento_form(cur.curr(), *_firmrel, _definitiva, _interattivo, true);
if (secform->valid())
{
for (int i = 0; i < ncopie2; i++)
@ -1457,6 +1456,7 @@ void TStampaDoc_application::print_selected()
delete secform;
}
}
}
// se la stampa è definitiva viene lanciata la procedura di rinumerazione
if (_definitiva && _interattivo)

View File

@ -804,14 +804,8 @@ bool TReport_doc_app::print_loop(const TString& query)
doc.move_to(i);
const TString& tipodoc = doc.get(DOC_TIPODOC).as_string();
const TTipo_documento& tipo = _tipi_cache.tipo(tipodoc);
TString16 codprof(tipo.main_print_profile());
codprof.trim();
if (!codprof.blank())
{
TFilename profilo(codprof); profilo.ext("rep");
if (profilo.custom_path()) // Tenta di costruirsi il nome del report
TFilename profilo;
if (tipo.main_print_profile(profilo) && profilo.ends_with(".rep"))
{
TReport_doc& report = reports.get(profilo);
if (!report.print(doc, book, is_definitive))
@ -819,34 +813,18 @@ bool TReport_doc_app::print_loop(const TString& query)
}
else
{
TString msg; msg << TR("Report inesistente") << " : " << codprof;
TString msg; msg << TR("Report inesistente") << " : " << profilo;
statbar_set_title(TASK_WIN, msg);
beep(2);
continue;
}
}
else
continue;
// Stampa eventuali allegati
TString16 codalleg(tipo.additional_print_profile());
codalleg.trim();
if (!codalleg.blank())
{
TFilename profilo(codalleg); profilo.ext("rep");
if (profilo.custom_path())
if (tipo.additional_print_profile(profilo) && profilo.ends_with(".rep"))
{
TReport_doc& allegato = reports.get(profilo);
allegato.print(doc, book, is_definitive);
}
else
{
TString msg; msg << TR("Report allegato inesistente") << " : " << codalleg;
statbar_set_title(TASK_WIN, msg);
}
}
}
if (book.pages() > 0)

View File

@ -288,12 +288,12 @@ public:
bool stato_with_mov_mag(const char stato) const;
bool scarica_residuo() const;
bool clifo_optional() const { return get_bool("B5"); }
bool printable() const { return !get("S5").empty(); }
const TString & main_print_profile() const { return get("S5").left(8); }
const TString & additional_print_profile() const { return get("S5").mid(8); }
bool printable() const { return get("S5").not_empty(); }
bool main_print_profile(TFilename& report) const;
bool additional_print_profile(TFilename& report) const;
TFormula_documento * first_formula() { return succ_formula(true); }
TFormula_documento * succ_formula(bool restart = FALSE);
TFormula_documento* first_formula() { return succ_formula(true); }
TFormula_documento* succ_formula(bool restart = FALSE);
const int ncopie() const { return get_int("I0"); }
bool spese_aut() const { return get_bool("B0"); }

View File

@ -51,6 +51,47 @@ const TFilename& TTipo_documento::profile_name(TFilename& profile) const
return profile;
}
bool TTipo_documento::main_print_profile(TFilename& report) const
{
TString16 base = get("S5");
base.cut(8);
base.trim();
bool ok = base.not_empty();
if (ok)
{
report = base;
report.ext("rep");
ok = report.custom_path();
if (!ok)
{
report = base;
report.ext("frm");
ok = report.custom_path();
}
}
return ok;
}
bool TTipo_documento::additional_print_profile(TFilename& report) const
{
TString16 base = get("S5");
base.ltrim(8); base.rtrim();
bool ok = base.not_empty();
if (ok)
{
report = base;
report.ext("rep");
ok = report.custom_path();
if (!ok)
{
report = base;
report.ext("frm");
ok = report.custom_path();
}
}
return ok;
}
const char TTipo_documento::tipocf() const
{
if (_tipocf < ' ')