Aggiunti campi UTENTE e DATA ultima modifica per permettere sincronizzazione con Bee Store

git-svn-id: svn://10.65.10.50/branches/R_10_00@23016 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2014-12-10 16:01:42 +00:00
parent d7b93c2169
commit 87e8c62706
10 changed files with 145 additions and 45 deletions

View File

@ -7,6 +7,8 @@
#include <odbcrset.h>
#include <progind.h>
#include <reputils.h>
#include <toolfld.h>
#include <urldefid.h>
#include <utility.h>
#include <xml.h>
@ -85,6 +87,7 @@ class Tdnist_full
public:
void set(int key, const char* var, const TString& value);
TAssoc_array* get_all(int key) const;
const TString& get(int key, const char* var) const;
int last() const { return _chiavi.last(); }
bool exists(int key) const { return _chiavi.objptr(key) != NULL; }
@ -113,9 +116,15 @@ void Tdnist_full::set(int key, const char* var, const TString& value)
info->remove(var);
}
const TString& Tdnist_full::get(int key, const char* var) const
TAssoc_array* Tdnist_full::get_all(int key) const
{
TAssoc_array* info = (TAssoc_array*)_chiavi.objptr(key);
return info;
}
const TString& Tdnist_full::get(int key, const char* var) const
{
const TAssoc_array* info = get_all(key);
if (info == NULL)
return EMPTY_STRING;
const TString* val = (const TString*)info->objptr(var);
@ -1026,6 +1035,44 @@ bool Tdninst_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
o.set(oggi.string());
}
break;
case DLG_USER:
if (e == fe_button && jolly > 0)
{
TAssoc_array* vars = _dninst.get_all(o.mask().get_int(F_NUMBER));
if (vars != NULL)
{
TToken_string str(255, '\n');
FOR_EACH_ASSOC_STRING((*vars), h, k, i)
str << k << " = " << i << '\n';
TMask m(TR("Personalizzazioni"), 1, 78, 16);
m.add_button_tool(DLG_OK, TR("OK"), TOOL_OK);
m.add_button_tool(DLG_CANCEL, TR("Annulla"), TOOL_CANCEL);
m.add_memo(101, 0, "", 1, 0, -1, -1);
m.set(101, str);
if (m.run() == K_ENTER)
{
str = m.get(101);
if (str.items() > 1)
{
vars->destroy();
FOR_EACH_TOKEN(str, tok)
{
TToken_string line(tok, '=');
if (line.items() == 2)
{
TString80 key = line.get(0); key.trim();
if (key.full())
{
TString val = line.get(1); val.trim();
vars->add(key, val);
}
}
}
}
}
}
}
break;
default: break;
}
return true;

View File

@ -278,6 +278,12 @@ BEGIN
PROMPT 1 1 ""
END
BUTTON DLG_USER 2 2
BEGIN
PROMPT 1 1 "Parametri"
PIUCTURE TOOL_ELABORA
END
BUTTON DLG_NULL 2 2
BEGIN
PROMPT -1 1 ""

View File

