git-svn-id: svn://10.65.10.50/branches/R_10_00@23110 c028cbd2-c16b-5b4b-a496-9718f37d4682

This commit is contained in:
guy 2015-06-17 07:13:32 +00:00
parent c8927bedaf
commit 9c648a2557
15 changed files with 160 additions and 375 deletions

View File

@ -84,6 +84,7 @@ protected:
void update_preferred(); void update_preferred();
void add_to_preferred(); void add_to_preferred();
void manage_preferred(); void manage_preferred();
void manage_mail();
bool dongle_update_needed() const; bool dongle_update_needed() const;
bool test_programs(); bool test_programs();
@ -1493,9 +1494,9 @@ bool TMenu_application::dongle_update_needed() const
if (remote_name.exist()) if (remote_name.exist())
{ {
const long remote_date = xvt_fsys_file_attr(remote_name, XVT_FILE_ATTR_MTIME); const long remote_date = xvt_fsys_file_attr(remote_name, XVT_FILE_ATTR_MTIME);
const long local_date = xvt_fsys_file_attr(local_name, XVT_FILE_ATTR_MTIME); const long local_date = xvt_fsys_file_attr(local_name, XVT_FILE_ATTR_MTIME);
if (remote_date > local_date) if (remote_date > local_date)
::fcopy(remote_name, local_name); xvt_fsys_fcopy(remote_name, local_name);
} }
} }
Tdninst dninst; // file aggiornatissimo ormai ... Tdninst dninst; // file aggiornatissimo ormai ...
@ -1515,7 +1516,7 @@ bool TMenu_application::user_create()
if (dongle().type() == _no_dongle) if (dongle().type() == _no_dongle)
{ {
if (!yesno_box(TR("ATTENZIONE\nQuesto programma è in versione dimostrativa.\n" if (!yesno_box(TR("ATTENZIONE\nQuesto programma è in versione dimostrativa.\n"
"Esso funzionera' con alcune limitazioni sulle registrazioni.\n" "Esso funzionerà con alcune limitazioni sulle registrazioni.\n"
"Si desidera proseguire?"))) "Si desidera proseguire?")))
return false; return false;
} }
@ -2264,6 +2265,20 @@ void TMenu_application::manage_preferred()
delete m; delete m;
} }
void TMenu_application::manage_mail()
{
TMask m("ba0100m");
TConfig cfg(CONFIG_USER, "Mail");
FOR_EACH_MASK_FIELD(m, i, f) if (f->field())
f->set(f->field()->read(cfg, "Mail"));
if (m.run() == K_ENTER)
{
FOR_EACH_MASK_FIELD(m, i, f) if (f->field())
f->field()->write(cfg, "Mail", f->get());
}
}
/* Deprecated /* Deprecated
int TMenu_application::do_tree() int TMenu_application::do_tree()
{ {
@ -2360,6 +2375,7 @@ bool TMenu_application::menu(MENU_TAG mt)
if (check_user()) if (check_user())
_mask->stop_run(K_CTRL + 'R'); // Ricarica maschera _mask->stop_run(K_CTRL + 'R'); // Ricarica maschera
break; break;
case MENU_ITEM_ID(8): manage_mail(); break;
default: default:
if (mt >= MENU_ITEM_ID(50) && mt < MENU_ITEM_ID(50+_preferred.items())) if (mt >= MENU_ITEM_ID(50) && mt < MENU_ITEM_ID(50+_preferred.items()))
{ {

View File

@ -1,5 +1,4 @@
#include <config.h> #include <config.h>
#include <controls.h>
#include <diction.h> #include <diction.h>
#include <prefix.h> #include <prefix.h>
#include <toolfld.h> #include <toolfld.h>

View File

@ -202,12 +202,17 @@ bool save_campo_xml()
chiavetta.SetAttr("Update", d.last_update().string()); chiavetta.SetAttr("Update", d.last_update().string());
switch (d.hardware()) switch (d.hardware())
{ {
case _dongle_hardlock: chiavetta.SetAttr("Model", "Hardlock"); break; case _dongle_network:
case _dongle_eutron : chiavetta.SetAttr("Model", "Eutron"); break; case _dongle_ssanet:
case _dongle_network : chiavetta.SetAttr("Model", "Network server"); chiavetta.SetAttr("Model", "Network server");
chiavetta.SetAttr("Server", d.server_name()); chiavetta.SetAttr("Server", d.server_name());
break; break;
default: chiavetta.SetAttr("Model", "Unknown"); break; case _dongle_ssa :
chiavetta.SetAttr("Model", "SSA");
break;
default:
chiavetta.SetAttr("Model", "Unknown");
break;
} }
TConfig ini("install.ini", "Main"); TConfig ini("install.ini", "Main");

View File

@ -15,12 +15,12 @@ public:
TProfiler_mask(); TProfiler_mask();
}; };
TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 15) TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 20)
{ {
add_button_tool(DLG_OK, PR("Elabora"), TOOL_ELABORA); add_button_tool(DLG_OK, PR("Elabora"), TOOL_ELABORA);
add_button_tool(DLG_INFO, PR("Info"), TOOL_INFO); add_button_tool(DLG_INFO, PR("Info"), TOOL_INFO);
add_button_tool(DLG_HELP, PR("Help"), TOOL_HELP); add_button_tool(DLG_HELP, PR("Help"), TOOL_HELP);
add_button_tool(DLG_QUIT, "", TOOL_QUIT); add_button_tool(DLG_QUIT, "", TOOL_QUIT);
TToken_string codes, items; TToken_string codes, items;
codes.add(0); items.add(TR("Tutti i test")); codes.add(0); items.add(TR("Tutti i test"));
@ -31,8 +31,8 @@ TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 15)
codes.add(5); items.add(TR("Lettura causale senza cache")); codes.add(5); items.add(TR("Lettura causale senza cache"));
codes.add(6); items.add(TR("Creazione e cancellazione records")); codes.add(6); items.add(TR("Creazione e cancellazione records"));
codes.add(7); items.add(TR("Creazione e cancellazione records in modo esclusivo")); codes.add(7); items.add(TR("Creazione e cancellazione records in modo esclusivo"));
add_radio(101, 0, TR("@bSelezione test"), 1, 1, 58, codes, items); add_radio (101, 0, TR("@bSelezione test"), 1, 1, 58, codes, items);
add_number(102, 0, PR("Numero di iterazioni"), 1, 0, 3, "U"); add_number(102, 0, PR("Numero di iterazioni"), 1, 0, 3, "U");
} }
@ -42,7 +42,7 @@ TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 15)
class TTest_application : public TSkeleton_application class TTest_application : public TSkeleton_application
{ {
TProgind* _pi; TProgress_monitor* _pi;
clock_t start_timer() const; clock_t start_timer() const;
@ -76,7 +76,7 @@ clock_t TTest_application::start_timer() const
clock_t TTest_application::start_progind(const long items, const char* prompt) clock_t TTest_application::start_progind(const long items, const char* prompt)
{ {
CHECK(_pi == NULL, "Double progress indicator"); CHECK(_pi == NULL, "Double progress indicator");
_pi = new TProgind(items, prompt, true, true); _pi = new TProgress_monitor(items, prompt, true);
return start_timer(); return start_timer();
} }
@ -110,7 +110,7 @@ bool TTest_application::test1(TLog_report& log)
msg.format(FR("%ld records %ld msec"), r, clock() - start); msg.format(FR("%ld records %ld msec"), r, clock() - start);
_pi->set_text(msg); _pi->set_text(msg);
if (!_pi->addstatus(1)) if (!_pi->add_status())
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;
@ -140,7 +140,7 @@ bool TTest_application::test2(TLog_report& log)
TString80 msg; TString80 msg;
{ {
const int times = 10; const int times = 10;
TProgind p(times, TR("Lettura cursore comuni"), TRUE, TRUE); TProgress_monitor p(times, TR("Lettura cursore comuni"));
start = start_timer(); start = start_timer();
for (int i = 0; i < times; i++) for (int i = 0; i < times; i++)
{ {
@ -149,7 +149,7 @@ bool TTest_application::test2(TLog_report& log)
msg.format("Lettura cursore comuni\n%ld records %ld msec", r, clock() - start); msg.format("Lettura cursore comuni\n%ld records %ld msec", r, clock() - start);
p.set_text(msg); p.set_text(msg);
if (!p.addstatus(1)) if (!p.add_status())
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;
@ -181,7 +181,7 @@ bool TTest_application::test3(TLog_report& log)
TString256 msg; TString256 msg;
{ {
const int times = 10; const int times = 10;
TProgind p(times, TR("Lettura cursore C.A.P."), TRUE, TRUE); TProgress_monitor p(times, TR("Lettura cursore C.A.P."));
start = start_timer(); start = start_timer();
for (int i = 0; i < times; i++) for (int i = 0; i < times; i++)
{ {
@ -216,23 +216,23 @@ bool TTest_application::test4(TLog_report& log)
clock_t start; clock_t start;
{ {
const int times = 10; const int times = 10;
TProgind p(times, TR("Lettura casuale tramite cache"), TRUE, TRUE); TProgress_monitor p(times, TR("Lettura casuale tramite cache"));
cache().get(LF_COMUNI, cod); // Inizializzazione cache().get(LF_COMUNI, cod); // Inizializzazione
start = start_timer(); start = start_timer();
for (int i = 0; i < times; i++) for (int i = 0; i < times; i++)
{ {
if (!p.addstatus(1))
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
break;
}
for (long j = 0; j < 10000; j++) for (long j = 0; j < 10000; j++)
{ {
const int rn = rand(); const int rn = rand();
cod.format(" |%c%03d", 'A'+(rn%2), rn % 1000); cod.format(" |%c%03d", 'A'+(rn%2), rn % 1000);
cache().get(LF_COMUNI, cod); cache().get(LF_COMUNI, cod);
r++; r++;
}
if (!p.add_status())
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
break;
} }
} }
} }
@ -255,17 +255,11 @@ bool TTest_application::test5(TLog_report& log)
clock_t start; clock_t start;
{ {
const int times = 10; const int times = 10;
TProgind p(times, TR("Lettura casuale senza cache"), TRUE, TRUE); TProgress_monitor p(times, TR("Lettura casuale senza cache"));
TLocalisamfile f(LF_COMUNI); TLocalisamfile f(LF_COMUNI);
start = start_timer(); start = start_timer();
for (int i = 0; i < times; i++) for (int i = 0; i < times; i++)
{ {
if (!p.addstatus(1))
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
break;
}
for (long j = 0; j < 10000; j++) for (long j = 0; j < 10000; j++)
{ {
const int rn = rand(); const int rn = rand();
@ -273,6 +267,12 @@ bool TTest_application::test5(TLog_report& log)
f.put(COM_COM, cod); f.put(COM_COM, cod);
f.read(); f.read();
r++; r++;
}
if (!p.add_status())
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
break;
} }
} }
} }
@ -301,7 +301,7 @@ bool TTest_application::test6(TLog_report& log)
{ {
tab.put("CODTAB", i+1); tab.put("CODTAB", i+1);
tab.write(); tab.write();
if (!_pi->addstatus(1)) if (!_pi->add_status())
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;
@ -325,7 +325,7 @@ bool TTest_application::test6(TLog_report& log)
for (cur = 0; cur.pos() < n; ++cur) for (cur = 0; cur.pos() < n; ++cur)
{ {
cur.file().remove(); cur.file().remove();
if (!_pi->addstatus(1)) if (!_pi->add_status())
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;

View File

@ -141,14 +141,7 @@ void TRequest_form::update_serno(const TString& num)
const TDate today(TODAY); const TDate today(TODAY);
TForm_item& data = find_field('H', odd_page, FF_DATARICH); TForm_item& data = find_field('H', odd_page, FF_DATARICH);
data.set(today.string()); data.set(today.string());
const char* hw = ""; find_field('H',odd_page,FF_DONGLE_HW).set("SSA");
switch (::dongle().hardware())
{
case _dongle_ssa : hw = "SSA"; break;
case _dongle_hardlock: hw = "HARDLOCK"; break;
default: hw = "EUTRON"; break;
}
find_field('H',odd_page,FF_DONGLE_HW).set(hw);
TForm_item& serno = find_field('H', odd_page, FF_DONGLE_SN); TForm_item& serno = find_field('H', odd_page, FF_DONGLE_SN);
serno.set(num); serno.set(num);
} }
@ -216,16 +209,10 @@ protected:
void load_masklistino(TMask & m); void load_masklistino(TMask & m);
void save_masklistino(TMask & m); void save_masklistino(TMask & m);
int build_sheet(bool on = true); int build_sheet(bool on = true);
void build_key_column();
bool burn_dongle();
static void keyext(const TString & s, word * v); static void keyext(const TString & s, word * v);
static void encode_second_key(); static void encode_second_key();
static bool date_hnd(TMask_field& f, KEY k);
static bool serno_hnd(TMask_field& f, KEY k);
static bool k_notify(TSheet_field& f, int r, KEY k); static bool k_notify(TSheet_field& f, int r, KEY k);
static bool change_users_handler(TMask_field&, KEY key); static bool change_users_handler(TMask_field&, KEY key);
static bool maxuser_handler(TMask_field& fld, KEY key); static bool maxuser_handler(TMask_field& fld, KEY key);
@ -355,79 +342,6 @@ void TAttivazione_moduli::garble_year(word y, TString& str1, TString& str2) cons
str2 = garble_md5(y); str2 = garble_md5(y);
} }
void TAttivazione_moduli::build_key_column()
{
TWait_cursor hourglass;
TSheet_field& sf = _msk->sfield(F_MODULI);
sf.enable_column(F_KEY, false);
const TDongle& d = dongle();
TString8 tmp1, tmp2;
FOR_EACH_SHEET_ROW_BACK(sf, i, riga)
{
if (!sf.cell_disabled(i, 1))
{
const int module = riga->get_int(2);
garble_module(module, tmp1, tmp2);
#ifdef DBG
if (d.type() == _developer_dongle)
riga->add(tmp2, 3); else // Backdoor di debug: mostra chiave web
#endif
riga->add(tmp1, 3); // Normalmente mostra chiave hardware
}
}
sf.force_update();
_msk->set(F_USERS, d.max_users());
_msk->set(F_ASSIST, d.year_assist());
}
bool TAttivazione_moduli::burn_dongle()
{
TDongle& din = ::dongle();
bool ok = din.type() == _user_dongle;
if (ok)
{
TString16 key;
TSheet_field& sf = _msk->sfield(F_MODULI);
FOR_EACH_SHEET_ROW(sf, i, riga)
{
key = riga->get(3); key.trim();
if (key.not_empty())
{
const int module = riga->get_int(2);
TString8 str1, str2;
garble_module(module, str1, str2);
const bool good = (key == str1) || (key == str2);
if (good)
{
if (!din.active(module) &&
yesno_box(FR("Confermare l'attivazione del modulo %d:\n%s"),
module, riga->get(0)))
din.activate(module);
}
else
{
if (din.active(module) &&
yesno_box(FR("Confermare la disattivazione del modulo %d:\n%s"),
module, riga->get(0)))
din.deactivate(module);
}
}
}
if (din.dirty())
{
ok = din.burn();
if (!ok)
error_box(TR("Impossibile riprogrammare la chiave"));
}
}
return ok;
}
bool TAttivazione_moduli::maxuser_handler(TMask_field& fld, KEY key) bool TAttivazione_moduli::maxuser_handler(TMask_field& fld, KEY key)
{ {
bool ok = true; bool ok = true;
@ -666,47 +580,12 @@ void TAttivazione_moduli::init_mask()
const TDate oggi(TODAY); const TDate oggi(TODAY);
const int nmod = build_sheet(); const int nmod = build_sheet();
const TDongle& d = ::dongle(); const TDongle& d = ::dongle();
switch (d.hardware())
{
case _dongle_hardlock: _msk->set_caption(TR("Attivazione HARDLOCK")); break;
case _dongle_eutron : _msk->set_caption(TR("Attivazione EUTRON")); break;
default : _msk->set_caption(TR("Attivazione SSA")); break;
}
_msk->set(F_SN, d.number()); _msk->set(F_SN, d.number());
_msk->set(F_DT, oggi); _msk->set(F_DT, oggi);
_msk->set(F_USERS, d.max_users()); _msk->set(F_USERS, d.max_users());
_msk->set(F_ASSIST, d.year_assist()); _msk->set(F_ASSIST, d.year_assist());
} }
bool TAttivazione_moduli::serno_hnd(TMask_field& f, KEY k)
{
if (k == K_TAB && f.focusdirty())
app().build_key_column();
return true;
}
bool TAttivazione_moduli::date_hnd(TMask_field& f, KEY k)
{
if (k == K_TAB && f.focusdirty())
{
const TDate data(f.get());
const TDate oggi(TODAY);
if (data > oggi)
return f.error_box(FR("La data deve essere antecedente a quella di sistema"));
/*
const TDate& last_update = ::dongle().last_update();
if (data < last_update)
return f.error_box(FR("La data deve essere successiva al %s"), last_update.string());
const int year_assist = ::dongle().year_assist()+1;
if (data.year() > year_assist)
return f.error_box(FR("La data deve essere antecedente al 31-12-%d"), year_assist);
*/
}
return true;
}
bool TAttivazione_moduli::k_notify(TSheet_field& f, int r, KEY k) bool TAttivazione_moduli::k_notify(TSheet_field& f, int r, KEY k)
{ {
if (k == K_INS || k == K_DEL) if (k == K_INS || k == K_DEL)
@ -971,19 +850,6 @@ bool TAttivazione_moduli::create()
return false; // Aggiornamento automatico riuscito! return false; // Aggiornamento automatico riuscito!
} }
if (d.hardware() == _dongle_network)
{
if (yesno_box(TR("Questo programma non puo' essere utilizzato in quanto è in funzione il server di autorizzazioni.\n"
"Si desidera connettersi al server per effettuare le operazioni di attivazione?")))
{
TString server = ini_get_string(CONFIG_INSTALL, "Server", "Dongle");
if (server.find(':') < 0)
server << ":1883";
server.insert("http://");
xvt_sys_goto_url(server, "open");
}
return false;
}
_im = new TInformazione_moduli; _im = new TInformazione_moduli;
@ -992,50 +858,11 @@ bool TAttivazione_moduli::create()
_msk = new TMask("ba1500a") ; _msk = new TMask("ba1500a") ;
_msk->set_handler(F_CHANGEUSERS, change_users_handler);
_msk->set_handler(F_CHANGEASSIST, change_assist_handler);
_msk->set_handler(DLG_PRINT, print_handler); _msk->set_handler(DLG_PRINT, print_handler);
TDongleType mydongle = ::dongle().type();
#ifdef DBG
if (mydongle == _developer_dongle && is_power_reseller(true))
mydongle = _aga_dongle;
#endif
if (mydongle == _aga_dongle)
{
_msk->show(F_AGA);
_msk->set_handler(F_AGA, aga_handler);
}
TSheet_field& sf = _msk->sfield(F_MODULI); TSheet_field& sf = _msk->sfield(F_MODULI);
sf.set_notify(k_notify); sf.set_notify(k_notify);
const bool can_edit = serno() != 0 && d.hardware() != _dongle_ssa;
switch (mydongle)
{
case _user_dongle:
_msk->set_handler(F_DT, date_hnd);
case _developer_dongle:
init_mask();
_serno=_msk->get_int(F_SN);
sf.enable_column(F_ENABLE, can_edit);
sf.enable_column(F_KEY, can_edit);
break;
case _aga_dongle:
_msk->set_handler(F_SN, serno_hnd);
_msk->enable(F_SN);
init_mask();
_serno=_msk->get_int(F_SN);
build_sheet(false);
sf.enable_column(1, can_edit);
build_key_column();
break;
default:
break;
}
enable_menu_item(M_FILE_PG_SETUP); enable_menu_item(M_FILE_PG_SETUP);
enable_menu_item(M_FILE_PRINT); enable_menu_item(M_FILE_PRINT);
return TSkeleton_application::create(); return TSkeleton_application::create();
@ -1050,19 +877,12 @@ bool TAttivazione_moduli::destroy()
void TAttivazione_moduli::main_loop() void TAttivazione_moduli::main_loop()
{ {
if (_msk->run() == K_ENTER) _msk->run();
burn_dongle();
} }
int ba1500(int argc, char** argv) int ba1500(int argc, char** argv)
{ {
// dipende dalla check_parameters fatta in main() TAttivazione_moduli a ;
if (user() == ::dongle().administrator()) a.run(argc, argv, TR("Stato attivazione moduli"));
{
TAttivazione_moduli a ;
a.run(argc, argv, TR("Attivazione moduli"));
}
else
error_box(FR("Utente %s non abilitato all'attivazione"), (const char*)user());
return 0; return 0;
} }

