From e564c49cef8f1593c589d9863cc9f28e6e51c032 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 4 Nov 2015 14:09:21 +0000 Subject: [PATCH] git-svn-id: svn://10.65.10.50/branches/R_10_00@23130 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba0100.cpp | 2 +- ba/ba0102.cpp | 73 ++++---- ba/ba1102.cpp | 54 +++--- ba/ba1200.cpp | 2 +- ba/ba1500.cpp | 445 +------------------------------------------------ ba/ba1500a.h | 13 -- ba/ba1600.cpp | 2 +- ba/ba1700.cpp | 89 +++++----- ba/ba1701.cpp | 11 +- ba/ba2200.cpp | 6 +- ba/ba2800.cpp | 19 +-- ba/ba8200.cpp | 3 +- ba/batbdet.uml | 8 +- ba/batbiva.h | 1 + ba/batbiva.uml | 16 +- ba/batbnoc.uml | 19 ++- 16 files changed, 164 insertions(+), 599 deletions(-) diff --git a/ba/ba0100.cpp b/ba/ba0100.cpp index 55c0412d6..1cd105459 100755 --- a/ba/ba0100.cpp +++ b/ba/ba0100.cpp @@ -1900,7 +1900,7 @@ TStudy_mask::TStudy_mask() : TAutomask(TR("Scelta studio"), 1, 60, 3) bool TMenu_application::choose_study() { - // Disbilita le voci di personalizzazione + // Disabilita le voci di personalizzazione enable_options_menu(false); TStudy_mask m; diff --git a/ba/ba0102.cpp b/ba/ba0102.cpp index 939e180ed..efc2fb220 100755 --- a/ba/ba0102.cpp +++ b/ba/ba0102.cpp @@ -636,7 +636,7 @@ void TMenulist_window::update() return; // Nothing to draw const bool db = ADVANCED_GRAPHICS; - TImage* img = db ? _images.image(_image_name) : NULL; // Delay time before clearing + TImage* img = db ? _images.image(_image_name) : NULL; if (img != NULL) { @@ -969,57 +969,44 @@ void draw_spider(WINDOW w, int mode, const PNT& mouse) { RCT client; xvt_vobj_get_client_rect(w, &client); - if (client.right > 128 && client.bottom > 64) + const int nRadius = 48; + if (client.right > 2*nRadius && client.bottom > 2*nRadius) { - const PNT p0 = { client.top+64, client.right-64 }; // Centro del ragno + const PNT p0 = { client.top+3*nRadius/2, client.right-3*nRadius/2 }; // Centro dello smile + CBRUSH brush_yellow; brush_yellow.color = COLOR_YELLOW; brush_yellow.pat = PAT_SOLID; + xvt_dwin_set_std_cpen(w, TL_PEN_BLACK); + if (mode & 0x1) { - // Disegno il filo - const PNT p1 = { client.top, p0.h }; - xvt_dwin_set_std_cpen(w, TL_PEN_LTGRAY); - xvt_dwin_draw_set_pos(w, p0); xvt_dwin_draw_line(w, p1); - - // Disegno il corpicino - xvt_dwin_set_std_cpen(w, TL_PEN_BLACK); - xvt_dwin_set_std_cbrush(w, TL_BRUSH_BLACK); - RCT rct; xvt_rect_set(&rct, p0.h-20, p0.v-10, p0.h+20, p0.v+10); + // Disegno la faccina + xvt_dwin_set_cbrush(w, &brush_yellow); + RCT rct; xvt_rect_set(&rct, p0.h-nRadius, p0.v-nRadius, p0.h+nRadius, p0.v+nRadius); xvt_dwin_draw_oval(w, &rct); - - // Disegno le 4 paia di zampette - const int leg = 20; - const int foot = 10; - for (int i = 0; i < 4; i++) - { - PNT p[8]; - p[0].h = rct.left-leg-3*i; p[0].v = rct.bottom-3*i; // Zampa sinistra - p[1].h = p[0].h+foot; p[1].v = p[0].v; - p[2].h = p[0].h; p[2].v = p[0].v-leg-3*i; - p[3] = p0; // Centro del corpo - p[4].h = 2*p0.h-p[2].h; p[4].v = p[2].v; // Zampa destra simmetrica - p[5].h = 2*p0.h-p[1].h; p[5].v = p[1].v; - p[6].h = 2*p0.h-p[0].h; p[6].v = p[0].v; - xvt_dwin_draw_polyline(w, p, 7); - } } if (mode & 0x2) { - const int eye = 7; - const int pupil = 3; + const int eye = nRadius/4; + const int pupil = 2*eye/3; RCT rct; // rettangolo jolly // Disegno gli occhietti - xvt_dwin_set_std_cpen(w, TL_PEN_BLACK); for (int i = 0; i < 2; i++) { // Calcolo il centro dell'occhietto const PNT p1 = { p0.v-eye, i == 0 ? p0.h-(5*eye/4) : p0.h+(5*eye/4) }; // Disegno il bulbo - xvt_rect_set(&rct, p1.h-eye, p1.v-eye, p1.h+eye, p1.v+eye); + xvt_rect_set(&rct, p1.h-eye, p1.v-2*eye, p1.h+eye, p1.v+2*eye); xvt_dwin_set_std_cbrush(w, TL_BRUSH_WHITE); xvt_dwin_draw_oval(w, &rct); // Disegno la pupilla - const int dx = mouse.h <= rct.left ? -pupil : (mouse.h >= rct.right ? +pupil : 0); - const int dy = mouse.v <= rct.top ? -pupil : (mouse.v >= rct.bottom ? +pupil : 0); + const double angle = atan2(double(mouse.v - p1.v), double(mouse.h - p1.h)); + const int mx = eye-pupil+1; int dx = mouse.h - p1.h; + const int my = 2*eye-pupil+1; int dy = mouse.v - p1.v; + if (abs(dx) > mx || abs(dy) > my) + { + dx = int(cos(angle)*mx+0.5); + dy = int(sin(angle)*my+0.5); + } xvt_rect_set(&rct, p1.h-pupil+dx, p1.v-pupil+dy, p1.h+pupil+dx, p1.v+pupil+dy); xvt_dwin_set_std_cbrush(w, TL_BRUSH_BLACK); xvt_dwin_draw_oval(w, &rct); @@ -1028,9 +1015,21 @@ void draw_spider(WINDOW w, int mode, const PNT& mouse) // Disegno la boccuccia aperta se il mouse e' vicino const int dx = mouse.h-p0.h, dy = mouse.v-p0.v; const bool vicino = dx*dx+dy*dy < 65536; - xvt_dwin_set_std_cbrush(w, vicino ? TL_BRUSH_WHITE : TL_BRUSH_BLACK); - xvt_rect_set(&rct, p0.h-eye, p0.v, p0.h+eye, p0.v+eye); - xvt_dwin_draw_oval(w, &rct); + xvt_rect_set(&rct, p0.h-nRadius/2, p0.v+nRadius/4, p0.h+nRadius/2, p0.v+3*nRadius/4); + if (vicino) + { + xvt_dwin_set_std_cbrush(w, TL_BRUSH_BLACK); + xvt_dwin_draw_oval(w, &rct); + } + else + { + const int my = (rct.top + rct.bottom)/2; + xvt_dwin_set_std_cpen(w, TL_PEN_HOLLOW); + xvt_dwin_set_cbrush(w, &brush_yellow); + xvt_dwin_draw_oval(w, &rct); + xvt_dwin_set_std_cpen(w, TL_PEN_BLACK); + xvt_dwin_draw_arc(w, &rct, rct.left, my, rct.right, my); + } // Il puntatore del mouse diventa una mosca vicino al ragno xvt_win_set_cursor(w, vicino ? 8883 : CURSOR_ARROW); diff --git a/ba/ba1102.cpp b/ba/ba1102.cpp index 639bb8ad8..390f31699 100755 --- a/ba/ba1102.cpp +++ b/ba/ba1102.cpp @@ -89,7 +89,9 @@ bool TEdit_file::browse_cursor(TCursor& cursor, const TFilename& fname) } head << '@' << max(len, (int)strlen(n)); if (t == _realfld || t == _intfld || t == _longfld || t == _wordfld || t == _realfld) - head << 'R'; + head << 'R'; else + if (t == _boolfld) + head << 'C'; } const bool superprassi = user() == ::dongle().administrator(); @@ -107,23 +109,20 @@ bool TEdit_file::browse_cursor(TCursor& cursor, const TFilename& fname) if (ch == K_DEL && sheet.one_checked()) { const long checked = sheet.checked(); - if (yesno_box(FR("Si desidera cancellare i %ld record indicati?"), checked)) + if (yesno_box(FR("Cancellare %ld record?"), checked)) { - const long items = sheet.items(); - cursor.freeze(TRUE); - TProgind pi(items, TR("Attendere..."), true, true); - for (TRecnotype j = 0; j < items; j++) + const long items = sheet.items(); + cursor.freeze(); + TProgress_monitor pi(checked, TR("Cancellazione"), true); + for (TRecnotype j = 0; j < items; j++) if (sheet.checked(j)) { - if (!pi.setstatus(j)) + cursor = j; + cursor.file().remove(); + sheet.uncheck(j); + if (!pi.add_status()) break; - if (sheet.checked(j)) - { - cursor = j; - cursor.file().remove(); - sheet.uncheck(j); - } } - cursor.freeze(FALSE); + cursor.freeze(false); } // Forza update del cursore @@ -144,7 +143,7 @@ bool TEdit_file::browse_cursor(TCursor& cursor, const TFilename& fname) edit_record(curr); break; case K_DEL: // delete record - if (yesno_box(TR("Confermare la cancellazione del record"))) + if (delete_box(TR("Confermare la cancellazione del record"))) cursor.file().remove(); break; case K_INS: // insert new record @@ -164,7 +163,7 @@ bool TEdit_file::browse_file(int logicnum, const TFilename& name, const TString& if (logicnum >= LF_USER) { TSystemisamfile test(logicnum); - int err = test.open_ex(); + const int err = test.open_ex(); if (err != NOERR) return error_box(FR("Impossibile aprire il file %d: errore %d"), logicnum, err); test.close(); @@ -200,9 +199,9 @@ public: TEdit_mask::TEdit_mask(int pages) : TMask(TR("Modifica record"), pages, 0, 0, 0, 0) { - add_button_tool(DLG_OK, TR("Registra"), BMP_SAVEREC).set_exit_key(K_ENTER); - add_button_tool(DLG_DELREC, TR("Elimina"), BMP_DELREC).set_exit_key(K_DEL); - add_button_tool(DLG_CANCEL, TR("Annulla"), BMP_CANCEL).set_exit_key(K_ESC); + add_button_tool(DLG_OK, TR("Registra"), BMP_SAVEREC).set_exit_key(K_ENTER); + add_button_tool(DLG_DELREC, TR("Elimina"), BMP_DELREC).set_exit_key(K_DEL); + add_button_tool(DLG_CANCEL, TR("Annulla"), BMP_CANCEL).set_exit_key(K_ESC); if (pages > 1) set_default_tab_buttons(); } @@ -221,6 +220,8 @@ void TEdit_file::edit_record(TRectype& rec) short nid = 100; bool grouped = false; + const int x = 3; + FOR_EACH_ARRAY_ROW(flds, i, row) { // add fields ONE by ONE @@ -242,33 +243,34 @@ void TEdit_file::edit_record(TRectype& rec) switch (rec.type(cp)) { case _alfafld: - m.add_string(nid++,curpage, s, 3, currow, len, "_", len > 50 ? 50 : len); + m.add_string(nid++,curpage, s, x, currow, len, "_", len > 50 ? 50 : len); break; case _intfld: case _longfld: case _wordfld: case _realfld: - m.add_number(nid++, curpage, s, 3, currow, len, "", rec.ndec(cp)); + m.add_number(nid++, curpage, s, x, currow, len, "", rec.ndec(cp)); break; case _datefld: - m.add_date(nid++, curpage, s, 3, currow, ""); + m.add_date(nid++, curpage, s, x, currow, ""); break; case _charfld: - m.add_string(nid++, curpage, s, 3, currow, 1, ""); + m.add_string(nid++, curpage, s, x, currow, 1, ""); break; case _boolfld: - m.add_boolean(nid++, curpage, s, 3, currow, ""); + m.add_boolean(nid++, curpage, s, x, currow, ""); break; case _intzerofld: case _longzerofld: - m.add_number(nid++, curpage, s, 3, currow, len, "Z", 0); + m.add_number(nid++, curpage, s, x, currow, len, "Z", 0); break; case _memofld: - m.add_zoom( nid++, curpage, s, 3, currow, 50, "", 50 ); + m.add_zoom( nid++, curpage, s, x, currow, 50, "", 50 ); break; default: break; } + m.field(nid-1).set(rec.get(cp)); if (((i+1) % fpp) == 0 || i == recs-1) diff --git a/ba/ba1200.cpp b/ba/ba1200.cpp index a8480b379..156c342a9 100755 --- a/ba/ba1200.cpp +++ b/ba/ba1200.cpp @@ -82,7 +82,7 @@ clock_t TTest_application::start_progind(const long items, const char* prompt) clock_t TTest_application::stop_progind() { - clock_t t = clock(); + const clock_t t = clock(); if (_pi != NULL) { delete _pi; diff --git a/ba/ba1500.cpp b/ba/ba1500.cpp index c9c48ba84..bf80852eb 100755 --- a/ba/ba1500.cpp +++ b/ba/ba1500.cpp @@ -198,30 +198,17 @@ protected: virtual bool use_files() const { return false; } virtual bool test_assistance_year() const; - void garble_module(word n, TString& str1, TString& str2) const; - void garble_users(word u, TString& str1, TString& str2) const; - void garble_year(word year, TString& str1, TString& str2) const; - word& serno() { return _serno; } void init_mask(); - void update_listino(); - void load_masklistino(TMask & m); - void save_masklistino(TMask & m); int build_sheet(bool on = true); static void keyext(const TString & s, word * v); static void encode_second_key(); static bool k_notify(TSheet_field& f, int r, KEY k); - static bool change_users_handler(TMask_field&, KEY key); - static bool maxuser_handler(TMask_field& fld, KEY key); - static bool change_assist_handler(TMask_field&, KEY key); - static bool assist_handler(TMask_field& fld, KEY key); static bool print_handler(TMask_field& fld, KEY key); static bool printlist_handler(TMask_field& fld, KEY key); - static bool aggiorna_listino_handler(TMask_field& fld, KEY key); - static bool modifica_listino_handler(TMask_field& fld, KEY key); static bool aga_handler(TMask_field& fld, KEY key); static bool sh_nposti_handler(TMask_field& fld, KEY key); static bool sh_acquisto_handler(TMask_field& fld, KEY key); @@ -231,8 +218,6 @@ protected: bool new_module_requested(); bool dongle_update_needed() const; - void print_request(); - void print_answer(); void print_status(); public: @@ -276,246 +261,9 @@ void TAttivazione_moduli::garble_dongle(word k[4]) const ::dongle().garble(k); } -void TAttivazione_moduli::garble_module(word n, TString& str1, TString& str2) const -{ - const TDate today(_msk->get(F_DT)); - const long val = today.date2julian(); - - word data[4]; - data[0] = word(_msk->get_int(F_SN)); - data[1] = word(val >> 16); - data[2] = n; - data[3] = word(val & 0xFFFF); - garble_dongle(data); - str1.format("%04X%04X", data[0], data[1]); - - str2 = ::dongle().module_code2name(n); - str2.upper(); - str2 = garble_md5(str2); -} - -const TString& TAttivazione_moduli::garble_md5(const char* strin) const -{ - const TDate today(_msk->get(F_DT)); - TString80 chiaro, cifrato; - chiaro.format("%8ld%d%s", today.date2ansi(), _msk->get_int(F_SN), strin); - xvt_str_md5(chiaro, cifrato.get_buffer(32)); - cifrato.upper(); - return cifrato.right(8); -} - -const TString& TAttivazione_moduli::garble_md5(long numin) const -{ - TString16 strin; strin.format("%ld", numin); - return garble_md5(strin); -} - -void TAttivazione_moduli::garble_users(word u, TString& str1, TString& str2) const -{ - const TDate today(_msk->get(F_DT)); - const long val = today.date2julian(); - - word data[4]; - data[0] = u; - data[1] = word(val >> 16); - data[2] = word(_msk->get_int(F_SN)); - data[3] = word(val & 0xFFFF); - garble_dongle(data); - str1.format("%04X%04X", data[0], data[1]); - - str2 = garble_md5(u); -} - -void TAttivazione_moduli::garble_year(word y, TString& str1, TString& str2) const -{ - const TDate today(_msk->get(F_DT)); - const long val = today.date2julian(); - - word data[4]; - data[0] = word(_msk->get_int(F_SN)); - data[1] = word(val >> 16); - data[2] = y; - data[3] = word(val & 0xFFFF); - garble_dongle(data); - str1.format("%04X%04X", data[0], data[1]); - - str2 = garble_md5(y); -} - -bool TAttivazione_moduli::maxuser_handler(TMask_field& fld, KEY key) -{ - bool ok = true; - if (key == K_TAB && !fld.empty()) - { - const int utenti = atoi(fld.get()); - if (utenti > 0 && utenti < 1000) - { - TString8 str1, str2; - app().garble_users(utenti, str1, str2); - fld.mask().set(102, str1); - fld.mask().set(103, str2); - } - } - if (key == K_ENTER) - { - const int utenti = atoi(fld.get()); - if (utenti <= 0 || utenti >= 1000) - ok = fld.error_box(TR("Numero di utenti errato")); - } - return ok; -} - -bool TAttivazione_moduli::change_users_handler(TMask_field& fld, KEY key) -{ - if (key == K_SPACE) - { - TDongle& d = ::dongle(); - if (d.hardware() == _dongle_ssa) - return message_box(TR("E' necessario contattare attivazione_moduli@sirio-is.it")); - - TMask m(TR("Utenti"), 1, 26, 7); - m.add_number(101, 0, PR("Utenti "), 1, 1, 4, "U"); - m.add_string(102, 0, PR("Codice "), 1, 2, 8, "DU"); - - if (d.type() == _user_dongle) - { - m.set(101, d.max_users()); - m.enable(102); - } - else - { - m.set_handler(101, maxuser_handler); - m.add_string(103, 0, PR("WebCod "), 1, 3, 8, "DU"); - } - m.add_button(DLG_OK, 0, "", -12, -1, 10, 2); - m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2); - - if (m.run() == K_ENTER) - { - const int utenti = m.get_int(101); - if (d.type() == _user_dongle) - { - if (utenti > 0 && utenti < 1000) - { - if (m.field(102).empty()) - { - app()._wanted_users = utenti; - if (utenti > 0) - fld.message_box(TR("Premere 'Stampa'\nper richiedere l'attivazione di %d utenti."), - utenti); - } - else - { - TString8 str1, str2; - app().garble_users(utenti, str1, str2); - if ((m.get(102) == str1) || (m.get(102) == str2)) - { - d.set_max_users(utenti); - fld.mask().set(F_USERS, utenti); - } - else - fld.error_box(TR("Codice errato")); - } - } - else - fld.error_box(TR("Numero di utenti errato")); - } - else - app()._wanted_users = utenti; - } - } - return true; -} - -#define YEAR_MIN 2081 +#define YEAR_MIN 2121 #define YEAR_MAX 2777 -bool TAttivazione_moduli::assist_handler(TMask_field& fld, KEY key) -{ - bool ok = true; - if (key == K_TAB && !fld.empty()) - { - const int year = atoi(fld.get()); - if (year >= YEAR_MIN && year <= YEAR_MAX) - { - TString16 str1, str2; - app().garble_year(year, str1, str2); - fld.mask().set(102, str1); - fld.mask().set(103, str2); - } - } - if (key == K_ENTER) - { - const int year = atoi(fld.get()); - if (year < YEAR_MIN || year > YEAR_MAX) - ok = fld.error_box(TR("Anno di assitenza errato")); - } - return ok; -} - -bool TAttivazione_moduli::change_assist_handler(TMask_field& fld, KEY key) -{ - if (key == K_SPACE) - { - TDongle& d = ::dongle(); - - if (d.hardware() == _dongle_ssa) - return message_box(TR("E' necessario contattare attivazione_moduli@sirio-is.it")); - - TMask m(TR("Assistenza"), 1, 26, 9); - m.add_number(101, 0, PR("Anno "), 1, 1, 4, "U"); - m.add_string(102, 0, PR("Codice "), 1, 2, 8, "DU"); - - if (d.type() == _user_dongle) - { - m.set(101, d.year_assist()); - m.enable(102); - } - else - { - m.add_string(103, 0, PR("WebCod "), 1, 3, 8, "DU"); - m.set_handler(101, assist_handler); - } - m.add_button(DLG_OK, 0, "", -12, -1, 10, 2); - m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2); - - if (m.run() == K_ENTER) - { - word year = m.get_int(101); - if (d.type() == _user_dongle) - { - if (year >= YEAR_MIN && year <= YEAR_MAX) - { - if (m.field(102).empty()) - { - app()._wanted_assist = year; - fld.message_box(FR("Premere 'Stampa'\nper richiedere il contratto di assistenza per l'anno %u."), - year); - } - else - { - TString16 str1, str2; - app().garble_year(year, str1, str2); - bool ok = (m.get(102) == str1) || (m.get(102) == str2); - if (ok) - { - d.set_year_assist(year); - fld.mask().set(F_ASSIST, year); - } - else - fld.error_box(TR("Codice errato")); - } - } - else - fld.error_box(TR("Anno errato")); - } - else - app()._wanted_assist = year; - } - } - return true; -} - bool TAttivazione_moduli::print_handler(TMask_field& fld, KEY key) { if (key == K_SPACE) @@ -581,7 +329,6 @@ void TAttivazione_moduli::init_mask() const int nmod = build_sheet(); const TDongle& d = ::dongle(); _msk->set(F_SN, d.number()); - _msk->set(F_DT, oggi); _msk->set(F_USERS, d.max_users()); _msk->set(F_ASSIST, d.year_assist()); } @@ -593,90 +340,6 @@ bool TAttivazione_moduli::k_notify(TSheet_field& f, int r, KEY k) return true; } -void TAttivazione_moduli::print_request() -{ - TRequest_form form("ba1500a"); - TForm_item& num = form.find_field('B', odd_page, 101); - TForm_item& descr = form.find_field('B', odd_page, 102); - TForm_item& codice = form.find_field('B', odd_page, 103); - TForm_item& price = form.find_field('B', odd_page, 104); - TForm_item& manut = form.find_field('B', odd_page, 105); - - TInstall_ini ini; - ini.write_protect(); - - const bool special = _wanted_assist > ::dongle().year_assist() || _wanted_users != 0; - const word users = max(_wanted_users, ::dongle().max_users()); - - TWait_cursor hourglass; - TSheet_field& sheet = _msk->sfield(F_MODULI); - int found = 0; - TString str; - - FOR_EACH_SHEET_ROW(sheet, r, row) - { - const int module = row->get_int(2) ; - const bool active = ::dongle().active(module); - const bool wanted = *row->get(1) > ' '; - - if (!special && active) - continue; - if (!wanted && !active) - continue; - - if (found == 0) - { - printer().open(); - form.find_field('H',odd_page,1).set(dongle().reseller()); - form.update_serno(_msk->get(F_SN)); - form.update_dongle(); - form.update_os(); - } - - str.format("%3d", ++found); - num.set(str); - - str = row->get(0); - descr.set(str); - - str = active ? TR("*ATTIVO*") : ""; - codice.set(str); - - form.print(-1); - } - - if (special && found > 0) - { - codice.set(""); - price.set(""); - manut.set(""); - if (_wanted_users != 0) - { - str.format("%3d", ++found); - num.set(str); - - str.format(FR("Variazione del numero utenti da %u a %u"), - ::dongle().max_users(), _wanted_users); - descr.set(str); - form.print(-1); - } - if (_wanted_assist > ::dongle().year_assist()) - { - str.format("%3d", ++found); - num.set(str); - str.format(FR("Contratto di assistenza per l'anno %u"), _wanted_assist); - descr.set(str); - form.print(-1); - } - } - - if (found) - { - form.print_footer(); - printer().close(); - } -} - void TAttivazione_moduli::print_status() { TRequest_form form("ba1500a"); @@ -708,113 +371,10 @@ void TAttivazione_moduli::print_status() printer().close(); } -void TAttivazione_moduli::print_answer() -{ - TString str; - int found = 0; - - TRequest_form form("ba1500a"); - TForm_item& num = form.find_field('B', odd_page, 101); - TForm_item& descr = form.find_field('B', odd_page, 102); - TForm_item& codice = form.find_field('B', odd_page, 103); - - TSheet_field& sheet = _msk->sfield(F_MODULI); - FOR_EACH_SHEET_ROW(sheet, r, row) if (*row->get(1) > ' ') - { - const int module = _im->get_module_by_order(r); - if (module != BAAUT) - { - if (found == 0) - { - printer().open(); - form.update_serno(_msk->get(F_SN)); - form.update_dongle(); - form.update_os(); - } - - str.format("%3d", ++found); - num.set(str); - - str = row->get(0); - descr.set(str); - - str = row->get(3); - codice.set(str); - - form.print(-1); - } - } - - if (_wanted_users != 0 || _wanted_assist != 0) - { - if (found == 0) - { - printer().open(); - form.update_serno(_msk->get(F_SN)); - form.update_dongle(); - } - if (_wanted_users != 0) - { - str.format("%3d", ++found); - num.set(str); - str.format(FR("Variazione del numero utenti da %u a %u"), - ::dongle().max_users(), _wanted_users); - descr.set(str); - TString8 str1, str2; - garble_users(_wanted_users, str1, str2); - codice.set(str1); - form.print(-1); - } - if (_wanted_assist != 0) - { - str.format("%3d", ++found); - num.set(str); - str.format(FR("Contratto di assistenza per l'anno %u"), _wanted_assist); - descr.set(str); - TString8 str1, str2; - garble_year(_wanted_assist, str1, str2); - codice.set(str1); - form.print(-1); - } - } - - if (found) - { - form.print_footer(); - printer().close(); - } -} - -bool TAttivazione_moduli::new_module_requested() -{ - TSheet_field& sheet = _msk->sfield(F_MODULI); - bool found = false; - FOR_EACH_SHEET_ROW(sheet, r, row) - { - if (*row->get(1) > ' ') // Wanted! - { - const int module = row->get_int(2); - if (!::dongle().active(module)) // Not active yet? - { - found = true; - break; - } - } - } - return found; -} void TAttivazione_moduli::print() { - if (::dongle().type() == _user_dongle) - { - if (new_module_requested()) - print_request(); - else - print_status(); - } - else - print_answer(); + print_status(); } // Questo programma non deve bloccarsi per l'anno di assistenza! @@ -877,6 +437,7 @@ bool TAttivazione_moduli::destroy() void TAttivazione_moduli::main_loop() { + init_mask(); _msk->run(); } diff --git a/ba/ba1500a.h b/ba/ba1500a.h index aa822f5dc..732e33f64 100755 --- a/ba/ba1500a.h +++ b/ba/ba1500a.h @@ -1,22 +1,9 @@ -/* -#define F_K1 201 -#define F_K2 202 -#define F_K3 206 -#define F_K4 207 -*/ #define F_SN 211 -#define F_DT 212 #define F_MODULI 213 #define F_USERS 214 #define F_ASSIST 216 #define F_PRINT 218 -/* -#define F_AGGLISTINO 220 -#define F_MODLISTINO 221 -#define F_PRINTLIST 222 -*/ - #define F_NOMEMOD 101 #define F_ENABLE 102 #define F_CODE 103 diff --git a/ba/ba1600.cpp b/ba/ba1600.cpp index 5bafde539..7c921ed69 100755 --- a/ba/ba1600.cpp +++ b/ba/ba1600.cpp @@ -2247,6 +2247,6 @@ int ba1600(int argc, char* argv[]) app.run(argc, argv, TR("Creazione Patch")); } else - error_box(FR("L'utente %s non e' abilitato all'esecuzione di questo programma"), (const char*)user()); + cantaccess_box(TR("questo programma")); return 0; } diff --git a/ba/ba1700.cpp b/ba/ba1700.cpp index f5cb04e45..7f0b94818 100755 --- a/ba/ba1700.cpp +++ b/ba/ba1700.cpp @@ -208,6 +208,12 @@ bool TInstaller_mask::add_module(TConfig& ini, const TString& module, bool patch // Nasconde i moduli riservati da occhi indiscreti if (!is_visible_patch(ini)) return false; + + int year,v,t,p; + main_app().get_version_info(year,v,t,p); + const int anno = ini.get_int("Versione")/10000; + if (anno < year) + return false; const int numpatch = ini.get_int("Patch"); TString4 strpatch; @@ -259,7 +265,7 @@ bool TInstaller_mask::should_precheck_module(int modnumber) const //..alle varie installazioni client, e quindi basta checkare i moduli sulla chiave come per qualsiasi.. //..altra installazione const TDongle& d = dongle(); - if (station_type() == 2 && d.hardware() != _dongle_network) + if (station_type() == 2 && !d.network()) { //se sei un server hai tutti i moduli da installare ok = d.shown(modnumber); @@ -272,7 +278,7 @@ bool TInstaller_mask::should_precheck_module(int modnumber) const { switch (modnumber) { - case CAAUT: ok = d.active(CMAUT); break; // Se non hai l'analitica ritenta con le commesse + case CAAUT: ok = d.active(CMAUT) || d.active(CIAUT); break; // Se non hai l'analitica ritenta con le commesse case TPAUT: ok = d.active(DCAUT); break; // Se non hai Pack ritenta con il CONAI default: break; } @@ -287,7 +293,7 @@ bool TInstaller_mask::should_precheck_module(int modnumber) const int TInstaller_mask::test_station_type() const { const int type = ini_get_int(CONFIG_INSTALL, "Main", "Type", 1); - return type; + return type; // 1=Local; 2=Server; 3=Client } int TInstaller_mask::precheck_modules(bool only_newer) @@ -373,7 +379,6 @@ int TInstaller_mask::precheck_modules(bool only_newer) return items(); } - int TInstaller_mask::get_module_number(const TString& module) const { int aut = -1; @@ -437,7 +442,7 @@ bool TInstaller_mask::autoload() if (internet) { if (!(xvt_net_get_status() & 0x4)) //la connessione web funziona?... - return warning_box("Impossibile connettersi al sito con gli aggiornamenti\nVerificare che la connessione Internet sia attiva !"); + return warning_box("Impossibile connettersi al sito degli aggiornamenti\nVerificare che la connessione Internet sia attiva !"); parse_internet_path(http_server, http_path); //controlla il path internet scritto nel campo sulla maschera @@ -543,45 +548,41 @@ bool TInstaller_mask::autoload() { { TProgress_monitor pi(1, TR("Controllo lista aggiornamenti"), false); // progind NON bloccabile: causa errore impossibile! - http_dir(http_server, http_path, modules); + TFilename pattern = http_path; pattern.add("*a.ini"); + http_dir(http_server, pattern, modules); } + TProgress_monitor pi(modules.items(), TR("Download lista aggiornamenti")); for (int i = modules.last(); i >= 0; i--) { TString& str = modules.row(i); - if (str.ends_with("a.ini", true)) + /* Triste nescessita': si rischia di non caricare nessuna patch + const TString& module = str.left(2); + const int patch = atoi(str.mid(2, 4)); + const int mypatch = ini_get_int(CONFIG_GENERAL, module, "Patch"); + if (patch > 0 && patch < mypatch) { - /* Triste nescessita': si rischia di non caricare nessuna patch - const TString& module = str.left(2); - const int patch = atoi(str.mid(2, 4)); - const int mypatch = ini_get_int(CONFIG_GENERAL, module, "Patch"); - if (patch > 0 && patch < mypatch) - { - modules.destroy(i); - continue; // Non fare il download delle patch inutili - } - */ - - TFilename remote = http_path; - remote << str; - - ininame = path; - ininame.add(str); - - if (!ininame.exist() && !http_get(http_server, remote, ininame)) - { - error_box(FR("Errore di trasferimento del file %s"), (const char*)remote); - modules.destroy(i); - } - str = ininame; - } - else modules.destroy(i); + continue; // Non fare il download delle patch inutili + } + */ + + TFilename remote = http_path; + remote << str; + + ininame = path; + ininame.add(str); + + if (!ininame.exist() && !http_get(http_server, remote, ininame)) + { + cantread_box(remote); + modules.destroy(i, true); + } + str = ininame; if (!pi.add_status()) break; } - modules.pack(); } else //normal patches { @@ -669,11 +670,11 @@ bool TInstaller_mask::autoload() add_module(ini, module, true); } update_version(); + enable(F_INSTALL, !modules.empty()); + const bool ok = precheck_modules() > 0; - if (!ok) - error_box(FR("Non e' stato trovato nessun modulo da installare\nin %s"), (const char*)path); - + error_box(FR("Non ci sono moduli da installare nella cartella\n%s"), (const char*)path); return ok; } @@ -1788,7 +1789,7 @@ bool TInstaller_mask::on_key(KEY key) bool TInstaller_mask::is_program_dir(const TFilename& path) { //controlla l'esistenza di alcuni files chiave di campo - const char* const essential[] = {"install.ini", "campo.ini", "campo.aut", "ba0.exe", "ba1.exe", "xvaga.dll", NULL }; + const char* const essential[] = { "install.ini", "campo.ini", "campo.aut", "ba0.exe", "ba1.exe", "xvaga.dll", NULL }; bool ok = true; for (int i = 0; ok && essential[i]; i++) { @@ -1839,7 +1840,7 @@ TInstaller_mask::TInstaller_mask() rf.disable(); bool ko = !is_program_dir(path); if (ko) - warning_box(TR("La cartella origine dei programmi NON è valida!\nSelezionarne una valida e premere 'Invio'.")); + error_box(TR("La cartella origine dei programmi NON è valida!")); enable(F_PATH, ko); } @@ -1862,24 +1863,28 @@ TInstaller_mask::TInstaller_mask() //decide quale e' il percorso di installazione //ha un cd o un disco di rete -> si aggiorna da questo... + disable(F_INSTALL); // Non posso premerlo in assenza di moduli if (path.exist()) { if (efield(F_PATH).active() || _station_type == 3) // Per i client è obbligatorio installare da disco + { autoload(); + enable(F_INSTALL, one_checked()); + } } else //senno' cerca su internet se trova un path internet completo e la connessione funzionante { if (_station_type != 3 && webpath.find("//") > 0) { set(F_TYPE, "1", 0x1); - //autoload(); // Niente autoload! + //autoload(); // Niente più autoload! } } - DIRECTORY dir; - xvt_fsys_get_dir(&dir); + DIRECTORY dir; xvt_fsys_get_dir(&dir); xvt_fsys_convert_dir_to_str(&dir, path.get_buffer(), path.size()); set(F_CURPATH, path); + } TInstaller_mask::~TInstaller_mask() @@ -1927,7 +1932,7 @@ bool TInstaller::create() else //se e' standalone o server... { if (user() != ::dongle().administrator()) - return error_box(TR("Solo l'amministratore puo' aggiornare questa postazione!")); + return cantaccess_box(NULL); } return TSkeleton_application::create(); diff --git a/ba/ba1701.cpp b/ba/ba1701.cpp index 0365fc03d..21991bee7 100644 --- a/ba/ba1701.cpp +++ b/ba/ba1701.cpp @@ -1,26 +1,27 @@ #include "ba1701.h" #define WIN32_LEAN_AND_MEAN +#define STRICT #include bool run_as_admin() { bool yes = true; - TOKEN_ELEVATION_TYPE elevationType = (TOKEN_ELEVATION_TYPE)0; // N/A for < Vista - OSVERSIONINFO VerInfo = { 0 }; - VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + OSVERSIONINFO VerInfo = { 0 }; VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); ::GetVersionEx(&VerInfo); if (VerInfo.dwMajorVersion >= 6) // If Vista or newer, { HANDLE hToken = NULL; // read elevation type - BOOL bOK = ::OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken); + BOOL bOK = ::OpenProcessToken(::GetCurrentProcess(), TOKEN_READ, &hToken); if (bOK) { - DWORD infoLen; + TOKEN_ELEVATION_TYPE elevationType = (TOKEN_ELEVATION_TYPE)0; // N/A for < Vista + DWORD infoLen = 0; yes = ::GetTokenInformation(hToken, TokenElevationType, // type of info to retrieve &elevationType, // receives return value sizeof(elevationType), &infoLen) != 0; // receives returned length + ::CloseHandle(hToken); } } return yes; diff --git a/ba/ba2200.cpp b/ba/ba2200.cpp index 1cebda525..01a43847d 100755 --- a/ba/ba2200.cpp +++ b/ba/ba2200.cpp @@ -201,11 +201,11 @@ bool TArchive_app::split_file(const TFilename& archive, unsigned long max_chunk) int disk = 0; unsigned long scritti = 0; - FILE* i = fopen(archive, "rb"); + FILE* i = NULL; fopen_s(&i, archive, "rb"); if (i == NULL) return FALSE; - FILE* o = fopen(output, "wb"); + FILE* o = NULL; fopen_s(&o, output, "wb"); const int BUFSIZE = 1024*16; TString buf(BUFSIZE); @@ -225,7 +225,7 @@ bool TArchive_app::split_file(const TFilename& archive, unsigned long max_chunk) TString4 ext; ext.format("z%02d", ++disk); output.ext(ext); - o = fopen(output, "wb"); + fopen_s(&o, output, "wb"); scritti = 0; } diff --git a/ba/ba2800.cpp b/ba/ba2800.cpp index ad8cadba5..755a5a6ce 100644 --- a/ba/ba2800.cpp +++ b/ba/ba2800.cpp @@ -418,10 +418,10 @@ bool Tdninst_mask::load_odbc(TString_array& a) const << "\nORDER BY Codice"; TODBC_recordset att(query); - TProgind pi(att.items(), dsn); + TProgress_monitor pi(att.items(), dsn); for (bool ok = att.move_first(); ok; ok = att.move_next()) { - if (!pi.addstatus(1)) break; + if (!pi.add_status()) break; const int key = att.get("Codice").as_int(); if (key > 0) @@ -533,12 +533,12 @@ bool Tdninst_mask::load_xml(TString_array& a) const list_files(path, xml); TString msg; msg.format(FR("Scansione %s: %d files"), (const char*)path, xml.items()); - TProgind pi(xml.items(), msg); + TProgress_monitor pi(xml.items(), msg); TFilename fname, tmpname; TFilename tmpdir; tmpdir.tempdir(); tmpdir.add("www"); FOR_EACH_ARRAY_ROW(xml, r, row) { - if (!pi.addstatus(1)) break; + if (!pi.add_status()) break; fname = *row; const TString& n = fname.name_only(); const int sn = atoi(n); @@ -1120,15 +1120,8 @@ protected: bool Tdninst_manager::create() { - if (user() != dongle().administrator()) - return error_box(TR("Utente non abilitato")); - - const TString& host = get_hostname(); - if (!is_power_station() && - !host.ends_with("giardini", true) && - host.compare("pccopw7", -1, true) != 0 && - host.compare("pcpiccolow7", -1, true) != 0) - return error_box(FR("Postazione %s non abilitata"), (const char*)host); + if (user().compare(dongle().administrator(),-1,true) || !has_module(GDAUT)) + return cantaccess_box(title()); TSheet_field::set_line_number_width(4); // Numero di chiavette ~ 1000 diff --git a/ba/ba8200.cpp b/ba/ba8200.cpp index a799b4216..01ac09fbb 100755 --- a/ba/ba8200.cpp +++ b/ba/ba8200.cpp @@ -877,7 +877,8 @@ TRecordset* TQuery_mask::new_recordset() const if (rex != NULL && rex->items() == 0) { - warning_box(TR("Nessuna riga risultato")); + if (sql.starts_with("USE ", true) || sql.find("SELECT ")>=0) + warning_box(TR("Nessuna riga risultato")); delete rex; rex = NULL; } diff --git a/ba/batbdet.uml b/ba/batbdet.uml index 813dfdea6..dd8341836 100755 --- a/ba/batbdet.uml +++ b/ba/batbdet.uml @@ -4,11 +4,11 @@ TOOLBAR "topbar" 0 0 0 2 #include ENDPAGE -PAGE "Codici Indetrabilita'" -1 -1 78 15 +PAGE "Codici Indetrabilità" -1 -1 78 15 GROUPBOX DLG_NULL 78 3 BEGIN - PROMPT 1 1 "Codice Indetrabilita'" + PROMPT 1 1 "Codice Indetrabilità" END STRING F_CODICE 1 @@ -49,7 +49,7 @@ END STRING F_TIPO 1 BEGIN PROMPT 2 6 "Tipo " - SHEET "Codice|Tipo indetraibilita'@75" + SHEET "Codice|Tipo indetraibilità@75" INPUT F_TIPO ITEM "1|IVA indetraibile su acquisti riferiti a ricavi esenti" ITEM "3|IVA indicata per passaggi interni al solo fine del calcolo di ventilazione" @@ -68,7 +68,7 @@ END NUMBER F_PERC 6 2 BEGIN - PROMPT 2 7 "% d'indetraibilita' " + PROMPT 2 7 "% d'indetraibilità " NUM_EXPR #F_PERC<=100 WARNING "Percentuale non valida" FLAGS "U" diff --git a/ba/batbiva.h b/ba/batbiva.h index c083a73ea..40f295e77 100755 --- a/ba/batbiva.h +++ b/ba/batbiva.h @@ -22,3 +22,4 @@ #define FLD_DETRAZIONE 123 #define CHK_SERVIZI 124 #define FLD_DESCR_I1 125 +#define FLD_INDET_S4 126 diff --git a/ba/batbiva.uml b/ba/batbiva.uml index a9e9c5f84..6ddc98d54 100755 --- a/ba/batbiva.uml +++ b/ba/batbiva.uml @@ -130,6 +130,20 @@ BEGIN CHECKTYPE NORMAL END +STRING FLD_INDET_S4 1 +BEGIN + PROMPT 2 5 "Codice indetraibilità " + USE %DET + INPUT CODTAB FLD_INDET_S4 + DISPLAY "Codice" CODTAB + DISPLAY "Tipo" I0 + DISPLAY "Percentuale@R" R0 + DISPLAY "Descrizione@50" S0 + OUTPUT FLD_INDET_S4 CODTAB + CHECKTYPE NORMAL + FIELD S4 +END + GROUPBOX DLG_NULL 78 4 BEGIN PROMPT 1 6 "@bComunicazione operazioni rilevanti ai fini dell'IVA (Spesometro)" @@ -242,7 +256,7 @@ END LIST LST_TABIVA_S4 1 43 BEGIN PROMPT 3 15 "Regime agricolo " - FIELD S4 + FIELD I4 HELP "Indicare il tipo di gestione per regime agricolo" ITEM " |Regime normale" ITEM "1|Vendite regime agricolo" diff --git a/ba/batbnoc.uml b/ba/batbnoc.uml index 0ba617423..e2fe6e850 100755 --- a/ba/batbnoc.uml +++ b/ba/batbnoc.uml @@ -4,11 +4,11 @@ TOOLBAR "topbar" 0 0 0 2 #include ENDPAGE -PAGE "Nomenclatura Combinata" -1 -1 78 18 +PAGE "Nomenclatura Combinata INTRA" 0 2 0 0 GROUPBOX DLG_NULL 78 7 BEGIN - PROMPT 1 1 "@bCodice Nomenclatura" + PROMPT 1 1 "@bNomenclatura Combinata" END NUMBER NOC_CODICE1 4 @@ -43,12 +43,13 @@ BEGIN VALIDATE REQIF_FUNC 1 NOC_CODICE3 END -NUMBER NOC_CODICE3 2 +STRING NOC_CODICE3 2 BEGIN PROMPT 26 3 "" - FLAGS "Z" COPY ALL NOC_CODICE1 FIELD CODTAB[7,8] + CHECKTYPE NORMAL + VALIDATE FIXLEN_FUNC 2 KEY 1 END @@ -65,18 +66,18 @@ BEGIN CHECKTYPE REQUIRED FIELD S0 KEY 2 -ENDPAGE +END GROUPBOX DLG_NULL 78 7 BEGIN - PROMPT 1 8 "@bUnita' di misura supplementare" + PROMPT 1 8 "@bUnità di misura supplementare" FLAGS "R" GROUP 1 END LIST NOC_UMS_OBB 1 50 BEGIN - PROMPT 2 10 "Obbligatorieta' " + PROMPT 2 10 "Obbligatorietà " ITEM " |Non obbligatoria" MESSAGE NORMAL,NOC_UMS_CODICE ITEM "A|Obbligatoria per acquisti" @@ -91,7 +92,7 @@ END STRING NOC_UMS_CODICE 2 BEGIN - PROMPT 2 12 "Unita' " + PROMPT 2 12 "Unità " USE %UMS FLAGS "U" INPUT CODTAB NOC_UMS_CODICE @@ -100,7 +101,7 @@ BEGIN OUTPUT NOC_UMS_CODICE CODTAB OUTPUT NOC_UMS_DESCR S0 CHECKTYPE NORMAL - WARNING "Inserire l'unita` di misura obbligatoria" + WARNING "Inserire l'unità di misura obbligatoria" FIELD S5 GROUP 1 END