@ -101,18 +101,25 @@ bool TMail_box::logon(const char* ser, const char* usr, const char* pwd)
if (!default_params(server, user, password))
return error_box(TR("E' necessario specificare un server POP3, un utente ed una password"));
TString msg;
msg << TR("Connessione al server POP3 ") << server;
xvtil_statbar_set(msg);
_connection = QueryConnection("110", server);
if (_connection != 0)
{
TString buf, req;
msg.cut(0) << TR("Connesso al server POP3 ") << server;
xvtil_statbar_set(msg);
TString buf(255);
ReadLine(_connection, buf);
if (buf[0] != '+')
return error_box(FR("Il server POP3 %s non risponde\nRisultato : %s"),
return error_box(FR("Il server POP3 %s non risponde. Risultato:\n'%s'"),
(const char*)server, (const char *)buf);
buf = "USER "; buf << user << "\r\n";
WriteLine(_connection, buf);
req = buf;
TString req = buf;
ReadLine(_connection, buf);
if (buf[0] != '+')
return error_box(FR("Il server POP3 %s non accetta l'utente %s\nRichiesta : %sRisultato : %s"),
@ -499,7 +506,7 @@ protected:
void find_redundant_messages();
void track(const TMail_message& msg, const TString& app, const TString& action, int err);
bool exec_app(int & err, const TString& appname, TMail_message & msg, TToken_string & sh_row);
int exec_app(const TString& appname, TMail_message & msg, TToken_string & sh_row);
void scan_ini_files(const char* dir, TString_array& result, int level) const;
void scan_dir(const TFilename& dir, TMail_messages& box) const;
bool unattended() const;
@ -507,7 +514,7 @@ protected:
public:
void test_delete();
void fill_messages();
bool save_sheet_line(int& err, int line = -1);
int save_sheet_line(int line = -1);
void save_all_lines();
void exec_scripts();
void auto_save_all(bool manual);
@ -771,6 +778,32 @@ void TMailer_mask::fill_messages()
xvtil_statbar_set(TR("Ricezione messaggi MAPI..."));
do_events();
totmapi = _box.get();
for (int i = 0; i < totmapi; i++)
{
TMail_message& msg = _box.msg(i);
const TString& subject = msg.subject();
bool kill = msg.empty() || subject.blank() || subject.len() > 4;
if (!kill)
{
TString& line = msg.row(0);
int pos = line.find("[Transaction]");
if (pos)
{
if (pos < 0)
kill = true;
else
line.ltrim(pos);
}
pos = line.find("-----");
if (pos > 0)
line.cut(pos);
}
if (kill) // Not a Campo transaction
_box.destroy(i);
}
_box.pack();
totmapi = _box.items();
}
TString4 mailer;
@ -978,9 +1011,9 @@ void TMailer_mask::track(const TMail_message& msg, const TString& app, const TSt
}
}
bool TMailer_mask::exec_app(int& err, const TString& appname, TMail_message& msg, TToken_string & sh_row)
int TMailer_mask::exec_app(const TString& appname, TMail_message& msg, TToken_string & sh_row)
{
err = NOERR;
int err = NOERR;
TString action;
if (appname.compare("sink", -1, true) == 0)
{
@ -999,7 +1032,8 @@ bool TMailer_mask::exec_app(int& err, const TString& appname, TMail_message& msg
}
else
{
TFilename tmp; tmp.temp();
TFilename tmp; tmp.temp("trn", "ini");
if (tmp.full())
{
ofstream outf(tmp);
const int items = msg.items();
@ -1059,14 +1093,15 @@ bool TMailer_mask::exec_app(int& err, const TString& appname, TMail_message& msg
track(msg, appname, action, err);
return err == NOERR;
return err;
}
bool TMailer_mask::save_sheet_line(int& err, int nrow)
int TMailer_mask::save_sheet_line(int nrow)
{
int err = NOERR;
TSheet_field& sf = sfield(F_MESSAGES);
TMask& m = sf.sheet_mask();
if (nrow < 0)
nrow = sf.selected();
else
@ -1116,25 +1151,22 @@ bool TMailer_mask::save_sheet_line(int& err, int nrow)
TFilename appname;
if (!file2app(subj, appname)) // It hasn't a valid application
{
err = NOT_GEST;
return false;
}
return err = NOT_GEST;
TMail_message& full_msg = _box.msg(nrow);
bool ok = exec_app(err, appname, full_msg, row);
if (!ok && err == _iskeynotfound)
err = exec_app(appname, full_msg, row);
if (err == _iskeynotfound)
{
TString & first_row = full_msg.row(0);
int pos = first_row.find("MODIFY");
if (pos > 0)
{
first_row.overwrite("INSERT", pos);
ok = exec_app(err, appname, full_msg, row);
err = exec_app(appname, full_msg, row);
}
}
if (ok)
if (err == NOERR)
{
if (m.is_running())
{
@ -1148,7 +1180,7 @@ bool TMailer_mask::save_sheet_line(int& err, int nrow)
}
}
return ok;
return err;
}
TToken_string& TMailer_mask::get_key1(int lf) const
@ -1334,25 +1366,23 @@ void TMailer_mask::save_all_lines()
TString body; row->get(sf.cid2index(F_BODY), body);
if (body.find("[Transaction]") >= 0)
{
int err = 0;
const bool yes = save_sheet_line(err, nrow);
if (yes)
const int err = save_sheet_line(nrow);
if (err == NOERR)
{
msg << TR("elaborato con successo");
one_saved = true;
} else
if (err == NOT_GEST)
{
const TMask& m = sf.sheet_mask();
msg << TR("definire il programma gestore del file ") << m.get(F_SUBJECT);
}
else
{
msg << TR("non elaborato a causa di un errore (n.ro ") << err << ')';
if (_sequential)
break;
}
else
if (err == NOT_GEST)
{
const TMask& m = sf.sheet_mask();
msg << TR("definire il programma gestore del file ") << m.get(F_SUBJECT);
}
else
{
msg << TR("non elaborato a causa di un errore (n.ro ") << err << ')';
if (_sequential)
break;
}
}
else
msg << TR("ignorato in quanto transazione non riconosciuta");
@ -1687,7 +1717,7 @@ bool TMailer::create()
{
if (xvt_vobj_get_attr(NULL_WIN, ATTR_APPL_ALREADY_RUNNING))
{
TString msg; msg.format(FR("Il programma %s è già in esecuzione!"), appname);
TString msg; msg.format(FR("%s già in esecuzione!"), appname);
xvt_dm_popup_error(msg);
return false;
}
@ -1696,10 +1726,21 @@ bool TMailer::create()
void TMailer::main_loop()
{
WINDOW tray = xvt_trayicon_create(TASK_WIN, 0, appname);
WINDOW tray = xvt_trayicon_create(TASK_WIN, 9013, appname); // CampoServer.ico
open_files(LF_USER, 0);
TMailer_mask mm;
if (tray != NULL_WIN)
{
// Se il postino è a tutto schermo lo minimizzo
RCT rct_screen, rct_postman;
xvt_vobj_get_outer_rect(SCREEN_WIN, &rct_screen);
xvt_vobj_get_outer_rect(TASK_WIN, &rct_postman);
if (xvt_rect_get_width(&rct_postman) >= xvt_rect_get_width(&rct_screen)-64)
xvt_vobj_set_visible(TASK_WIN, FALSE);
}
mm.run();
xvt_trayicon_destroy(tray);

View File

@ -87,7 +87,7 @@ BEGIN
GROUP G_SUPERUSER
END
STRING F_USER 32 8
STRING F_USER 64 8
BEGIN
PROMPT 41 1 "Utente "
GROUP G_SUPERUSER

View File

@ -1,3 +1,3 @@
163
0
$tabmod|0|0|691|0|Tabelle di modulo|||
$tabmod|0|0|707|0|Tabelle di modulo|||

View File

@ -1,5 +1,5 @@
163
53
55
MOD|1|2|0|Codice modulo
CUST|3|6|0|Codice cliente (opzionale)
COD|1|3|0|Codice Tabella
@ -52,6 +52,8 @@ B7|8|1|0|Booleano 7
B8|8|1|0|Booleano 8
B9|8|1|0|Booleano 9
B10|8|1|0|Booleano 10
DATAAGG|5|8|0|
UTENTE|1|16|0|
FPC|8|1|0|Record protetto
3
MOD+CUST+COD+CODTAB|

View File

@ -1,3 +1,3 @@
4
1
%tabcom|0|0|1181|0|Tabelle comuni|1500||
%tabcom|0|0|1197|0|Tabelle comuni|1500||

View File

@ -1,5 +1,5 @@
4
86
88
COD|1|3|0|
CODTAB|1|25|0|
S0|1|70|0|
@ -85,6 +85,8 @@ B12|8|1|0|
B13|8|1|0|
B14|8|1|0|
B15|8|1|0|
DATAAGG|5|8|0|
UTENTE|1|16|0|
FPC|8|1|0|
2
COD+CODTAB|

View File

@ -1,3 +1,3 @@
5
0
$tab|0|0|1181|0|Tabelle ditta|400||
$tab|0|0|1197|0|Tabelle ditta|400||

View File

@ -1,5 +1,5 @@
5
86
88
COD|1|3|0|
CODTAB|1|25|0|
S0|1|70|0|
@ -85,6 +85,8 @@ B12|8|1|0|
B13|8|1|0|
B14|8|1|0|
B15|8|1|0|
DATAAGG|5|8|0|
UTENTE|1|16|0|
FPC|8|1|0|
2
COD+CODTAB|