View File

@ -8,11 +8,8 @@
#define F_DT 212 #define F_DT 212
#define F_MODULI 213 #define F_MODULI 213
#define F_USERS 214 #define F_USERS 214
#define F_CHANGEUSERS 215
#define F_ASSIST 216 #define F_ASSIST 216
#define F_CHANGEASSIST 217
#define F_PRINT 218 #define F_PRINT 218
#define F_AGA 219
/* /*
#define F_AGGLISTINO 220 #define F_AGGLISTINO 220
@ -23,7 +20,6 @@
#define F_NOMEMOD 101 #define F_NOMEMOD 101
#define F_ENABLE 102 #define F_ENABLE 102
#define F_CODE 103 #define F_CODE 103
#define F_KEY 104
#define FF_DATARICH 101 #define FF_DATARICH 101

View File

@ -11,55 +11,33 @@ END
ENDPAGE ENDPAGE
PAGE "Attivazione Moduli" -1 -1 79 21 PAGE "Stato Attivazione Moduli" -1 -1 79 21
STRING F_SN 5 STRING F_SN 5
BEGIN BEGIN
PROMPT 54 1 "N.Serie " PROMPT 1 0 "Numero di serie "
FLAGS "DUZ" FLAGS "DUZ"
END END
DATE F_DT
BEGIN
PROMPT 54 2 "Data "
FLAGS "A"
END
NUMBER F_USERS 4 NUMBER F_USERS 4
BEGIN BEGIN
PROMPT 54 3 "Utenti " PROMPT 31 0 "Utenti "
FLAGS "D" FLAGS "D"
END END
BUTTON F_CHANGEUSERS 6 1
BEGIN
PROMPT 71 3 "Cambia"
END
NUMBER F_ASSIST 4 NUMBER F_ASSIST 4
BEGIN BEGIN
PROMPT 54 4 "Assistenza " PROMPT 54 0 "Assistenza "
FLAGS "D" FLAGS "D"
END END
BUTTON F_CHANGEASSIST 6 1
BEGIN
PROMPT 71 4 "Cambia"
END
BUTTON F_AGA 18
BEGID
PROMPT 22 4 " Dati Release "
FLAGS "H"
END
SPREADSHEET F_MODULI 78 SPREADSHEET F_MODULI 78
BEGIN BEGIN
PROMPT 1 5 "Moduli" PROMPT 1 1 "Moduli"
ITEM "Modulo@40" ITEM "Modulo@40"
ITEM "Att." ITEM "Att."
ITEM "Cod." ITEM "Cod."
ITEM "Chiave@8" FLAGS "D"
END END
ENDPAGE ENDPAGE
@ -85,12 +63,6 @@ BEGIN
FLAGS "D" FLAGS "D"
END END
STRING F_KEY 8
BEGIN
PROMPT 1 6 "Chiave "
FLAGS "U"
END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -1 ""

View File

@ -67,7 +67,7 @@ bool update_dninst(bool force)
bool update_assistance_year() bool update_assistance_year()
{ {
TDongle& donkey = dongle(); TDongle& donkey = dongle();
const bool remote = donkey.hardware() == _dongle_network; const bool remote = donkey.network();
update_dninst(true); update_dninst(true);
@ -84,12 +84,7 @@ bool update_assistance_year()
if (dninst.find_serno()) if (dninst.find_serno())
{ {
donkey.set_year_assist(dninst_year); donkey.set_year_assist(dninst_year);
bool done = false; return true;
if (remote)
done = rpc_DongleYearActivate(dninst_year);
else
done = donkey.burn();
return done || show_error(TR("Errore di aggiornamento della chiave di protezione"));
} //if(sn==serno... } //if(sn==serno...
else else
{ {

View File

@ -286,25 +286,7 @@ bool TInstaller_mask::should_precheck_module(int modnumber) const
//che tipo di installazione e'? //che tipo di installazione e'?
int TInstaller_mask::test_station_type() const int TInstaller_mask::test_station_type() const
{ {
TConfig ini(CONFIG_INSTALL, "Main"); const int type = ini_get_int(CONFIG_INSTALL, "Main", "Type", 1);
int type = ini.get_int("Type");
//se type non e' definito nei valori giusti (1=standard,2=server,3=client)
if (type < 1 || type > 3)
{
const bool testdb = ini.get_bool("TestDatabase");
//const bool testprg = ini.get_bool("TestPrograms");
if (testdb)
{
if (dongle().hardware() == _dongle_network) //se usa un server di chiavi->server
type = 2;
else
type = 1;
}
else
type = 3;
ini.set("Type", type); //cosi' lo definisce se non c'e'
}
return type; return type;
} }
@ -338,7 +320,7 @@ int TInstaller_mask::precheck_modules(bool only_newer)
bool chk = rigar.get_char(C_ISPATCH) != 'X' || release == currrelease; bool chk = rigar.get_char(C_ISPATCH) != 'X' || release == currrelease;
// non spunta automaticamente il modulo server su installazioni che non siano server // non spunta automaticamente il modulo server su installazioni che non siano server
if (cod_module == "sr" && (test_station_type() != 2 || !xvt_sys_dongle_server_is_running())) if (cod_module == "sr" && (test_station_type() != 2 || !xvt_sys_dongle_server_running()))
{ {
chk = false; chk = false;
disable_row(r); disable_row(r);
@ -559,14 +541,13 @@ bool TInstaller_mask::autoload()
if (internet) //internet patches if (internet) //internet patches
{ {
TProgress_monitor pi(1, TR("Controllo lista aggiornamenti"), false); // progind NON bloccabile: causa errore impossibile! {
http_dir(http_server, http_path, modules); TProgress_monitor pi(1, TR("Controllo lista aggiornamenti"), false); // progind NON bloccabile: causa errore impossibile!
pi.set_max(modules.items()); http_dir(http_server, http_path, modules);
pi.set_text(TR("Download lista aggiornamenti")); }
TProgress_monitor pi(modules.items(), TR("Download lista aggiornamenti"));
for (int i = modules.last(); i >= 0; i--) for (int i = modules.last(); i >= 0; i--)
{ {
if (!pi.add_status())
break;
TString& str = modules.row(i); TString& str = modules.row(i);
if (str.ends_with("a.ini", true)) if (str.ends_with("a.ini", true))
{ {
@ -596,6 +577,9 @@ bool TInstaller_mask::autoload()
} }
else else
modules.destroy(i); modules.destroy(i);
if (!pi.add_status())
break;
} }
modules.pack(); modules.pack();
} }
@ -1804,7 +1788,7 @@ bool TInstaller_mask::on_key(KEY key)
bool TInstaller_mask::is_program_dir(const TFilename& path) bool TInstaller_mask::is_program_dir(const TFilename& path)
{ {
//controlla l'esistenza di alcuni files chiave di campo //controlla l'esistenza di alcuni files chiave di campo
const char* const essential[] = {"install.ini", "campo.ini", "campo.aut", "ba0.exe", "xvaga.dll", NULL }; const char* const essential[] = {"install.ini", "campo.ini", "campo.aut", "ba0.exe", "ba1.exe", "xvaga.dll", NULL };
bool ok = true; bool ok = true;
for (int i = 0; ok && essential[i]; i++) for (int i = 0; ok && essential[i]; i++)
{ {
@ -1915,13 +1899,13 @@ protected:
protected: protected:
virtual bool create(); virtual bool create();
virtual bool use_files() const { return false; } virtual bool use_files() const { return false; }
virtual bool test_assistance_year() const; virtual bool test_assistance_year(bool verbose) const;
virtual void main_loop(); virtual void main_loop();
void convert_archives(); void convert_archives();
}; };
bool TInstaller::test_assistance_year() const bool TInstaller::test_assistance_year(bool) const
{ {
// Per il momento lascia continuare: ci pensa poi la create // Per il momento lascia continuare: ci pensa poi la create
return true; return true;
@ -1929,21 +1913,13 @@ bool TInstaller::test_assistance_year() const
bool TInstaller::create() bool TInstaller::create()
{ {
if (!TApplication::test_assistance_year(true))
{
TExternal_app attivazione("ba1 -4");
attivazione.run();
dongle().login(); // Rilegge anno assistenza
}
else
update_dninst(false); // Aggiorna se necessario
//crea la maschera di installazione //crea la maschera di installazione
_m = new TInstaller_mask(); _m = new TInstaller_mask();
//se e' un client //se e' un client
if (_m->station_type() == 3) if (_m->station_type() == 3)
{ {
update_dninst(false); // Aggiorna se necessario
_m->disable_check(); _m->disable_check();
_m->disable(F_UPDATE); _m->disable(F_UPDATE);
_m->disable(DLG_USER); _m->disable(DLG_USER);

View File

@ -8,17 +8,20 @@ bool run_as_admin()
bool yes = true; bool yes = true;
TOKEN_ELEVATION_TYPE elevationType = (TOKEN_ELEVATION_TYPE)0; // N/A for < Vista TOKEN_ELEVATION_TYPE elevationType = (TOKEN_ELEVATION_TYPE)0; // N/A for < Vista
OSVERSIONINFO VerInfo; OSVERSIONINFO VerInfo = { 0 };
VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&VerInfo); ::GetVersionEx(&VerInfo);
if (VerInfo.dwMajorVersion >= 6) // If Vista or newer, if (VerInfo.dwMajorVersion >= 6) // If Vista or newer,
{ {
HANDLE hToken; // read elevation type HANDLE hToken = NULL; // read elevation type
BOOL bOK = OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken); BOOL bOK = ::OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken);
DWORD infoLen; if (bOK)
yes = GetTokenInformation(hToken, TokenElevationType, // type of info to retrieve {
&elevationType, // receives return value DWORD infoLen;
sizeof(elevationType), &infoLen) != 0; // receives returned length yes = ::GetTokenInformation(hToken, TokenElevationType, // type of info to retrieve
&elevationType, // receives return value
sizeof(elevationType), &infoLen) != 0; // receives returned length
}
} }
return yes; return yes;
} }

View File

@ -116,7 +116,7 @@ int TStampa_deleghe_IVA::select()
TToken_string d(80); TToken_string d(80);
_ditte->destroy(); _ditte->destroy();
begin_wait(); xvt_scr_set_busy_cursor();
for (_nditte->first(); _nditte->good(); _nditte->next()) for (_nditte->first(); _nditte->good(); _nditte->next())
{ {
TLocalisamfile& anag = _nditte->lfile(LF_ANAG); TLocalisamfile& anag = _nditte->lfile(LF_ANAG);
@ -154,7 +154,7 @@ int TStampa_deleghe_IVA::select()
} }
} }
} }
end_wait(); xvt_scr_set_busy_cursor();
int res = 1; int res = 1;
if (_ditte->items() > 0) if (_ditte->items() > 0)

View File

@ -842,10 +842,16 @@ void Tdninst_mask::save_sheet()
_dninst.set(key, "*", str.trim()); _dninst.set(key, "*", str.trim());
} }
} }
if (_dninst.save(10))
int y, v, t, p;
main_app().get_version_info(y, v, t, p);
const int curr = v;
const int prev = v-1;
if (_dninst.save(prev))
{ {
fill_sheet(); fill_sheet();
const TFilename ftp10 = remote_dninst(10); const TFilename ftp10 = remote_dninst(prev);
if (ftp10 != DNINST_ZIP && ftp10.starts_with("ftp://")) if (ftp10 != DNINST_ZIP && ftp10.starts_with("ftp://"))
if (!is_running() || yesno_box(FR("Copiare il DNINST locale in %s?"), (const char*)ftp10)) if (!is_running() || yesno_box(FR("Copiare il DNINST locale in %s?"), (const char*)ftp10))
{ {
@ -853,14 +859,14 @@ void Tdninst_mask::save_sheet()
if (fcopy(DNINST_ZIP, DNINST_BAK)) if (fcopy(DNINST_ZIP, DNINST_BAK))
{ {
_dninst.save(11); _dninst.save(curr);
const TFilename ftp11 = remote_dninst(11); const TFilename ftp11 = remote_dninst(curr);
send_remote_dninst(ftp11); send_remote_dninst(ftp11);
fcopy(DNINST_BAK, DNINST_ZIP); fcopy(DNINST_BAK, DNINST_ZIP);
remove(DNINST_BAK); remove(DNINST_BAK);
} }
} }
_dninst.save(11); // Sicurezza _dninst.save(curr);
} }
} }
@ -1112,6 +1118,7 @@ protected:
virtual bool use_files() const { return false; } virtual bool use_files() const { return false; }
virtual bool create(); virtual bool create();
virtual void main_loop(); virtual void main_loop();
virtual bool test_assistance_year(bool) const { return true; }
}; };
bool Tdninst_manager::create() bool Tdninst_manager::create()
@ -1119,10 +1126,8 @@ bool Tdninst_manager::create()
if (user() != dongle().administrator()) if (user() != dongle().administrator())
return error_box(TR("Utente non abilitato")); return error_box(TR("Utente non abilitato"));
const word n = dongle().number();
// 8453 = Ilaria; 8517 = Sara
const TString& host = get_hostname(); const TString& host = get_hostname();
if (n != 8453 && n != 8517 && !is_power_station() && if (!is_power_station() &&
!host.ends_with("giardini", true) && !host.ends_with("giardini", true) &&
host.compare("pccopw7", -1, true) != 0 && host.compare("pccopw7", -1, true) != 0 &&
host.compare("pcpiccolow7", -1, true) != 0) host.compare("pcpiccolow7", -1, true) != 0)

View File

@ -885,10 +885,11 @@ void TConversione_archivi::convert_codconc()
void TConversione_archivi::rebuild_indexes() void TConversione_archivi::rebuild_indexes()
{ {
do_events(); TWait_cursor hourglass;
begin_wait();
prefix().set("com"); prefix().set("com");
rebuild_dir_indexes(); rebuild_dir_indexes();
/*
TSystemisamfile ditte(LF_NDITTE); TSystemisamfile ditte(LF_NDITTE);
ditte.open(); ditte.open();
@ -907,7 +908,15 @@ void TConversione_archivi::rebuild_indexes()
ditte.readat(rec); ditte.readat(rec);
} }
ditte.close(); ditte.close();
end_wait(); */
TPointer_array ditte;
prefix().firms(ditte);
for (int i = 0; i < ditte.items(); i++)
{
const long codditta = ditte.get_long(i);
set_firm(codditta);
rebuild_dir_indexes();
}
} }
void TConversione_archivi::rebuild_dir_indexes() void TConversione_archivi::rebuild_dir_indexes()
@ -918,10 +927,10 @@ void TConversione_archivi::rebuild_dir_indexes()
d.get(LF_DIR); d.get(LF_DIR);
const int items = (int)d.eod(); const int items = (int)d.eod();
TString80 s("Ricostruzione indici "); TString80 s(TR("Ricostruzione indici "));
if (is_com) s << "comuni"; if (is_com) s << TR("dati comuni");
else s << " della ditta " << atol (pref); else s << TR(" ditta ") << atol (pref);
TProgind p(items ? items : 1, s, TRUE, TRUE, 70); TProgind p(items ? items : 1, s, TRUE, TRUE, 70);

