Patch level : 10.0
Files correlati : ba7.exe Ricompilazione Demo : [ ] Commento : Convertita maschera di gestione postino e migliorata gestione transazioni di inserimento git-svn-id: svn://10.65.10.50/trunk@19360 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e130c6af43
commit
b307763864
@ -472,6 +472,7 @@ class TMailer_mask : public TAutomask
|
|||||||
int _mail_semaphore;
|
int _mail_semaphore;
|
||||||
TMail_messages _box;
|
TMail_messages _box;
|
||||||
bool _sequential;
|
bool _sequential;
|
||||||
|
clock_t _last_use;
|
||||||
|
|
||||||
TString_array _key1; // Elenco dei campi della chiave principale dei files
|
TString_array _key1; // Elenco dei campi della chiave principale dei files
|
||||||
TAssoc_array _apps; // Elenco delle applicazioni per processare i files
|
TAssoc_array _apps; // Elenco delle applicazioni per processare i files
|
||||||
@ -488,13 +489,14 @@ protected:
|
|||||||
void load_sheet(TConfig& ini, short dlg, const char* var);
|
void load_sheet(TConfig& ini, short dlg, const char* var);
|
||||||
|
|
||||||
TToken_string& get_key1(int lf) const;
|
TToken_string& get_key1(int lf) const;
|
||||||
bool build_key1(int lf, const TString& body, TToken_string& key) const;
|
bool build_key1(int lf, const TString& body, TToken_string& key, TString& action) const;
|
||||||
bool build_key1(const TMail_message& msg, TToken_string& key) const;
|
bool build_key1(const TMail_message& msg, TToken_string& key, TString& action) const;
|
||||||
void find_redundant_messages();
|
void find_redundant_messages();
|
||||||
|
|
||||||
void track(const TMail_message& msg, const TString& app, const TString& action, int err);
|
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);
|
bool exec_app(int & err, const TString& appname, TMail_message & msg, TToken_string & sh_row);
|
||||||
void scan_dir(const TFilename& dir, TMail_messages& box) const;
|
void scan_dir(const TFilename& dir, TMail_messages& box) const;
|
||||||
|
bool unattended() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void test_delete();
|
void test_delete();
|
||||||
@ -688,6 +690,8 @@ void TMailer_mask::fill_messages()
|
|||||||
return;
|
return;
|
||||||
_mail_semaphore = 1;
|
_mail_semaphore = 1;
|
||||||
|
|
||||||
|
disable(DLG_DELREC);
|
||||||
|
|
||||||
TWait_cursor hourglass;
|
TWait_cursor hourglass;
|
||||||
|
|
||||||
TFilename server(get(F_SERVER));
|
TFilename server(get(F_SERVER));
|
||||||
@ -880,6 +884,7 @@ void adjust_long_lines(const TFilename& tmp)
|
|||||||
void TMailer_mask::track(const TMail_message& msg, const TString& app, const TString& action, int err)
|
void TMailer_mask::track(const TMail_message& msg, const TString& app, const TString& action, int err)
|
||||||
{
|
{
|
||||||
const TString& fname = get(F_TRACKING);
|
const TString& fname = get(F_TRACKING);
|
||||||
|
|
||||||
if (fname.full())
|
if (fname.full())
|
||||||
{
|
{
|
||||||
const char fldsep = '\t';
|
const char fldsep = '\t';
|
||||||
@ -893,7 +898,9 @@ void TMailer_mask::track(const TMail_message& msg, const TString& app, const TSt
|
|||||||
const real t = msg.time();
|
const real t = msg.time();
|
||||||
log << t.string("@@:@@:@@") << fldsep;
|
log << t.string("@@:@@:@@") << fldsep;
|
||||||
|
|
||||||
TToken_string k1; build_key1(msg, k1);
|
TToken_string k1;
|
||||||
|
TString act;
|
||||||
|
build_key1(msg, k1, act);
|
||||||
log << k1.get(0) << fldsep;
|
log << k1.get(0) << fldsep;
|
||||||
|
|
||||||
const int pipe = k1.find(k1.separator());
|
const int pipe = k1.find(k1.separator());
|
||||||
@ -1078,7 +1085,7 @@ TToken_string& TMailer_mask::get_key1(int lf) const
|
|||||||
return *key;
|
return *key;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TMailer_mask::build_key1(int lf, const TString& body, TToken_string& key) const
|
bool TMailer_mask::build_key1(int lf, const TString& body, TToken_string& key, TString& action) const
|
||||||
{
|
{
|
||||||
key.format("%d", lf);
|
key.format("%d", lf);
|
||||||
|
|
||||||
@ -1107,10 +1114,21 @@ bool TMailer_mask::build_key1(int lf, const TString& body, TToken_string& key) c
|
|||||||
}
|
}
|
||||||
key.add(value);
|
key.add(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int act = body.find("\nAction");
|
||||||
|
const int ugu = body.find('=', act);
|
||||||
|
const int nwl = body.find('\n', ugu);
|
||||||
|
if (act > 0 && ugu > act && ugu < nwl)
|
||||||
|
{
|
||||||
|
action = body.sub(ugu+1,nwl);
|
||||||
|
action.trim();
|
||||||
|
action.upper();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TMailer_mask::build_key1(const TMail_message& msg, TToken_string& key) const
|
bool TMailer_mask::build_key1(const TMail_message& msg, TToken_string& key, TString& action) const
|
||||||
{
|
{
|
||||||
TString body;
|
TString body;
|
||||||
FOR_EACH_ARRAY_ROW(msg, r, row)
|
FOR_EACH_ARRAY_ROW(msg, r, row)
|
||||||
@ -1127,7 +1145,7 @@ bool TMailer_mask::build_key1(const TMail_message& msg, TToken_string& key) cons
|
|||||||
else
|
else
|
||||||
lfile = atoi(subj);
|
lfile = atoi(subj);
|
||||||
|
|
||||||
return build_key1(lfile, body, key);
|
return build_key1(lfile, body, key, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMailer_mask::find_redundant_messages()
|
void TMailer_mask::find_redundant_messages()
|
||||||
@ -1136,11 +1154,11 @@ void TMailer_mask::find_redundant_messages()
|
|||||||
TAssoc_array andreotti;
|
TAssoc_array andreotti;
|
||||||
|
|
||||||
TSheet_field& sf = sfield(F_MESSAGES);
|
TSheet_field& sf = sfield(F_MESSAGES);
|
||||||
TString subj, body;
|
TString subj, body, action;
|
||||||
TToken_string key1;
|
TToken_string key1;
|
||||||
|
|
||||||
// Scorro tutti i messaggi non ancora elaborati
|
// Scorro tutti i messaggi non ancora elaborati
|
||||||
FOR_EACH_SHEET_ROW_BACK(sf, nrow, row) if (*row->get(0) != 'X')
|
FOR_EACH_SHEET_ROW_BACK(sf, nrow, row) if (row->get_char(0) != 'X')
|
||||||
{
|
{
|
||||||
row->get(sf.cid2index(F_BODY), body);
|
row->get(sf.cid2index(F_BODY), body);
|
||||||
if (body.find("[Transaction]") < 0) // Scarto i messaggi che non siano transazioni
|
if (body.find("[Transaction]") < 0) // Scarto i messaggi che non siano transazioni
|
||||||
@ -1158,9 +1176,9 @@ void TMailer_mask::find_redundant_messages()
|
|||||||
else
|
else
|
||||||
lfile = atoi(subj);
|
lfile = atoi(subj);
|
||||||
|
|
||||||
if (build_key1(lfile, body, key1))
|
if (build_key1(lfile, body, key1, action))
|
||||||
{
|
{
|
||||||
if (andreotti.is_key(key1))
|
if (andreotti.is_key(key1) && action != "INSERT") // Non considero ridondanti gli inserimenti!
|
||||||
row->add("R", 0); // Messaggio ridondante!
|
row->add("R", 0); // Messaggio ridondante!
|
||||||
else
|
else
|
||||||
andreotti.add(key1); // Messaggio da processare!
|
andreotti.add(key1); // Messaggio da processare!
|
||||||
@ -1245,13 +1263,16 @@ void TMailer_mask::save_all_lines()
|
|||||||
vv.goto_end();
|
vv.goto_end();
|
||||||
|
|
||||||
sf.force_update(); // Fai apparire tutte le X
|
sf.force_update(); // Fai apparire tutte le X
|
||||||
_mail_semaphore = 0;
|
|
||||||
|
enable(DLG_DELREC);
|
||||||
|
enable(DLG_DELLOG, bf.lines() > 0);
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
if (one_saved && yesno_box("Si desidera eliminare i messaggi processati?"))
|
one_saved &= yesno_box("Si desidera eliminare i messaggi processati?");
|
||||||
#else
|
|
||||||
if (one_saved)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_mail_semaphore = 0;
|
||||||
|
if (one_saved)
|
||||||
{
|
{
|
||||||
test_delete();
|
test_delete();
|
||||||
fill_messages();
|
fill_messages();
|
||||||
@ -1394,6 +1415,9 @@ bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_last_use = clock();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1417,23 +1441,28 @@ void TMailer_mask::auto_save_all()
|
|||||||
if (_mail_semaphore == 0)
|
if (_mail_semaphore == 0)
|
||||||
{
|
{
|
||||||
TSheet_field& sf = sfield(F_MESSAGES);
|
TSheet_field& sf = sfield(F_MESSAGES);
|
||||||
|
|
||||||
#ifdef DBG
|
|
||||||
if (sf.items() > 0 && yesno_box(TR("Si desidera eliminare i messaggi processati?")))
|
|
||||||
#endif
|
|
||||||
test_delete();
|
test_delete();
|
||||||
if (sf.items() == 0)
|
if (sf.items() == 0)
|
||||||
fill_messages();
|
fill_messages();
|
||||||
if (_interval > 0)
|
if (_interval > 0 && sf.items() > 0)
|
||||||
{
|
save_all_lines();
|
||||||
if (sf.items() > 0)
|
|
||||||
save_all_lines();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NFCHECK("Can't save locked mail");
|
NFCHECK("Can't save locked mail");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TMailer_mask::unattended() const
|
||||||
|
{
|
||||||
|
if (!xvt_vobj_is_focusable(win()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
RCT r; xvt_vobj_get_outer_rect(TASK_WIN, &r);
|
||||||
|
if (r.bottom - r.top < 64)
|
||||||
|
return true; // Finestra principale iconizzata
|
||||||
|
|
||||||
|
return (clock()-_last_use) > 10*CLOCKS_PER_SEC;
|
||||||
|
}
|
||||||
|
|
||||||
void TMailer_mask::handler(WINDOW win, EVENT* ep)
|
void TMailer_mask::handler(WINDOW win, EVENT* ep)
|
||||||
{
|
{
|
||||||
if (ep->type == E_TIMER)
|
if (ep->type == E_TIMER)
|
||||||
@ -1444,7 +1473,7 @@ void TMailer_mask::handler(WINDOW win, EVENT* ep)
|
|||||||
if (_secs >= _interval)
|
if (_secs >= _interval)
|
||||||
{
|
{
|
||||||
_secs = 0L;
|
_secs = 0L;
|
||||||
if (_mail_semaphore == 0)
|
if (_mail_semaphore == 0 && unattended())
|
||||||
auto_save_all();
|
auto_save_all();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1484,7 +1513,7 @@ void TMailer_mask::load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
TMailer_mask::TMailer_mask()
|
TMailer_mask::TMailer_mask()
|
||||||
: TAutomask("ba7100a"), _timer_id(XVT_TIMER_ERROR), _mail_semaphore(0)
|
: TAutomask("ba7100a"), _timer_id(XVT_TIMER_ERROR), _mail_semaphore(0), _last_use(0)
|
||||||
{
|
{
|
||||||
load();
|
load();
|
||||||
|
|
||||||
|
@ -4,16 +4,59 @@ TOOLBAR "topbar" 0 0 0 2
|
|||||||
|
|
||||||
BUTTON DLG_SAVEREC 10 2
|
BUTTON DLG_SAVEREC 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -12 -11 ""
|
PROMPT -12 -11 "Elabora"
|
||||||
PICTURE BMP_SAVEREC
|
PICTURE TOOL_ELABORA
|
||||||
PICTURE BMP_SAVERECDN
|
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_QUIT 10 2
|
BUTTON DLG_DELREC 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -22 -11 ""
|
PROMPT -11 -1 "Transazioni"
|
||||||
PICTURE BMP_QUIT
|
PICTURE BMP_DELREC
|
||||||
PICTURE BMP_QUITDN
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_NULL 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -1 1 ""
|
||||||
|
PICTURE 0
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_PRINT 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -22 -1 ""
|
||||||
|
PICTURE BMP_PRINT
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_DELLOG 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -12 -1 "Log"
|
||||||
|
PICTURE TOOL_DELREC
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_NULL 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -1 1 ""
|
||||||
|
PICTURE 0
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_INFO 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 "Info"
|
||||||
|
MESSAGE EXIT,K_F2
|
||||||
|
PICTURE TOOL_INFO
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_HELP 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 1 "Help"
|
||||||
|
MESSAGE EXIT,K_F1
|
||||||
|
PICTURE TOOL_HELP
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_QUIT 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 4 1 "Fine"
|
||||||
|
MESSAGE EXIT,K_QUIT
|
||||||
|
PICTURE TOOL_QUIT
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
@ -73,7 +116,7 @@ BEGIN
|
|||||||
PROMPT 55 3 "Elimina transazioni annullate"
|
PROMPT 55 3 "Elimina transazioni annullate"
|
||||||
END
|
END
|
||||||
|
|
||||||
SPREADSHEET F_MESSAGES 0 -3
|
SPREADSHEET F_MESSAGES 0 -1
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 0 4 ""
|
PROMPT 0 4 ""
|
||||||
ITEM "@1"
|
ITEM "@1"
|
||||||
@ -88,13 +131,6 @@ BEGIN
|
|||||||
FLAGS "|"
|
FLAGS "|"
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_DELREC 10 2
|
|
||||||
BEGIN
|
|
||||||
PROMPT -11 -1 ""
|
|
||||||
PICTURE BMP_DELREC
|
|
||||||
PICTURE BMP_DELRECDN
|
|
||||||
END
|
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
PAGE "Spedizione" 0 0 0 -2
|
PAGE "Spedizione" 0 0 0 -2
|
||||||
@ -132,24 +168,11 @@ ENDPAGE
|
|||||||
|
|
||||||
PAGE "Log" 0 0 0 -2
|
PAGE "Log" 0 0 0 -2
|
||||||
|
|
||||||
BROWSEFILE F_LOG -1 -2
|
BROWSEFILE F_LOG -3 -1
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 0 1 ""
|
PROMPT 0 1 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_DELLOG 10 2
|
|
||||||
BEGIN
|
|
||||||
PROMPT -12 -1 ""
|
|
||||||
PICTURE BMP_DELREC
|
|
||||||
PICTURE BMP_DELRECDN
|
|
||||||
END
|
|
||||||
|
|
||||||
BUTTON DLG_PRINT 10 2
|
|
||||||
BEGIN
|
|
||||||
PROMPT -22 -1 ""
|
|
||||||
PICTURE BMP_PRINT
|
|
||||||
END
|
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
@ -287,7 +310,6 @@ BUTTON DLG_DELREC 10 2
|
|||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -23 -1 ""
|
PROMPT -23 -1 ""
|
||||||
PICTURE BMP_DELREC
|
PICTURE BMP_DELREC
|
||||||
PICTURE BMP_DELRECDN
|
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_CANCEL 10 2
|
BUTTON DLG_CANCEL 10 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user