Correzione programma gestione DNINST
Correzione allineamento campi in maschera Banche Correzione allineamento campi in maschera Contatti git-svn-id: svn://10.65.10.50/branches/R_10_00@22653 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
70b7377a24
commit
15b790159f
@ -600,11 +600,16 @@ bool TOutlook_mask::can_be_closed() const
|
||||
TBook_field& bf = book_field();
|
||||
if (bf.pages() > 0)
|
||||
{
|
||||
TMask cm(TR("Chiusura applicazioni"), 1, 50, 7);
|
||||
cm.add_radio(DLG_USER, 0, TR("Azione"), 1, 0, 48, "0|1",
|
||||
TR("Non chiudere le applicazioni in esecuzione|Chiusura forzata (solo in caso d'emergenza)"));
|
||||
TMask cm(TR("Chiusura applicazioni"), 1, 50, 8);
|
||||
|
||||
TToken_string options;
|
||||
options = TR("Non chiudere le applicazioni in esecuzione");
|
||||
options.add(TR("Chiusura forzata (solo in caso d'emergenza)"));
|
||||
cm.add_radio(DLG_USER, 0, TR("Azione"), 1, 0, 48, "0|1", options);
|
||||
|
||||
cm.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
|
||||
cm.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
|
||||
|
||||
if (cm.run() == K_ENTER && cm.get_int(DLG_USER))
|
||||
bf.kill_processes();
|
||||
}
|
||||
|
463
ba/ba2800.cpp
463
ba/ba2800.cpp
@ -43,7 +43,7 @@ int smart_cmp(const char* s1, const char* s2)
|
||||
// TOEM_cache
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TOEM_cache
|
||||
class TOEM_cache : public TObject
|
||||
{
|
||||
public:
|
||||
int Agente2OEM(int agente) const;
|
||||
@ -88,11 +88,13 @@ public:
|
||||
bool exists(int key) const { return _chiavi.objptr(key) != NULL; }
|
||||
|
||||
bool load();
|
||||
bool save() const;
|
||||
bool save(int version) const;
|
||||
};
|
||||
|
||||
const char* const DNINST_ZIP = "setup/dninst.zip";
|
||||
const char* const DNINST_TXT = "setup/dninst.txt";
|
||||
#define DNINST "setup/dninst."
|
||||
const char* const DNINST_ZIP = DNINST"zip";
|
||||
const char* const DNINST_TXT = DNINST"txt";
|
||||
const char* const DNINST_BAK = DNINST"bak";
|
||||
|
||||
void Tdnist_full::set(int key, const char* var, const TString& value)
|
||||
{
|
||||
@ -161,15 +163,16 @@ bool Tdnist_full::load()
|
||||
return !_chiavi.empty();
|
||||
}
|
||||
|
||||
bool Tdnist_full::save() const
|
||||
bool Tdnist_full::save(int version) const
|
||||
{
|
||||
Tdninst dninst;
|
||||
bool done = dninst.ok();
|
||||
|
||||
if (done)
|
||||
{
|
||||
const int ass_year = version < 11 ? 2101 : 2121;
|
||||
ofstream out(DNINST_TXT);
|
||||
out << dninst.assist_year() << endl;
|
||||
out << ass_year << endl;
|
||||
FOR_EACH_ARRAY_ITEM(_chiavi, key, obj)
|
||||
{
|
||||
out << '[' << key << ']' << endl;
|
||||
@ -183,7 +186,8 @@ bool Tdnist_full::save() const
|
||||
{
|
||||
done = dninst.encode(DNINST_TXT);
|
||||
#ifdef DBG
|
||||
fcopy(DNINST_TXT, "../setup/dninst.txt");
|
||||
if (version == 11)
|
||||
fcopy(DNINST_TXT, "../src/setup/dninst.txt");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -191,14 +195,14 @@ bool Tdnist_full::save() const
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Tdnist_mask
|
||||
// Tdninst_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
static int _c_key, _c_oem, _c_owner, _c_suspend, _c_killed;
|
||||
static int _c_dboem, _c_dbowner, _c_dbsuspend, _c_dbkilled;
|
||||
static int _c_xmloem, _c_xmlowner, _c_xmlaccess;
|
||||
|
||||
class Tdnist_mask : public TAutomask
|
||||
class Tdninst_mask : public TAutomask
|
||||
{
|
||||
TOEM_cache _oem;
|
||||
Tdnist_full _dninst;
|
||||
@ -206,7 +210,7 @@ class Tdnist_mask : public TAutomask
|
||||
private:
|
||||
static int dongle_compare(const TSortable& o1, const TSortable& o2, void* jolly);
|
||||
|
||||
const TString& remote_dninst() const;
|
||||
const TString& remote_dninst(int version) const;
|
||||
|
||||
void load_dninst(TString_array& a);
|
||||
bool load_odbc(TString_array& a) const;
|
||||
@ -214,15 +218,73 @@ private:
|
||||
TToken_string& find_or_create_line(TString_array& a, int key) const;
|
||||
|
||||
protected:
|
||||
void fill_sheet();
|
||||
void merge_sheet();
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
bool fill_sheet();
|
||||
void merge_sheet();
|
||||
void save_sheet();
|
||||
void log(int severity, const char* msg) const;
|
||||
bool get_remote_dninst();
|
||||
bool send_remote_dninst(const TString& ftp) const;
|
||||
|
||||
public:
|
||||
Tdnist_mask();
|
||||
void overnight_batch();
|
||||
|
||||
Tdninst_mask();
|
||||
};
|
||||
|
||||
int Tdnist_mask::dongle_compare(const TSortable& o1, const TSortable& o2, void* jolly)
|
||||
void Tdninst_mask::log(int severity, const char* msg) const
|
||||
{
|
||||
FILE* f = fopen("DNINST.log", "a");
|
||||
if (f != NULL)
|
||||
{
|
||||
if (msg && *msg > ' ')
|
||||
{
|
||||
char sev = ' ';
|
||||
switch (severity)
|
||||
{
|
||||
case 0: sev = ' '; break;
|
||||
case 1: sev = '-'; break;
|
||||
default: sev = '!'; break;
|
||||
}
|
||||
time_t rawtime; time(&rawtime);
|
||||
struct tm * timeinfo = localtime (&rawtime);
|
||||
fprintf(f, "%c %02d-%02d-%04d %02d:%02d:%02d %s\n", sev,
|
||||
timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year+1900,
|
||||
timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec,
|
||||
msg);
|
||||
}
|
||||
else
|
||||
fputc('\n', f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
void Tdninst_mask::overnight_batch()
|
||||
{
|
||||
log(0, TR("Inizio procedura aggiornamento DNINST"));
|
||||
|
||||
set(F_ZIP_ON, "X");
|
||||
set(F_DSN_ON, "X");
|
||||
set(F_XML_ON, "");
|
||||
on_field_event(efield(F_ZIP_WWW), fe_init, 0);
|
||||
on_field_event(efield(F_DSN_WWW), fe_init, 0);
|
||||
|
||||
log(0, TR("Caricamento dati da DSN"));
|
||||
if (get_remote_dninst())
|
||||
{
|
||||
fill_sheet();
|
||||
log(0, TR("Elaborazione abilitazioni"));
|
||||
merge_sheet();
|
||||
|
||||
log(0, TR("Salvataggio dati"));
|
||||
save_sheet();
|
||||
}
|
||||
|
||||
log(0, TR("Fine procedura aggiornamento DNINST"));
|
||||
log(0, "\n");
|
||||
}
|
||||
|
||||
int Tdninst_mask::dongle_compare(const TSortable& o1, const TSortable& o2, void* jolly)
|
||||
{
|
||||
TToken_string& d1 = (TToken_string&)o1;
|
||||
TToken_string& d2 = (TToken_string&)o2;
|
||||
@ -239,7 +301,17 @@ int Tdnist_mask::dongle_compare(const TSortable& o1, const TSortable& o2, void*
|
||||
const int cmp = smart_cmp(o1, o2);
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
} else
|
||||
if (sort == 3)
|
||||
{
|
||||
const TDate a1 = d1.get(_c_xmlaccess);
|
||||
const TDate a2 = d2.get(_c_xmlaccess);
|
||||
int cmp = a2.date2ansi() - a1.date2ansi();
|
||||
if (cmp == 0)
|
||||
cmp = atoi(d1) - atoi(d2);
|
||||
return cmp;
|
||||
}
|
||||
|
||||
if (sort >= 1)
|
||||
{
|
||||
const char* o1 = d1.get(_c_owner);
|
||||
@ -256,19 +328,29 @@ int Tdnist_mask::dongle_compare(const TSortable& o1, const TSortable& o2, void*
|
||||
return atoi(d1) - atoi(d2);
|
||||
}
|
||||
|
||||
const TString& Tdnist_mask::remote_dninst() const
|
||||
const TString& Tdninst_mask::remote_dninst(int version) const
|
||||
{
|
||||
TString& path = get_tmp_string();
|
||||
if (get_bool(F_DNINST_ON))
|
||||
if (!get_bool(F_ZIP_ON) || field(F_ZIP_WWW).empty())
|
||||
return EMPTY_STRING;
|
||||
|
||||
if (version < 10)
|
||||
{
|
||||
path = get(F_DNINST); path.lower();
|
||||
if (!path.ends_with(DNINST_ZIP))
|
||||
path << "/" << DNINST_ZIP;
|
||||
int year, tag, patch;
|
||||
main_app().get_version_info(year, version, tag, patch);
|
||||
}
|
||||
|
||||
TString& path = get_tmp_string();
|
||||
path << "ftp://" << get(F_ZIP_USR)
|
||||
<< ':' << get(F_ZIP_PWD)
|
||||
<< '@' << get(F_ZIP_WWW)
|
||||
<< '/' << get(F_ZIP_USR)
|
||||
<< "/release/v_" << version
|
||||
<< ".0/program/" << DNINST_ZIP;
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
void Tdnist_mask::load_dninst(TString_array& a)
|
||||
void Tdninst_mask::load_dninst(TString_array& a)
|
||||
{
|
||||
_dninst.load();
|
||||
|
||||
@ -285,7 +367,7 @@ void Tdnist_mask::load_dninst(TString_array& a)
|
||||
}
|
||||
}
|
||||
|
||||
TToken_string& Tdnist_mask::find_or_create_line(TString_array& a, int key) const
|
||||
TToken_string& Tdninst_mask::find_or_create_line(TString_array& a, int key) const
|
||||
{
|
||||
int mi = 0, ma = a.last();
|
||||
int k = 0;
|
||||
@ -308,46 +390,63 @@ TToken_string& Tdnist_mask::find_or_create_line(TString_array& a, int key) const
|
||||
return *str;
|
||||
}
|
||||
|
||||
bool Tdnist_mask::load_odbc(TString_array& a) const
|
||||
bool Tdninst_mask::load_odbc(TString_array& a) const
|
||||
{
|
||||
if (!get_bool(F_DSN_ON))
|
||||
return false;
|
||||
const TString& dsn = get(F_DSN_WWW);
|
||||
bool done = false;
|
||||
|
||||
TString query;
|
||||
query << "ODBC(" << get(F_DSN) << ")\n"
|
||||
<< "SELECT chiavette.codice AS Chiave, Agente, RagioneSociale, DataDisattivazione\n"
|
||||
<< "FROM chiavette,clienti WHERE chiavette.cliente=clienti.codice\n"
|
||||
<< "ORDER BY Chiave";
|
||||
|
||||
TODBC_recordset att(query);
|
||||
TProgind pi(att.items(), get(F_DSN));
|
||||
for (bool ok = att.move_first(); ok; ok = att.move_next())
|
||||
if (dsn.full())
|
||||
{
|
||||
if (!pi.addstatus(1)) break;
|
||||
const int key = att.get("Chiave").as_int();
|
||||
TString query;
|
||||
query << "ODBC(" << dsn << ")\n"
|
||||
<< "SELECT chiavette.codice AS Chiave, Agente, RagioneSociale, DataDisattivazione\n"
|
||||
<< "FROM chiavette,clienti WHERE chiavette.cliente=clienti.codice\n"
|
||||
<< "ORDER BY Chiave";
|
||||
|
||||
if (key > 0)
|
||||
TODBC_recordset att(query);
|
||||
TProgind pi(att.items(), dsn);
|
||||
for (bool ok = att.move_first(); ok; ok = att.move_next())
|
||||
{
|
||||
TToken_string& r = find_or_create_line(a, key);
|
||||
const int agente = att.get("Agente").as_int();
|
||||
r.add(_oem.Agente2OEM(agente), _c_dboem);
|
||||
r.add(smart_trim(att.get("RagioneSociale").as_string(), 50), _c_dbowner);
|
||||
if (!pi.addstatus(1)) break;
|
||||
const int key = att.get("Chiave").as_int();
|
||||
|
||||
const TString& kill = att.get("DataDisattivazione").as_string();
|
||||
if (kill.full() && kill.len() == 10)
|
||||
if (key > 0)
|
||||
{
|
||||
const TString& stato = att.get("Stato").as_string();
|
||||
switch (stato[0])
|
||||
TToken_string& r = find_or_create_line(a, key);
|
||||
const int agente = att.get("Agente").as_int();
|
||||
r.add(_oem.Agente2OEM(agente), _c_dboem);
|
||||
r.add(smart_trim(att.get("RagioneSociale").as_string(), 50), _c_dbowner);
|
||||
|
||||
const TString& kill = att.get("DataDisattivazione").as_string();
|
||||
if (kill.full() && kill.len() == 10)
|
||||
{
|
||||
case 'D': r.add(kill, _c_dbkilled); break; // Disdetto
|
||||
case 'S': r.add(kill, _c_dbsuspend); break; // Sospeso
|
||||
default: break;
|
||||
const TString& stato = att.get("Stato").as_string();
|
||||
switch (stato[0])
|
||||
{
|
||||
case 'D': r.add(kill, _c_dbkilled); break; // Disdetto
|
||||
case 'S': r.add(kill, _c_dbsuspend); break; // Sospeso
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !att.empty();
|
||||
if (!done)
|
||||
{
|
||||
if (is_running())
|
||||
cantread_box(dsn);
|
||||
else
|
||||
{
|
||||
TString msg;
|
||||
msg << TR("Impossibile leggere i dati da ") << dsn;
|
||||
log(2, msg);
|
||||
}
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
static bool XmlScanner(TXmlItem& item, long jolly)
|
||||
@ -372,23 +471,18 @@ static bool XmlScanner(TXmlItem& item, long jolly)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Tdnist_mask::load_xml(TString_array& a) const
|
||||
bool Tdninst_mask::load_xml(TString_array& a) const
|
||||
{
|
||||
if (!get_bool(F_FTP_ON))
|
||||
return false;
|
||||
|
||||
TFilename path = get(F_FTP);
|
||||
if (!path.ends_with(".xml"))
|
||||
{
|
||||
if (!path.ends_with("/"))
|
||||
path << '/';
|
||||
path << "attivazioni/?????.xml";
|
||||
}
|
||||
TFilename path;
|
||||
path << "ftp://" << get(F_XML_USR)
|
||||
<< ':' << get(F_XML_PWD)
|
||||
<< '@' << get(F_XML_WWW)
|
||||
<< "/attivazioni/?????.xml";
|
||||
|
||||
TString_array xml;
|
||||
list_files(path, xml);
|
||||
|
||||
TString msg; msg.format(FR("Scansione cartella %s: %d files"), path.path(), xml.items());
|
||||
TString msg; msg.format(FR("Scansione cartella %s: %d files"), (const char*)path, xml.items());
|
||||
TProgind pi(xml.items(), msg);
|
||||
TFilename fname, tmpname;
|
||||
TFilename tmpdir; tmpdir.tempdir(); tmpdir.add("www");
|
||||
@ -420,15 +514,46 @@ bool Tdnist_mask::load_xml(TString_array& a) const
|
||||
return !xml.empty();
|
||||
}
|
||||
|
||||
void Tdnist_mask::fill_sheet()
|
||||
bool Tdninst_mask::get_remote_dninst()
|
||||
{
|
||||
const TString& n = remote_dninst(10);
|
||||
if (n.full())
|
||||
{
|
||||
if (fcopy(n, DNINST_BAK, false, true) && fsize(DNINST_BAK) > 0)
|
||||
{
|
||||
fcopy(DNINST_BAK, DNINST_ZIP);
|
||||
remove(DNINST_BAK);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (is_running())
|
||||
cantread_box(n);
|
||||
else
|
||||
{
|
||||
TString msg; msg << TR("Impossibile leggere ") << n;
|
||||
log(2, msg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Tdninst_mask::fill_sheet()
|
||||
{
|
||||
TSheet_field& s = sfield(F_DNSHEET);
|
||||
s.destroy();
|
||||
|
||||
TString_array& a = s.rows_array();
|
||||
load_dninst(a);
|
||||
load_odbc(a);
|
||||
load_xml(a);
|
||||
if (a.empty())
|
||||
return false;
|
||||
|
||||
if (get_bool(F_DSN_ON) && !field(F_DSN_WWW).empty())
|
||||
{
|
||||
if (!load_odbc(a))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (get_bool(F_XML_ON) && !field(F_XML_WWW).empty())
|
||||
load_xml(a);
|
||||
|
||||
const int sort = get_int(F_SORT);
|
||||
a.TArray::sort(dongle_compare, (void*)&sort);
|
||||
@ -467,9 +592,10 @@ void Tdnist_mask::fill_sheet()
|
||||
s.force_update();
|
||||
|
||||
enable(DLG_ELABORA, !s.empty());
|
||||
return true;
|
||||
}
|
||||
|
||||
void Tdnist_mask::merge_sheet()
|
||||
void Tdninst_mask::merge_sheet()
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_DNSHEET);
|
||||
|
||||
@ -517,114 +643,138 @@ void Tdnist_mask::merge_sheet()
|
||||
}
|
||||
}
|
||||
|
||||
killed = row->get(_c_killed);
|
||||
if (killed.blank())
|
||||
o1 = row->get(_c_suspend); o1.trim();
|
||||
c1 = row->get(_c_dbsuspend); c1.trim();
|
||||
if (o1 != c1)
|
||||
{
|
||||
killed = row->get(_c_dbkilled);
|
||||
if (killed.full())
|
||||
row->add(killed, _c_killed);
|
||||
row->add(c1, _c_suspend);
|
||||
changed++;
|
||||
}
|
||||
|
||||
o1 = row->get(_c_killed); o1.trim();
|
||||
c1 = row->get(_c_dbkilled); c1.trim();
|
||||
if (o1 != c1)
|
||||
{
|
||||
row->add(c1, _c_killed);
|
||||
changed++;
|
||||
}
|
||||
}
|
||||
|
||||
sheet.force_update();
|
||||
TString msg; msg.format(FR("Sono state aggiornate %d chiavi"), changed);
|
||||
TString msg; msg.format(FR("Sono stati aggiornati %d campi"), changed);
|
||||
xvt_dm_popup_message(msg);
|
||||
}
|
||||
|
||||
bool Tdninst_mask::send_remote_dninst(const TString& ftp) const
|
||||
{
|
||||
int at = ftp.find('@', 6); if (at < 0) at = 5;
|
||||
int slash = ftp.find('/', at+1);
|
||||
const TString& server = ftp.sub(at+1, slash);
|
||||
|
||||
bool sent = false;
|
||||
TSocketClient aga;
|
||||
CONNID id = aga.QueryConnection("21", server);
|
||||
if (id > 0)
|
||||
{
|
||||
TString16 user = "guastalla", password = "tk0nmo4q3";
|
||||
const int colon = ftp.find(':', 6);
|
||||
if (colon > 6 && colon < at)
|
||||
{
|
||||
user = ftp.sub(6, colon);
|
||||
password = ftp.sub(colon+1, at);
|
||||
}
|
||||
sent = aga.FtpSendFile(id, ftp.mid(slash), DNINST_ZIP, user, password);
|
||||
aga.RemoveConnection(id);
|
||||
}
|
||||
if (!sent)
|
||||
{
|
||||
if (is_running())
|
||||
cantwrite_box(ftp);
|
||||
else
|
||||
{
|
||||
TString msg;
|
||||
msg << TR("Impossibile aggiornare il file ") << ftp;
|
||||
log(2, msg);
|
||||
}
|
||||
}
|
||||
|
||||
return sent;
|
||||
}
|
||||
|
||||
void Tdninst_mask::save_sheet()
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_DNSHEET);
|
||||
TString str;
|
||||
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||||
{
|
||||
const int key = row->get_int(0);
|
||||
if (key > 0)
|
||||
{
|
||||
str = row->get(_c_oem);
|
||||
_dninst.set(key, "OEM", str.trim());
|
||||
str = row->get(_c_owner);
|
||||
_dninst.set(key, "Owner", str.trim());
|
||||
str = row->get(_c_suspend);
|
||||
_dninst.set(key, "MustCall", str.trim());
|
||||
str = row->get(_c_killed);
|
||||
_dninst.set(key, "*", str.trim());
|
||||
}
|
||||
}
|
||||
if (_dninst.save(10))
|
||||
{
|
||||
fill_sheet();
|
||||
const TFilename ftp10 = remote_dninst(10);
|
||||
if (ftp10 != DNINST_ZIP && ftp10.starts_with("ftp://"))
|
||||
if (!is_running() || yesno_box(FR("Copiare il DNINST locale in %s?"), (const char*)ftp10))
|
||||
{
|
||||
send_remote_dninst(ftp10);
|
||||
|
||||
if (fcopy(DNINST_ZIP, DNINST_BAK))
|
||||
{
|
||||
_dninst.save(11);
|
||||
const TFilename ftp11 = remote_dninst(11);
|
||||
send_remote_dninst(ftp11);
|
||||
fcopy(DNINST_BAK, DNINST_ZIP);
|
||||
remove(DNINST_BAK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static word _last_serno;
|
||||
|
||||
bool Tdnist_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
bool Tdninst_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case DLG_RECALC:
|
||||
if (e == fe_button && check_fields())
|
||||
{
|
||||
save_profile();
|
||||
|
||||
const TString& n = remote_dninst();
|
||||
if (n.full())
|
||||
{
|
||||
TFilename tmp; tmp.tempdir(); tmp.add("dninst.zip");
|
||||
if (fcopy(n, tmp, false, true) && fsize(tmp) > 0)
|
||||
{
|
||||
fcopy(tmp, DNINST_ZIP);
|
||||
tmp.fremove();
|
||||
}
|
||||
else
|
||||
cantread_box(n);
|
||||
}
|
||||
get_remote_dninst();
|
||||
fill_sheet();
|
||||
}
|
||||
break;
|
||||
case DLG_ELABORA:
|
||||
if (e == fe_button && yesno_box(TR("Riporare sul DNINST tutte le chiavi presenti solo su DB?")))
|
||||
{
|
||||
if (e == fe_button && yesno_box(TR("Aggiornare il file DNINST in base al DB MySQL?")))
|
||||
merge_sheet();
|
||||
}
|
||||
break;
|
||||
case DLG_SAVEREC:
|
||||
if (e == fe_button)
|
||||
save_sheet();
|
||||
break;
|
||||
case F_ZIP_ON:
|
||||
if (e == fe_init && o.get().empty())
|
||||
set(F_ZIP_ON, "X", 0x1);
|
||||
break;
|
||||
case F_ZIP_WWW:
|
||||
if ((e == fe_init || e == fe_modify || e == fe_close) && o.empty())
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_DNSHEET);
|
||||
TString str;
|
||||
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||||
{
|
||||
const int key = row->get_int(0);
|
||||
if (key > 0)
|
||||
{
|
||||
str = row->get(_c_oem);
|
||||
_dninst.set(key, "OEM", str.trim());
|
||||
str = row->get(_c_owner);
|
||||
_dninst.set(key, "Owner", str.trim());
|
||||
str = row->get(_c_suspend);
|
||||
_dninst.set(key, "MustCall", str.trim());
|
||||
str = row->get(_c_killed);
|
||||
_dninst.set(key, "*", str.trim());
|
||||
}
|
||||
}
|
||||
if (_dninst.save())
|
||||
{
|
||||
fill_sheet();
|
||||
const TString& ftp = remote_dninst();
|
||||
if (ftp != DNINST_ZIP && ftp.starts_with("ftp://")
|
||||
&& yesno_box(FR("Copiare il DNINST locale in %s?"), (const char*)ftp))
|
||||
{
|
||||
int at = ftp.find('@', 6); if (at < 0) at = 5;
|
||||
int slash = ftp.find('/', at+1);
|
||||
const TString& server = ftp.sub(at+1, slash);
|
||||
|
||||
bool sent = false;
|
||||
TSocketClient aga;
|
||||
CONNID id = aga.QueryConnection("21", server);
|
||||
if (id > 0)
|
||||
{
|
||||
TString16 user = "guastalla", password = "tk0nmo4q3";
|
||||
const int colon = ftp.find(':', 6);
|
||||
if (colon > 6 && colon < at)
|
||||
{
|
||||
user = ftp.sub(6, colon);
|
||||
password = ftp.sub(colon+1, at);
|
||||
}
|
||||
sent = aga.FtpSendFile(id, ftp.mid(slash), DNINST_ZIP, user, password);
|
||||
aga.RemoveConnection(id);
|
||||
}
|
||||
if (!sent)
|
||||
cantwrite_box(ftp);
|
||||
}
|
||||
}
|
||||
set(F_ZIP_WWW, "85.18.53.183");
|
||||
set(F_ZIP_USR, "guastalla");
|
||||
set(F_ZIP_PWD, "tk0nmo4q3");
|
||||
}
|
||||
break;
|
||||
case F_DNINST_ON:
|
||||
if (e == fe_init)
|
||||
{
|
||||
if (field(F_DNINST).empty())
|
||||
set(F_DNINST, "ftp://guastalla:tk0nmo4q3@85.18.53.183/release/v_11.0/program");
|
||||
if (field(F_FTP).empty())
|
||||
set(F_FTP, "ftp://attivazioni:viagra@85.18.53.183");
|
||||
}
|
||||
break;
|
||||
case F_DSN:
|
||||
case F_DSN_WWW:
|
||||
if (e == fe_button && !o.empty())
|
||||
{
|
||||
TString query;
|
||||
@ -646,6 +796,16 @@ bool Tdnist_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case F_XML_WWW:
|
||||
if ((e == fe_init || e == fe_modify || e == fe_close) && o.empty())
|
||||
{
|
||||
o.set(get(F_XML_WWW));
|
||||
if (o.empty())
|
||||
o.set("85.18.53.183");
|
||||
set(F_XML_USR, "attivazioni");
|
||||
set(F_XML_PWD, "viagra");
|
||||
}
|
||||
break;
|
||||
case F_SORT:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
@ -720,7 +880,7 @@ bool Tdnist_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
return true;
|
||||
}
|
||||
|
||||
Tdnist_mask::Tdnist_mask() : TAutomask("ba2800a")
|
||||
Tdninst_mask::Tdninst_mask() : TAutomask("ba2800a")
|
||||
{
|
||||
const TSheet_field& s = sfield(F_DNSHEET);
|
||||
TMask& m = s.sheet_mask();
|
||||
@ -768,8 +928,13 @@ bool Tdninst_manager::create()
|
||||
|
||||
void Tdninst_manager::main_loop()
|
||||
{
|
||||
Tdnist_mask m;
|
||||
m.run();
|
||||
Tdninst_mask m;
|
||||
|
||||
const TFixed_string a(argv(1));
|
||||
if (a == "-A" || a == "/A")
|
||||
m.overnight_batch();
|
||||
else
|
||||
m.run();
|
||||
}
|
||||
|
||||
int ba2800(int argc, char* argv[])
|
||||
|
48
ba/ba2800a.h
48
ba/ba2800a.h
@ -1,22 +1,30 @@
|
||||
#define F_DNINST 201
|
||||
#define F_DSN 202
|
||||
#define F_FTP 203
|
||||
#define F_DNINST_ON 211
|
||||
#define F_DSN_ON 212
|
||||
#define F_FTP_ON 213
|
||||
#define F_ZIP_ON 201
|
||||
#define F_ZIP_WWW 202
|
||||
#define F_ZIP_USR 203
|
||||
#define F_ZIP_PWD 204
|
||||
|
||||
#define F_SORT 219
|
||||
#define F_DNSHEET 220
|
||||
#define F_DSN_ON 211
|
||||
#define F_DSN_WWW 212
|
||||
#define F_DSN_USR 213
|
||||
#define F_DSN_PWD 214
|
||||
|
||||
#define F_NUMBER 101
|
||||
#define F_OEM 102
|
||||
#define F_OWNER 103
|
||||
#define F_SUSPEND 104
|
||||
#define F_KILLED 105
|
||||
#define F_DBOEM 106
|
||||
#define F_DBOWNER 107
|
||||
#define F_DBSUSPEND 108
|
||||
#define F_DBKILLED 109
|
||||
#define F_ATOEM 110
|
||||
#define F_ATOWNER 111
|
||||
#define F_ATACCESS 112
|
||||
#define F_XML_ON 221
|
||||
#define F_XML_WWW 222
|
||||
#define F_XML_USR 223
|
||||
#define F_XML_PWD 224
|
||||
|
||||
#define F_SORT 198
|
||||
#define F_DNSHEET 199
|
||||
|
||||
#define F_NUMBER 101
|
||||
#define F_OEM 102
|
||||
#define F_OWNER 103
|
||||
#define F_SUSPEND 104
|
||||
#define F_KILLED 105
|
||||
#define F_DBOEM 106
|
||||
#define F_DBOWNER 107
|
||||
#define F_DBSUSPEND 108
|
||||
#define F_DBKILLED 109
|
||||
#define F_ATOEM 110
|
||||
#define F_ATOWNER 111
|
||||
#define F_ATACCESS 112
|
||||
|
@ -27,44 +27,88 @@ ENDPAGE
|
||||
|
||||
PAGE "Gestione attivazioni" 0 2 0 0
|
||||
|
||||
BOOLEAN F_DNINST_ON
|
||||
BOOLEAN F_ZIP_ON
|
||||
BEGIN
|
||||
PROMPT 1 0 "DNINST (HTTP/FTP)"
|
||||
MESSAGE FALSE DISABLE,F_DNINST
|
||||
MESSAGE TRUE ENABLE,F_DNINST
|
||||
MESSAGE FALSE DISABLE,1@
|
||||
MESSAGE TRUE ENABLE,1@
|
||||
END
|
||||
|
||||
STRING F_DNINST 256 50
|
||||
STRING F_ZIP_WWW 32 20
|
||||
BEGIN
|
||||
PROMPT 28 0 ""
|
||||
PROMPT 22 0 ""
|
||||
CHECKTYPE REQUIRED
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING F_ZIP_USR 32 20
|
||||
BEGIN
|
||||
PROMPT 46 0 ""
|
||||
CHECKTYPE REQUIRED
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING F_ZIP_PWD 32 10
|
||||
BEGIN
|
||||
PROMPT 68 0 ""
|
||||
CHECKTYPE REQUIRED
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_DSN_ON
|
||||
BEGIN
|
||||
PROMPT 1 1 "DSN (ODBC)"
|
||||
MESSAGE FALSE DISABLE,F_DSN
|
||||
MESSAGE TRUE ENABLE,F_DSN
|
||||
MESSAGE FALSE DISABLE,2@
|
||||
MESSAGE TRUE ENABLE,2@
|
||||
END
|
||||
|
||||
STRING F_DSN 256 50
|
||||
STRING F_DSN_WWW 256 20
|
||||
BEGIN
|
||||
PROMPT 28 1 ""
|
||||
PROMPT 22 1 ""
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "B"
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
BOOLEAN F_FTP_ON
|
||||
STRING F_DSN_USR 32 20
|
||||
BEGIN
|
||||
PROMPT 46 1 ""
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
STRING F_DSN_PWD 32 10
|
||||
BEGIN
|
||||
PROMPT 68 1 ""
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
BOOLEAN F_XML_ON
|
||||
BEGIN
|
||||
PROMPT 1 2 "XML (FTP)"
|
||||
MESSAGE FALSE DISABLE,F_FTP
|
||||
MESSAGE TRUE ENABLE,F_FTP
|
||||
MESSAGE FALSE DISABLE,3@
|
||||
MESSAGE TRUE ENABLE,3@
|
||||
END
|
||||
|
||||
STRING F_FTP 256 50
|
||||
STRING F_XML_WWW 50 20
|
||||
BEGIN
|
||||
PROMPT 28 2 ""
|
||||
PROMPT 22 2 ""
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "G"
|
||||
GROUP 3
|
||||
END
|
||||
|
||||
STRING F_XML_USR 32 20
|
||||
BEGIN
|
||||
PROMPT 46 2 ""
|
||||
CHECKTYPE REQUIRED
|
||||
GROUP 3
|
||||
END
|
||||
|
||||
STRING F_XML_PWD 32 10
|
||||
BEGIN
|
||||
PROMPT 68 2 ""
|
||||
CHECKTYPE REQUIRED
|
||||
GROUP 3
|
||||
END
|
||||
|
||||
LIST F_SORT 1 16
|
||||
@ -73,6 +117,7 @@ BEGIN
|
||||
ITEM "0|Chiave"
|
||||
ITEM "1|Rivenditore"
|
||||
ITEM "2|Cliente"
|
||||
ITEM "3|Accesso"
|
||||
END
|
||||
|
||||
SPREADSHEET F_DNSHEET
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
HIDDEN inline TGeneric_table_app& app() { return (TGeneric_table_app&)main_app(); }
|
||||
|
||||
TGeneric_table_app::TGeneric_table_app()
|
||||
: _exist_journal(FALSE), _stampa_intest(FALSE)
|
||||
: _exist_journal(false), _stampa_intest(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ HIDDEN bool tiporeg_handler(TMask_field& f, KEY k)
|
||||
return f.error_box(TR("Non e' possibile avere due registri dichiarazioni d'intenti nello stesso anno"));
|
||||
if (k == K_SPACE)
|
||||
f.mask().enable_page(1, tipo != REG_DICHINT);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
HIDDEN bool printer_handler(TMask_field& f, KEY k)
|
||||
@ -272,7 +272,7 @@ HIDDEN bool printer_handler(TMask_field& f, KEY k)
|
||||
return f.error_box(TR("Nessun registro selezionato"));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
char TGeneric_table_app::frequenza_versamenti(long firm, int year) const
|
||||
@ -304,7 +304,7 @@ HIDDEN bool ditta_handler(TMask_field& f, KEY k)
|
||||
TFirm firm(ditta);
|
||||
f.mask().set(F_CODVAL, firm.codice_valuta());
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
HIDDEN bool coddel_handler(TMask_field& f, KEY k)
|
||||
@ -334,7 +334,7 @@ HIDDEN bool coddel_handler(TMask_field& f, KEY k)
|
||||
const bool isdel = anag.get_long("TIPOSTDEL") == 0l;
|
||||
|
||||
if (titcf && isdel)
|
||||
return TRUE; // Se e' titolare CF e ha scelto la delega vanno abilitati sia
|
||||
return true; // Se e' titolare CF e ha scelto la delega vanno abilitati sia
|
||||
// Il codice conc. che la banca
|
||||
if (id == F_CONCESSIONE)
|
||||
{
|
||||
@ -355,7 +355,7 @@ HIDDEN bool coddel_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
HIDDEN bool intdel_handler(TMask_field& f, KEY k)
|
||||
@ -383,7 +383,7 @@ HIDDEN bool intdel_handler(TMask_field& f, KEY k)
|
||||
else if (!imp.is_zero() && imp == intr)
|
||||
return f.error_box(TR("Incoerenza importo versato e interessi"));
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
HIDDEN bool impdel_handler(TMask_field& f, KEY k)
|
||||
@ -424,7 +424,7 @@ HIDDEN bool impdel_handler(TMask_field& f, KEY k)
|
||||
return f.yesno_box(FR("Importo inferiore a %s. Registrare ugualmente?"), lim.string("."));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
HIDDEN bool mese_handler(TMask_field& f, KEY k)
|
||||
@ -454,7 +454,7 @@ HIDDEN bool mese_handler(TMask_field& f, KEY k)
|
||||
attiv.put("CODATT",attprev);
|
||||
if (attiv.read() != NOERR) attiv.zero();
|
||||
bool benzinaio = attiv.get_bool("ART74_4");
|
||||
bool gest4 = FALSE;
|
||||
bool gest4 = false;
|
||||
if (benzinaio)
|
||||
{
|
||||
TConfig cnf(CONFIG_DITTA, "cg");
|
||||
@ -479,7 +479,7 @@ HIDDEN bool mese_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
HIDDEN bool key_handler(TMask& m, KEY k)
|
||||
@ -490,7 +490,7 @@ HIDDEN bool key_handler(TMask& m, KEY k)
|
||||
if (k == K_SHIFT+K_F12)
|
||||
m.enable(-3);
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TGeneric_table_app::valute_decimals_handler(TMask_field& f, KEY k)
|
||||
@ -511,7 +511,7 @@ bool TGeneric_table_app::valute_decimals_handler(TMask_field& f, KEY k)
|
||||
|
||||
bool TGeneric_table_app::change_decimals_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.to_check(k, TRUE))
|
||||
if (k == K_TAB && f.to_check(k, true))
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const int dec = m.get_int(FLD_TABCAM_I2);
|
||||
@ -536,7 +536,7 @@ bool TGeneric_table_app::change_decimals_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
m.set(FLD_TABCAM_R10, cambio);
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TGeneric_table_app::codcab_handler(TMask_field& f, KEY k)
|
||||
@ -549,7 +549,7 @@ bool TGeneric_table_app::codcab_handler(TMask_field& f, KEY k)
|
||||
if (rec.empty())
|
||||
return f.error_box(FR("Il codice ABI %s non esiste"), (const char*)abi);
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TGeneric_table_app::codmag_handler(TMask_field& f, KEY k)
|
||||
|
@ -84,7 +84,7 @@ BEGIN
|
||||
FIELD CODALT
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 76 6
|
||||
GROUPBOX DLG_NULL 76 4
|
||||
BEGIN
|
||||
PROMPT 1 6 "@bCliente/Fornitore"
|
||||
END
|
||||
@ -101,13 +101,14 @@ NUMBER F_CODCF 6
|
||||
BEGIN
|
||||
PROMPT 16 7 ""
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF F_TIPOCF
|
||||
INPUT TIPOCF F_TIPOCF SELECT
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Cod. Alt.@15" RICALT
|
||||
DISPLAY "Codice Fiscale@16" COFI
|
||||
DISPLAY "Partita IVA@15" PAIV
|
||||
OUTPUT F_CODCF CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
FIELD CODCF
|
||||
END
|
||||
|
@ -28,7 +28,7 @@ NUMBER F_CODICECAB 5
|
||||
BEGIN
|
||||
PROMPT 28 1 "Codice CAB "
|
||||
FIELD CODTAB[6,10]
|
||||
FLAGS "Z"
|
||||
FLAGS "GZ"
|
||||
KEY 1
|
||||
USE %BAN
|
||||
INPUT CODTAB[1,5] F_CODICEABI
|
||||
|
Loading…
x
Reference in New Issue
Block a user