View File

@ -3,45 +3,32 @@
#include "bainst.h" #include "bainst.h"
int main(int argc,char** argv) int main(int argc,char** argv)
{ {
TApplication::check_parameters(argc, argv); TApplication::check_parameters(argc, argv);
int r = 0; int r = 0;
if (argc < 2) return 0; if (argc < 2)
return 0;
TString4 mod; TString4 mod;
mod.strncpy(argv[2], 2); mod.strncpy(argv[2], 2);
mod.lower(); mod.lower();
if (mod == "cg") if (mod == "cg") r = bainst07(argc,argv); // pre/post installazione contabilità generale:
r = bainst07(argc,argv); // pre/post installazione contabilità generale: else if (mod == "ce") r = bainst11(argc, argv);// pre/post installazione cespiti
else if (mod == "ce") else if (mod == "at") r = bainst17(argc, argv);// pre/post installazione avis
r = bainst11(argc, argv);// pre/post installazione cespiti else if (mod == "in") r = bainst18(argc, argv);// pre/post installazione intra
else if (mod == "at") //else if (mod == "vd") r = bainst23(argc, argv);// pre/post installazione vendite al dettaglio
r = bainst17(argc, argv);// pre/post installazione avis else if (mod == "tc") r = bainst27(argc, argv);//pre/post installazione trasferimento altre contabilità
else if (mod == "in") else if (mod == "ve") r = bainst31(argc, argv);// pre/post installazione vendite:
r = bainst18(argc, argv);// pre/post installazione intra else if (mod == "mg") r = bainst32(argc, argv);// pre/post installazione magazzino:
else if (mod == "vd") else if (mod == "ef") r = bainst34(argc, argv);// pre/post installazione effetti:
r = bainst23(argc, argv);// pre/post installazione vendite al dettaglio else if (mod == "db") r = bainst35(argc, argv);// pre/post installazione distinta base:
else if (mod == "tc") else if (mod == "sv") r = bainst38(argc, argv);// pre/post installazione statistiche:
r = bainst27(argc, argv);//pre/post installazione trasferimento altre contabilità else if (mod == "mr") r = bainst39(argc, argv);// pre/post installazione MRP
else if (mod == "ve") else if (mod == "lv") r = bainst41(argc, argv);// pre/post installazione lavanderie
r = bainst31(argc, argv);// pre/post installazione vendite: else r = bainst00(argc, argv);// pre/post installazione base
else if (mod == "mg")
r = bainst32(argc, argv);// pre/post installazione magazzino:
else if (mod == "ef")
r = bainst34(argc, argv);// pre/post installazione effetti:
else if (mod == "db")
r = bainst35(argc, argv);// pre/post installazione distinta base:
else if (mod == "sv")
r = bainst38(argc, argv);// pre/post installazione statistiche:
else if (mod == "mr")
r = bainst39(argc, argv);// pre/post installazione MRP
else if (mod == "lv")
r = bainst41(argc, argv);// pre/post installazione lavanderie
else
r = bainst00(argc, argv);// pre/post installazione base
return 0; return 0;
} }

