Patch level : 10.0 710
Files correlati : tc0.exe Ricompilazione Demo : [ ] Commento Convesrione ditte Teamsystem git-svn-id: svn://10.65.10.50/trunk@20383 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
f782770605
commit
727c7f793b
109
tc/tc0900.cpp
109
tc/tc0900.cpp
@ -6,7 +6,10 @@
|
|||||||
#include <automask.h>
|
#include <automask.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
|
#include <dongle.h>
|
||||||
#include <lffiles.h>
|
#include <lffiles.h>
|
||||||
|
#include <netsock.h>
|
||||||
|
#include <prefix.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <reprint.h>
|
#include <reprint.h>
|
||||||
@ -675,8 +678,110 @@ void TConvert_archives::convert_table(const char * tablename, TArray & fieldlist
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void build_xml_filename(TFilename& name, bool remote)
|
||||||
|
{
|
||||||
|
const long n = dongle().number();
|
||||||
|
name.format("tc_%05ld", n);
|
||||||
|
if (n == 0) // Le chiavi di sviluppo sono tutte 0, uso il nome della stazione
|
||||||
|
{
|
||||||
|
char host[80];
|
||||||
|
xvt_sys_get_host_name(host, sizeof(host));
|
||||||
|
name << host;
|
||||||
|
name.replace(' ', '_');
|
||||||
|
if (remote)
|
||||||
|
{
|
||||||
|
TString str;
|
||||||
|
time_t t; time(&t); str = ctime(&t);
|
||||||
|
|
||||||
|
str.rtrim(1);
|
||||||
|
name << '_' << str;
|
||||||
|
name.replace(' ', '_');
|
||||||
|
name.replace(':', '_');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
name.ext("xml");
|
||||||
|
}
|
||||||
|
|
||||||
|
static TXmlItem& find_or_create_child(TXmlItem& root, const char* tag, bool reset = false)
|
||||||
|
{
|
||||||
|
TXmlItem* pitem = root.FindFirstChild(tag);
|
||||||
|
if (pitem == NULL)
|
||||||
|
pitem = &root.AddChild(tag);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (reset)
|
||||||
|
{
|
||||||
|
pitem->Destroy();
|
||||||
|
pitem->SetTag(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return *pitem;
|
||||||
|
}
|
||||||
|
|
||||||
|
static TXmlItem& set_attr(TXmlItem& root, const char* name, const char* value)
|
||||||
|
{
|
||||||
|
TXmlItem& c = root.AddChild("attr");
|
||||||
|
c.SetAttr("Name", name);
|
||||||
|
|
||||||
|
TString str = value; str.trim();
|
||||||
|
c.SetAttr("Value", str);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool save_campo_xml()
|
||||||
|
{
|
||||||
|
TFilename filename; build_xml_filename(filename, false);
|
||||||
|
|
||||||
|
TXmlItem root;
|
||||||
|
|
||||||
|
root.SetTag("Campo");
|
||||||
|
|
||||||
|
TXmlItem& system = find_or_create_child(root, "system");
|
||||||
|
|
||||||
|
TFilename str;
|
||||||
|
xvt_sys_get_host_name(str.get_buffer(), str.size());
|
||||||
|
set_attr(system, "Host", str);
|
||||||
|
xvt_sys_get_user_name(str.get_buffer(), str.size());
|
||||||
|
set_attr(system, "User", str);
|
||||||
|
time_t t; time(&t); str = ctime(&t);
|
||||||
|
set_attr(system, "Time", str);
|
||||||
|
xvt_sys_get_version(str.get_buffer(), NULL, str.size());
|
||||||
|
set_attr(system, "O.S.", str);
|
||||||
|
|
||||||
|
TXmlItem& study = find_or_create_child(root, "study", true);
|
||||||
|
TXmlItem& firm = study.AddChild("firm");
|
||||||
|
|
||||||
|
set_attr(study, "DataPath", firm2dir(-1));
|
||||||
|
set_attr(firm, "Code", format("%ld", prefix().firm().codice()));
|
||||||
|
set_attr(firm, "RagSoc", prefix().firm().ragione_sociale());
|
||||||
|
|
||||||
|
root.Save(filename);
|
||||||
|
return filename.exist();
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool send_firm_xml()
|
||||||
|
{
|
||||||
|
TWait_cursor waiter;
|
||||||
|
bool ok = save_campo_xml();
|
||||||
|
if (ok && (xvt_net_get_status() & 0x4) != 0)
|
||||||
|
{
|
||||||
|
TSocketClient aga;
|
||||||
|
CONNID id = aga.QueryConnection("21", "www.aga.it");
|
||||||
|
if (id > 0)
|
||||||
|
{
|
||||||
|
TFilename local, remote;
|
||||||
|
build_xml_filename(local, false);
|
||||||
|
build_xml_filename(remote, true);
|
||||||
|
ok = aga.FtpSendFile(id, remote, local, "attivazioni", "viagra");
|
||||||
|
aga.RemoveConnection(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
void TConvert_archives::convert(bool comtables)
|
void TConvert_archives::convert(bool comtables)
|
||||||
{
|
{
|
||||||
|
send_firm_xml();
|
||||||
TArray field_infos;
|
TArray field_infos;
|
||||||
TConfig d(CONFIG_DITTA, "ca");
|
TConfig d(CONFIG_DITTA, "ca");
|
||||||
const bool usepdcc = d.get_bool("UsePdcc");
|
const bool usepdcc = d.get_bool("UsePdcc");
|
||||||
@ -984,8 +1089,10 @@ void TConvert_archives::convert(bool comtables)
|
|||||||
|
|
||||||
void TConvert_archives::main_loop()
|
void TConvert_archives::main_loop()
|
||||||
{
|
{
|
||||||
|
Tdninst d;
|
||||||
|
|
||||||
_m = new TConvert_mask;
|
_m = new TConvert_mask;
|
||||||
if (_m->run() == K_ENTER)
|
if (_m->run() == K_ENTER && d.can_I_run())
|
||||||
convert(_m->get_bool(F_CONVCOM));
|
convert(_m->get_bool(F_CONVCOM));
|
||||||
delete _m;
|
delete _m;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user