From 56722f37731cf022b7f3b36138f6e3bc43f233fa Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 13 Dec 2013 09:18:24 +0000 Subject: [PATCH] Miglioramenti vari postino e report git-svn-id: svn://10.65.10.50/branches/R_10_00@22899 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba0100.cpp | 2 +- ba/ba1700.cpp | 18 +++--- ba/ba2800.cpp | 12 ++-- ba/ba2800a.uml | 7 ++- ba/ba7100.cpp | 158 ++++++++++++++++++++++++++++++++++--------------- ba/ba7100a.uml | 6 +- ba/ba7400.cpp | 54 +++++++++-------- ba/ba8300d.uml | 4 +- ba/ba8301.cpp | 20 ++++--- 9 files changed, 178 insertions(+), 103 deletions(-) diff --git a/ba/ba0100.cpp b/ba/ba0100.cpp index 1be551a86..0806028c4 100755 --- a/ba/ba0100.cpp +++ b/ba/ba0100.cpp @@ -986,7 +986,7 @@ void TMenu_application::test_temp() TFilename dir; dir.tempdir(); // Directory temporanea dir.add("*"); TString_array files; - const int count = list_files(dir, files); + const int count = ::list_files(dir, files); if (count > 0 && yesno_box(TR("Cancellare tutti i file temporanei in %s?"), dir.path())) { diff --git a/ba/ba1700.cpp b/ba/ba1700.cpp index 3b4e8ec07..86fd4313c 100755 --- a/ba/ba1700.cpp +++ b/ba/ba1700.cpp @@ -376,15 +376,15 @@ int TInstaller_mask::precheck_modules(bool only_newer) TString html; html << "" - << "
Attenzione: chiave " << dongle().number() << " non riconosciuta.
\n" - << "

Al fine di poter riattivare la chiave " << dongle().product().before(" ") - << " in oggetto e poter quindi effettuare il download di eventuali aggiornamenti software, " - << "La preghiamo di contattare Sirio informatica e sistemi ai seguenti riferimenti:


" - << "" - << ""; + << "
Attenzione: chiave " << dongle().number() << " non riconosciuta.
\n" + << "

Al fine di poter riattivare la chiave " << dongle().product().before(" ") + << " in oggetto e poter quindi effettuare registrazioni, " + << "La preghiamo di contattare Sirio informatica e sistemi ai seguenti riferimenti:


" + << "" + << ""; error_box(html); } diff --git a/ba/ba2800.cpp b/ba/ba2800.cpp index a5cd63398..1a463ddfd 100644 --- a/ba/ba2800.cpp +++ b/ba/ba2800.cpp @@ -57,6 +57,7 @@ int TOEM_cache::Agente2OEM(int agente) const switch (agente) { case 2: oem = 0; break; // Aga + case 3: oem = 3; break; // Geisoft case 5: oem = 6; break; // Sipag -> Sicuri case 7: oem = 7; break; // Prassi Roma -> Itertec case 8: // Prassi Calabria @@ -64,6 +65,7 @@ int TOEM_cache::Agente2OEM(int agente) const case 10: oem = 6; break; // Socogem -> Sicuri case 11: oem = 7; break; // Itertec case 13: oem = 2; break; // Tetractis + case 14: oem = 9; break; // San Zeno informatica default: oem = 1; break; // Sirio } return oem; @@ -418,9 +420,6 @@ bool Tdninst_mask::load_odbc(TString_array& a) const r.add(_oem.Agente2OEM(agente), _c_dboem); r.add(smart_trim(att.get("RagioneSociale").as_string(), 50), _c_dbowner); - if (atoi(r) == 5160) - int cazzone = 1; - TString16 kill; TString16 stato = att.get("Stato").as_string(); if (stato[0] > 'A') // Non Attivo @@ -522,7 +521,7 @@ bool Tdninst_mask::load_xml(TString_array& a) const TString_array xml; list_files(path, xml); - TString msg; msg.format(FR("Scansione cartella %s: %d files"), (const char*)path, xml.items()); + TString msg; msg.format(FR("Scansione %s: %d files"), (const char*)path, xml.items()); TProgind pi(xml.items(), msg); TFilename fname, tmpname; TFilename tmpdir; tmpdir.tempdir(); tmpdir.add("www"); @@ -1073,9 +1072,10 @@ bool Tdninst_manager::create() return error_box(TR("Utente non abilitato")); const word n = dongle().number(); - // 8453 = Ilaria; 8517 = Sara; 8578 = Monica + // 8453 = Ilaria; 8517 = Sara if (n != 8453 && n != 8517 && !is_power_station() && - get_hostname().compare("nbkgiardini", -1, true) != 0) + get_hostname().compare("nbkgiardini", -1, true) != 0 && + get_hostname().compare("pcpiccolow7", -1, true) != 0) return error_box(TR("Postazione non abilitata")); TSheet_field::set_line_number_width(4); // Numero di chiavette ~ 1000 diff --git a/ba/ba2800a.uml b/ba/ba2800a.uml index 2972dc5d1..757f2f5cd 100644 --- a/ba/ba2800a.uml +++ b/ba/ba2800a.uml @@ -170,9 +170,10 @@ BEGIN ITEM "3|Geisoft" ITEM "4|Tetractis" ITEM "5|Procom" - ITEM "6|Socogem" + ITEM "6|Sicuri" ITEM "7|Itertec" ITEM "8|Metacalabria" + ITEM "9|SanZeno" END TEXT DLG_NULL @@ -211,9 +212,10 @@ BEGIN ITEM "3|Geisoft" ITEM "4|Tetractis" ITEM "5|Procom" - ITEM "6|Socogem" + ITEM "6|Sicuri" ITEM "7|Itertec" ITEM "8|Metacalabria" + ITEM "9|SanZeno" END STRING F_DBOWNER 50 @@ -244,6 +246,7 @@ BEGIN ITEM "6|Socogem" ITEM "7|Itertec" ITEM "8|Metacalabria" + ITEM "9|SanZeno" END STRING F_ATOWNER 50 diff --git a/ba/ba7100.cpp b/ba/ba7100.cpp index c12207e50..4aa0a324d 100755 --- a/ba/ba7100.cpp +++ b/ba/ba7100.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -499,6 +500,7 @@ protected: void track(const TMail_message& msg, const TString& app, const TString& action, int err); bool exec_app(int & err, const TString& appname, TMail_message & msg, TToken_string & sh_row); + void scan_ini_files(const char* dir, TString_array& result, int level) const; void scan_dir(const TFilename& dir, TMail_messages& box) const; bool unattended() const; @@ -508,7 +510,7 @@ public: bool save_sheet_line(int& err, int line = -1); void save_all_lines(); void exec_scripts(); - void auto_save_all(); + void auto_save_all(bool manual); void save() const; void load(); @@ -550,29 +552,26 @@ void TMailer_mask::test_delete() break; } deleted = mailbox.remove(id); - } - else - if (mailer == "CNP") - { - TFilename file; - row->get(sender_pos, file); // Cartella di provenienza - file.add(id); - file.ext("ini"); - file.fremove(); - deleted = true; - } - else - if (mailer == "MAPI") - { - TMail_message* msg = new TMail_message(""); - msg->set_id(id); - mapidel.add(msg); - deleted = true; - } + } else + if (mailer == "CNP") + { + TFilename file; + row->get(sender_pos, file); // Cartella di provenienza + file.add(id); + file.ext("ini"); + deleted = file.fremove(); + } else + if (mailer == "MAPI") + { + TMail_message* msg = new TMail_message(""); + msg->set_id(id); + mapidel.add(msg); + deleted = true; + } if (deleted) { - _box.destroy(nrow); - sf.destroy(nrow); + _box.destroy(nrow, true); + sf.destroy(nrow, false); } else { @@ -593,6 +592,8 @@ void TMailer_mask::test_delete() mapidel.remove(); } + sf.force_update(); + xvtil_statbar_set(TR("Pronto")); do_events(); _mail_semaphore = 0; @@ -633,12 +634,44 @@ void TMailer_mask::expand_tabs(TMail_message& msg, const int tab) const } } +void TMailer_mask::scan_ini_files(const char* dir, TString_array& result, int level) const +{ + TFilename mask = dir; mask.add("*.ini"); + + SLIST files = xvt_fsys_list_files("ini", mask, FALSE); + for (SLIST_ELT e = xvt_slist_get_first(files); e; e = xvt_slist_get_next(files, e)) + { + const char* fn = xvt_slist_get(files, e, NULL); + result.add(fn); + } + xvt_slist_destroy(files); + + if (level == 0) + { + mask = dir; mask.add("*"); + files = xvt_fsys_list_files(DIR_TYPE, mask, TRUE); + const int tot = xvt_slist_count(files); + if (tot > 0) + { + TProgind pi(tot, TR("Elaborazione cartelle transazioni"), true, true); + for (SLIST_ELT e = xvt_slist_get_first(files); e; e = xvt_slist_get_next(files, e)) + { + if (!pi.addstatus(1)) + break; + const char* fn = xvt_slist_get(files, e, NULL); + if (dexist(fn)) + scan_ini_files(fn, result, level+1); + } + } + xvt_slist_destroy(files); + } +} + void TMailer_mask::scan_dir(const TFilename& dir, TMail_messages& box) const { + box.destroy(); TString_array msg; - TFilename mask = dir; - mask.add("*.ini"); - ::list_files(mask, msg); + scan_ini_files(dir, msg, 0); TString subject, text, strdata; TToken_string id(_MAX_FNAME, '_'); @@ -654,24 +687,39 @@ void TMailer_mask::scan_dir(const TFilename& dir, TMail_messages& box) const scanner.read(buffer, size); buffer[size] = '\0'; - subject.cut(0); - int parc = text.find(']'); // fine primo paragrafo - if (parc > 0) + if (text.starts_with("[TRANSACTION]")) // Zucchetti maiuscolo! { - int para = text.find('[', parc+1); - if (para > 0) + const char* maiusc[] = { "[TRANSACTION]", "ACTION=", "FIRM=", "MODE=I", "USER=", "RESULT=", "ERRORMSG=", NULL}; + const char* minusc[] = { "[Transaction]", "Action=", "Firm=", "Mode=A", "User=", "Result=", "Error= ", NULL}; + for (int w = 0; maiusc[w]; w++) { - parc = text.find(']', para+1); - if (parc > 0) - subject = text.sub(para+1, parc); + const int i = text.find(maiusc[w]); + if (i >= 0) + text.overwrite(minusc[w], i); + } + } + + subject.cut(0); + if (text.find("[Transaction]") >= 0) + { + int parc = text.find(']'); // fine primo paragrafo + if (parc > 0) + { + int para = text.find('[', parc+1); + if (para > 0) + { + parc = text.find(']', para+1); + if (parc > 0) + subject = text.sub(para+1, parc); + } } } if (subject.full()) { - xvt_fsys_parse_pathname (*row, NULL, NULL, id.get_buffer(), NULL, NULL); + FILE_SPEC fs; xvt_fsys_convert_str_to_fspec(*row, &fs); - TMail_message* msg = new TMail_message(user(), subject, text, dir); - msg->set_id(id); + TMail_message* msg = new TMail_message(user(), subject, text, fs.dir.path); + msg->set_id(id = fs.name); if (id.items() == 3) // Nome file in formato YYMMDD_HHMMSS_NN.ini { @@ -681,7 +729,12 @@ void TMailer_mask::scan_dir(const TFilename& dir, TMail_messages& box) const msg->set_date_time(data, hhmmss); } else - msg->set_date_time(TDate(TODAY)); + { + const time_t dt = xvt_fsys_get_file_attr(&fs, XVT_FILE_ATTR_MTIME); + const struct tm* t = localtime(&dt); + msg->set_date_time(TDate(t->tm_mday, t->tm_mon, t->tm_year+1900), + t->tm_hour*10000 + t->tm_min*100 + t->tm_sec); + } box.add(msg); } @@ -744,10 +797,10 @@ void TMailer_mask::fill_messages() TSheet_field& sf = sfield(F_MESSAGES); sf.destroy(); TString mess; - for (int m = 0; m < _box.items(); m++) + FOR_EACH_ARRAY_ITEM(_box, m, obj) { TMail_message& msg = _box.msg(m); - TToken_string& row = sf.row(m); + TToken_string& row = sf.row(-1); row.add(msg.sender(), sf.cid2index(F_SENDER)); row.add(msg.date(), sf.cid2index(F_DATE)); const real t = msg.time(); @@ -950,7 +1003,6 @@ bool TMailer_mask::exec_app(int& err, const TString& appname, TMail_message& msg { ofstream outf(tmp); const int items = msg.items(); - bool long_lines = false; TString message; for (int i = 0; i < items; i++) { @@ -1053,7 +1105,7 @@ bool TMailer_mask::save_sheet_line(int& err, int nrow) line.strip_spaces(); if (line.items() == 2) { - subj = line.get(1); + subj = line.get(1); subj.cut(3); if (logic == LF_TABCOM) subj.insert("%"); } @@ -1192,11 +1244,14 @@ void TMailer_mask::find_redundant_messages() TToken_string key1; // Scorro tutti i messaggi non ancora elaborati - FOR_EACH_SHEET_ROW_BACK(sf, nrow, row) if (row->get_char(0) != 'X') + FOR_EACH_SHEET_ROW_BACK(sf, nrow, row) if (row->get_char(0) <= ' ') { row->get(sf.cid2index(F_BODY), body); if (body.find("[Transaction]") < 0) // Scarto i messaggi che non siano transazioni + { + row->add("F", 0); // Messaggio farlocco! continue; + } row->get(sf.cid2index(F_SUBJECT), subj); @@ -1262,12 +1317,16 @@ void TMailer_mask::save_all_lines() const char mark = *row->get(0); if (mark == 'X') - msg << "ignorato in quanto gią elaborato"; - + msg << "ignorato in quanto gią elaborato"; else if (mark == 'R') { msg << "ignorato in quanto ridondante"; row->add("X", 0); // Marcalo come elaborato comunque + } else + if (mark == 'F') + { + msg << "ignorato in quanto in formato errato"; + row->add("X", 0); // Marcalo come elaborato comunque } if (mark <= ' ') @@ -1311,7 +1370,8 @@ void TMailer_mask::save_all_lines() enable(DLG_DELREC); #ifdef DBG - one_saved &= yesno_box("Si desidera eliminare i messaggi processati?"); + if (one_saved) + one_saved = yesno_box("Si desidera eliminare i messaggi processati?"); #endif _mail_semaphore = 0; @@ -1385,7 +1445,7 @@ bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly } else if (e == se_query_add) { - auto_save_all(); + auto_save_all(true); return false; } break; @@ -1509,13 +1569,13 @@ void TMailer_mask::load_sheet(TConfig& ini, short dlg, const char* var) sf.row(r) = ini.get(var, NULL, r); } -void TMailer_mask::auto_save_all() +void TMailer_mask::auto_save_all(bool manual) { if (_mail_semaphore == 0) { TSheet_field& sf = sfield(F_MESSAGES); test_delete(); - if (sf.items() == 0) + if (manual || sf.empty()) fill_messages(); if (_interval > 0 && sf.items() > 0) save_all_lines(); @@ -1547,7 +1607,7 @@ long TMailer_mask::handler(WINDOW win, EVENT* ep) { _secs = 0L; if (_mail_semaphore == 0 && unattended()) - auto_save_all(); + auto_save_all(false); } return 0L; } diff --git a/ba/ba7100a.uml b/ba/ba7100a.uml index dd9639f78..cd609f288 100755 --- a/ba/ba7100a.uml +++ b/ba/ba7100a.uml @@ -199,7 +199,7 @@ BEGIN PROMPT 48 0 "Trasferito" END -STRING F_SENDER 80 66 +STRING F_SENDER 128 60 BEGIN PROMPT 1 2 "Da " FLAGS "D" @@ -217,7 +217,7 @@ BEGIN FLAGS "D" END -STRING F_SUBJECT 256 66 +STRING F_SUBJECT 256 60 BEGIN PROMPT 1 4 "Soggetto " END @@ -245,7 +245,7 @@ TOOLBAR "Topbar" 0 0 0 2 BUTTON DLG_USER 10 2 BEGIN - PROMPT -12 -1 "" + PROMPT -12 -1 "Conferma" PICTURE TOOL_SAVEREC END diff --git a/ba/ba7400.cpp b/ba/ba7400.cpp index 5522b7d45..b0f90832e 100644 --- a/ba/ba7400.cpp +++ b/ba/ba7400.cpp @@ -79,16 +79,15 @@ void TCopia_ini_app::save_ini_var(ostream& out, TConfig& input, const char* key, bool TCopia_ini_app::copy_ini(const TFilename& ini_in, TFilename& ini_out) const { - TFilename tmp_out; tmp_out.tempdir(); - tmp_out.add(ini_out.name()); + TFilename tmp_out; tmp_out.temp("pm", "ini"); + ofstream output(tmp_out); + if (!output) + return false; TConfig input(ini_in, "Transaction"); const TString user = input.get("User"); const TString host = input.get("HostName"); - ofstream output(tmp_out); - if (!output) - return false; TString str; output << "[Transaction]" << endl; @@ -112,7 +111,7 @@ bool TCopia_ini_app::copy_ini(const TFilename& ini_in, TFilename& ini_out) const save_ini_var(output, input, "CODCF", 7); save_ini_var(output, input, "TOTDOC", 0); output << "PROVVIS = 0" << endl; - output << "CODPAG = " << endl; + save_ini_var(output, input, "CODPAG"); save_ini_var(output, input, "CODCAUS"); for (int r = 1; ; r++) @@ -128,8 +127,8 @@ bool TCopia_ini_app::copy_ini(const TFilename& ini_in, TFilename& ini_out) const save_ini_var(output, input, "IMPOSTA", 0); save_ini_var(output, input, "GRUPPO", 2); save_ini_var(output, input, "CONTO", 2); - str.format("%02d%02d%03d", - input.get_int("GRUPPO"), input.get_int("CONTO"), input.get_int("SOTTOCONTO")); + str.format("%02d%02d%03d", input.get_int("GRUPPO"), + input.get_int("CONTO"), input.get_int("SOTTOCONTO")); output << "SOTTOCONTO = " << str << endl; output << "TIPODET = " << endl; } @@ -155,24 +154,31 @@ void TCopia_ini_app::main_loop() } if (ini_in.exist()) { - TFilename ini_out = ini_get_string(CONFIG_DITTA, "ba7", "ForwardTo"); - - int err = 0; - if (ini_out.full()) + const TString& vers = ini_get_string(ini_in, "Transaction", "Version"); + if (vers.full()) // Elabora solo file generati da campo { - const struct tm* n = xvt_time_now(); - TString80 fname; - fname.format("%02d%02d%02d_%02d%02d%02d_0.ini", - n->tm_year%100, n->tm_mon+1, n->tm_mday, - n->tm_hour, n->tm_min, n->tm_sec); - ini_out.add(fname); - if (!copy_ini(ini_in, ini_out)) - err = EACCES; + int err = NOERR; + + TFilename ini_out = ini_get_string(CONFIG_DITTA, "ba7", "ForwardTo"); + if (ini_out.full()) + { + const struct tm* n = xvt_time_now(); + TString80 fname; + fname.format("%02d%02d%02d_%02d%02d%02d_0.ini", + n->tm_year%100, n->tm_mon+1, n->tm_mday, + n->tm_hour, n->tm_min, n->tm_sec); + ini_out.add(fname); + if (!copy_ini(ini_in, ini_out)) + { + xvt_dm_popup_error(TString("Impossibile copiare file in ") << ini_out); + err = EACCES; + } + } + else + err = ENOTDIR; + ini_set_string(ini_in, "Transaction", "Result", err ? "ERROR" : "OK"); + ini_set_int(ini_in, "Transaction", "Error", err); } - else - err = ENOTDIR; - ini_set_string(ini_in, "Transaction", "Result", err ? "ERROR" : "OK"); - ini_set_int(ini_in, "Transaction", "Error", err); } else { diff --git a/ba/ba8300d.uml b/ba/ba8300d.uml index 354b3261e..0fc818d84 100755 --- a/ba/ba8300d.uml +++ b/ba/ba8300d.uml @@ -12,12 +12,12 @@ END BOOLEAN F_PAGE_SPLIT BEGIN - PROMPT 26 1 "Suddividi una pagina su piu' fogli" + PROMPT 26 1 "Suddividi una pagina su pił fogli" END BOOLEAN F_PAGE_MERGE BEGIN - PROMPT 26 2 "Raggruppa piu' pagine in un foglio" + PROMPT 26 2 "Raggruppa pił pagine in un foglio" END BOOLEAN F_FONT_AUTO diff --git a/ba/ba8301.cpp b/ba/ba8301.cpp index 2d15522ca..bd96917dc 100755 --- a/ba/ba8301.cpp +++ b/ba/ba8301.cpp @@ -675,9 +675,6 @@ TReport_base_mask::TReport_base_mask(const char* name, TReport& rep) : TAutomask(name), _report(rep), _font_changed(false), _halign('C'), _valign('C'), _fgcolor(COLOR_BLACK), _bgcolor(COLOR_WHITE) { - // Toglie le sfumature ai mortali - if (!is_power_reseller(true)) - kill_special_pattern(); } /////////////////////////////////////////////////////////// @@ -854,7 +851,7 @@ void TReport_field_mask::set_field(const TReport_field& rf) char str[2] = { rf.type(), '\0' }; set(F_TYPE, str, true); - if (strchr("ELR", rf.type())) + if (strchr("EL", rf.type())) kill_special_pattern(); const TReport_rct& r = rf.get_rect(); @@ -1954,9 +1951,18 @@ void TReport_window::draw_field(const TReport_field& rf) TVariant var; curr_section().report().evaluate(rf.field(), var, _alfafld); const TString& name = var.as_string(); - const TImage* img = _images.image(name); - if (img != NULL && img->ok()) - img->draw(win(), r); + if (name.find(".png") > 0) + { + TFilename n(name); + if (n.custom_path()) + xvt_dwin_draw_image_on_pdf(win(), n, &r); + } + else + { + const TImage* img = _images.image(name); + if (img != NULL && img->ok()) + img->draw(win(), r); + } advanced_draw_rect(r, PAT_HOLLOW, rf.border(), rf.fore_color(), COLOR_INVALID, COLOR_INVALID, 0, off, 0); } break;