View File

@ -33,12 +33,12 @@ int TSystemtempfile::load(
// @xref <mf TSystemisamfile::dump> // @xref <mf TSystemisamfile::dump>
{ {
FILE* fl = fopen(from, "r"); FILE* fl = NULL;
int err=NOERR; int err = fopen_s(&fl, from, "r");;
if (fl == NULL) if (fl == NULL)
{ {
error_box("Non riesco ad aprire il file %s",from); cantread_box(from);
return 2; return err;
} }
TRecnotype r = 0, e = 0, nitems = 0, nread = 0; TRecnotype r = 0, e = 0, nitems = 0, nread = 0;
TString16 firm, year, attprev("00000"); TString16 firm, year, attprev("00000");
@ -217,16 +217,16 @@ int TSystemtempfile::dump(
// @xref <mf TSystemisamfile::load> // @xref <mf TSystemisamfile::load>
{ {
FILE* f = fopen(to, "w"); FILE* f = NULL;
int err = fopen_s(&f, to, "w");
if (f == NULL) if (f == NULL)
{ {
setstatus(2); setstatus(2);
return 2; return err;
} }
if (withdeleted)
if (withdeleted) nkey = 0; nkey = 0;
int err = ferror(f); err = ferror(f);
//open(FALSE, nkey ? TRUE : FALSE); //open(FALSE, nkey ? TRUE : FALSE);
TString s(512); TString s(512);
@ -539,8 +539,10 @@ bool TInstallmodule_app::install_firm()
// riconverte le macro delle date // riconverte le macro delle date
tabstd.dump(tempfile); tabstd.dump(tempfile);
TScanner scan(tempfile); TScanner scan(tempfile);
FILE *dest=fopen((const char *)stdtabname,"w"); FILE *dest = NULL;
while (TRUE) { fopen_s(&dest, stdtabname, "w");
while (dest)
{
TString &line=scan.line(); TString &line=scan.line();
if (line.empty()) break; if (line.empty()) break;