2002-09-13 14:06:05 +00:00
|
|
|
|
#include <applicat.h>
|
|
|
|
|
#include <execp.h>
|
|
|
|
|
#include <relation.h>
|
|
|
|
|
#include <sheet.h>
|
|
|
|
|
#include <tabutil.h>
|
|
|
|
|
#include <urldefid.h>
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TSelector_sheet
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TSelector_sheet : public TCursor_sheet
|
|
|
|
|
{
|
|
|
|
|
TString _field;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
static TSelector_sheet* _sheet;
|
|
|
|
|
static bool selector_handler(TMask_field& fld, KEY k);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TSelector_sheet(TCursor& cur, const char* fields, const char* caption,
|
|
|
|
|
const char* head, const TEdit_field& fld);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TSelector_sheet* TSelector_sheet::_sheet = NULL;
|
|
|
|
|
|
|
|
|
|
bool TSelector_sheet::selector_handler(TMask_field& fld, KEY k)
|
|
|
|
|
{
|
|
|
|
|
long sel = -1;
|
|
|
|
|
|
|
|
|
|
if (k == K_F2)
|
|
|
|
|
sel = 0;
|
|
|
|
|
|
|
|
|
|
if (k == K_TAB)
|
|
|
|
|
{
|
|
|
|
|
TCursor& cur = *_sheet->cursor();
|
|
|
|
|
((TEdit_field&)fld).autosave(*cur.relation());
|
|
|
|
|
sel = cur.read();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sel >= 0 && sel != _sheet->selected())
|
|
|
|
|
_sheet->post_select(sel);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSelector_sheet::TSelector_sheet(TCursor& cur, const char* fields, const char* caption,
|
|
|
|
|
const char* head, const TEdit_field& c)
|
|
|
|
|
: TCursor_sheet(&cur, fields, caption, head, 0x3, 1, SCREEN_WIN)
|
|
|
|
|
{
|
|
|
|
|
TToken_string cap = c.prompt();
|
|
|
|
|
if (cap.empty())
|
|
|
|
|
cap = caption;
|
2008-04-04 16:03:36 +00:00
|
|
|
|
set_tab_buttons(cap);
|
2002-09-13 14:06:05 +00:00
|
|
|
|
|
|
|
|
|
TString16 flags;
|
|
|
|
|
if (c.roman()) flags << 'M';
|
|
|
|
|
if (c.right_justified()) flags << 'R';
|
|
|
|
|
if (c.uppercase()) flags << 'U';
|
|
|
|
|
if (c.zerofilled()) flags << 'Z';
|
|
|
|
|
const int csize = c.size();
|
|
|
|
|
|
|
|
|
|
TEdit_field* e = NULL;
|
|
|
|
|
switch (c.class_id())
|
|
|
|
|
{
|
|
|
|
|
case CLASS_EDIT_FIELD:
|
|
|
|
|
e = &add_string(c.dlg(), 0, "", 1, 0, csize, flags, csize > 50 ? 50 : csize);
|
|
|
|
|
break;
|
|
|
|
|
case CLASS_REAL_FIELD:
|
|
|
|
|
e = &add_number(c.dlg(), 0, "", 1, 0, csize, flags);
|
|
|
|
|
break;
|
|
|
|
|
case CLASS_DATE_FIELD:
|
|
|
|
|
e = &add_date (c.dlg(), 0, "", 1, 0, flags);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
e = NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e != NULL)
|
|
|
|
|
{
|
|
|
|
|
e->set_field(c.field()->name());
|
|
|
|
|
_sheet = this;
|
|
|
|
|
e->set_handler(selector_handler);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TQuery_string
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TQuery_string : public TMask
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TQuery_string(const char* prm, WINDOW parent);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TQuery_string::TQuery_string(const char* prm, WINDOW parent)
|
|
|
|
|
: TMask("Richiesta", 1, 52, 6, -1, -1, parent)
|
|
|
|
|
{
|
|
|
|
|
TParagraph_string str(prm, 50);
|
|
|
|
|
for (int y = 0; ; y++)
|
|
|
|
|
{
|
|
|
|
|
const char* s = str.get();
|
|
|
|
|
if (s == NULL)
|
|
|
|
|
break;
|
|
|
|
|
add_static(DLG_NULL, 0, s, 1, y);
|
|
|
|
|
}
|
|
|
|
|
add_string(DLG_USER, 0, "", 1, 4, 50);
|
|
|
|
|
add_button(DLG_CANCEL, 0, "", -12, -1, 10, 2);
|
|
|
|
|
add_button(DLG_OK, 0, "", -22, -1, 10, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TSelector_app
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TSelector_app : public TSkeleton_application
|
|
|
|
|
{
|
|
|
|
|
TFilename _fileini;
|
|
|
|
|
TString _filetable;
|
|
|
|
|
int _filekey;
|
|
|
|
|
TAuto_token_string _fileinput;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void main_loop();
|
|
|
|
|
|
|
|
|
|
bool find_relapp(TString& app) const;
|
|
|
|
|
bool find_mask_name(TFilename& name) const;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void parse_command_line();
|
|
|
|
|
bool get_mask_name(TFilename& name) const;
|
|
|
|
|
void save_cursor(TCursor& cur, TConfig& ini);
|
|
|
|
|
void save_cursor_key(TCursor& cur, TConfig& ini);
|
|
|
|
|
void run_transaction(const char* trans);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool TSelector_app::find_relapp(TString& app) const
|
|
|
|
|
{
|
|
|
|
|
bool ok = FALSE;
|
|
|
|
|
const int logicnum = atoi(_filetable);
|
|
|
|
|
if (logicnum >= LF_USER)
|
|
|
|
|
{
|
|
|
|
|
TLocalisamfile file(logicnum);
|
|
|
|
|
ok = file.get_relapp(app);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TTable t(_filetable);
|
|
|
|
|
ok = t.get_relapp(app);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
|
{
|
|
|
|
|
TString str;
|
|
|
|
|
str << "Non <20> possibile determinare l'applicazione associata al file " << _filetable << ". "
|
|
|
|
|
<< "E' possibile inserire qui il nome del programma (ad esempio 'ba4 -0'). "
|
|
|
|
|
<< "In caso di dubbio premere Annulla.";
|
|
|
|
|
TQuery_string m(str, SCREEN_WIN);
|
|
|
|
|
if (m.run())
|
|
|
|
|
{
|
|
|
|
|
TToken_string s(m.get(DLG_USER), ' ');
|
|
|
|
|
TFilename a = s.get(); a.ext("exe");
|
|
|
|
|
ok = a.exist();
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
app = s;
|
|
|
|
|
s = app.left(2); s << '0'; // default module paragraph
|
|
|
|
|
TConfig ini("install.ini", s);
|
|
|
|
|
str.format("Edit_%d", logicnum);
|
|
|
|
|
ini.set(str, app);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TSelector_app::find_mask_name(TFilename& name) const
|
|
|
|
|
{
|
|
|
|
|
TFilename app;
|
|
|
|
|
bool ok = find_relapp(app);
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
if (isdigit(_filetable[0]))
|
|
|
|
|
{
|
|
|
|
|
name = app.left(3);
|
|
|
|
|
name << char(app[5]+1) << "00a.msk";
|
|
|
|
|
if (!name.exist())
|
|
|
|
|
{
|
|
|
|
|
name.rtrim(5);
|
|
|
|
|
name << ".msk";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
name = app.left(2);
|
|
|
|
|
name << "tb";
|
|
|
|
|
const char* t = _filetable;
|
|
|
|
|
if (*t == '%') t++;
|
|
|
|
|
name << t << ".msk";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ok = name.exist();
|
|
|
|
|
name.ext("");
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TSelector_app::get_mask_name(TFilename& name) const
|
|
|
|
|
{
|
|
|
|
|
const char* t = _filetable;
|
|
|
|
|
if (*t == '%') t++;
|
|
|
|
|
TString16 key; key << "Mask_" << t;
|
|
|
|
|
TConfig ini(CONFIG_DITTA, "ba8");
|
|
|
|
|
name = ini.get(key);
|
|
|
|
|
|
|
|
|
|
bool ok = name.not_empty();
|
|
|
|
|
if (!ok)
|
|
|
|
|
{
|
|
|
|
|
ok = find_mask_name(name);
|
|
|
|
|
if (ok)
|
|
|
|
|
ini.set(key, name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TSelector_app::parse_command_line()
|
|
|
|
|
{
|
|
|
|
|
_filetable = "20";
|
|
|
|
|
_filekey = 1;
|
|
|
|
|
_fileinput = "";
|
|
|
|
|
_fileini = "select.ini";
|
|
|
|
|
|
|
|
|
|
if (argc() > 2)
|
|
|
|
|
{
|
|
|
|
|
const TString str = argv(2);
|
|
|
|
|
if (str[0] == '/' || str[0] == '-')
|
|
|
|
|
{
|
|
|
|
|
_fileini = str.mid(2);
|
|
|
|
|
TConfig trans(_fileini, "Transaction");
|
|
|
|
|
TToken_string sel(trans.get("Action"), ' ');
|
|
|
|
|
_filetable = sel.get(1);
|
|
|
|
|
_filekey = sel.get_int();
|
|
|
|
|
_fileinput = sel.get();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_filetable = str;
|
|
|
|
|
_filekey = argc() > 3 ? atoi(argv(3)) : 1;
|
|
|
|
|
_fileinput = argc() > 4 ? argv(4) : "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TSelector_app::save_cursor(TCursor& cur, TConfig& ini)
|
|
|
|
|
{
|
|
|
|
|
const TRectype& curr = cur.curr();
|
|
|
|
|
|
|
|
|
|
TString16 para; para << curr.num();
|
|
|
|
|
ini.set_paragraph(para);
|
|
|
|
|
TString str;
|
|
|
|
|
|
|
|
|
|
const int fields = curr.items();
|
|
|
|
|
for (int i = 0; i < fields; i++)
|
|
|
|
|
{
|
|
|
|
|
const char* fieldname = curr.fieldname(i);
|
|
|
|
|
const TString& value = curr.get(fieldname);
|
|
|
|
|
if (!value.blank())
|
|
|
|
|
{
|
|
|
|
|
if (value[0] == ' ' || value.right(1) == " ")
|
|
|
|
|
{
|
|
|
|
|
str.cut(0) << '"' << value << '"';
|
|
|
|
|
ini.set(fieldname, str);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ini.set(fieldname, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ini.set_paragraph("Transaction");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TSelector_app::save_cursor_key(TCursor& cur, TConfig& ini)
|
|
|
|
|
{
|
|
|
|
|
const TRectype& curr = cur.curr();
|
|
|
|
|
TString16 para; para << curr.num();
|
|
|
|
|
ini.set_paragraph(para);
|
|
|
|
|
|
2008-12-23 09:11:50 +00:00
|
|
|
|
const RecDes& rd = curr.rec_des();
|
2002-09-13 14:06:05 +00:00
|
|
|
|
const KeyDes& kd = rd.Ky[0];
|
|
|
|
|
for (int i = 0; i < kd.NkFields; i++)
|
|
|
|
|
{
|
|
|
|
|
const int nf = kd.FieldSeq[i] % MaxFields;
|
|
|
|
|
const RecFieldDes& rf = rd.Fd[nf];
|
|
|
|
|
ini.set(rf.Name, curr.get(rf.Name));
|
|
|
|
|
}
|
|
|
|
|
ini.set_paragraph("Transaction");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TSelector_app::run_transaction(const char* trans)
|
|
|
|
|
{
|
|
|
|
|
TString cmd;
|
|
|
|
|
bool ok = find_relapp(cmd);
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
TConfig ini(_fileini, "Transaction");
|
|
|
|
|
ini.set("Action", trans);
|
|
|
|
|
}
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
cmd << " /i" << _fileini;
|
|
|
|
|
TExternal_app app(cmd);
|
|
|
|
|
app.run();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TSelector_app::main_loop()
|
|
|
|
|
{
|
|
|
|
|
parse_command_line();
|
|
|
|
|
|
|
|
|
|
TFilename mask_name;
|
|
|
|
|
if (!get_mask_name(mask_name))
|
|
|
|
|
{
|
|
|
|
|
error_box("Impossibile determinare la maschera associata al file %s", (const char*)_filetable);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TMask m(mask_name);
|
2004-03-04 13:40:28 +00:00
|
|
|
|
|
|
|
|
|
TTemp_window tw(TASK_WIN);
|
|
|
|
|
tw.minimize();
|
2004-03-13 00:12:59 +00:00
|
|
|
|
int f;
|
2004-03-04 13:40:28 +00:00
|
|
|
|
|
2004-03-13 00:12:59 +00:00
|
|
|
|
for (f = m.fields()-1; f >= 0; f--)
|
2002-09-13 14:06:05 +00:00
|
|
|
|
{
|
|
|
|
|
TMask_field& field = m.fld(f);
|
|
|
|
|
if (field.in_key(_filekey) && field.is_edit())
|
|
|
|
|
{
|
|
|
|
|
TEdit_field& e = (TEdit_field&)field;
|
|
|
|
|
if (e.browse() != NULL)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (f < 0)
|
|
|
|
|
{
|
|
|
|
|
error_box("Impossibile trovare un campo di browse sulla chiave %d nel file",
|
|
|
|
|
_filekey, (const char*)mask_name);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEdit_field& efield = (TEdit_field&)m.fld(f);
|
|
|
|
|
TBrowse& b = *efield.browse();
|
|
|
|
|
TCursor& cur = *b.cursor();
|
|
|
|
|
const char* caption = cur.file().description();
|
|
|
|
|
long sel = 0;
|
|
|
|
|
|
|
|
|
|
if (!_fileinput.empty_items())
|
|
|
|
|
{
|
|
|
|
|
TRectype& curr = cur.curr();
|
|
|
|
|
TToken_string ifn = b.get_input_field_names();
|
|
|
|
|
TString val;
|
|
|
|
|
const int maxin = ifn.items() - 1;
|
|
|
|
|
for (int i = 0; i < maxin; i++)
|
|
|
|
|
{
|
|
|
|
|
val = _fileinput.get(i);
|
|
|
|
|
if (val.empty())
|
|
|
|
|
break;
|
|
|
|
|
TFieldref field(ifn.get(i), 0);
|
|
|
|
|
field.write(val, curr);
|
|
|
|
|
}
|
|
|
|
|
cur.setregion(curr, curr);
|
|
|
|
|
|
|
|
|
|
val = _fileinput.get(maxin);
|
|
|
|
|
if (val.not_empty())
|
|
|
|
|
{
|
|
|
|
|
TFieldref field(ifn.get(maxin), 0);
|
|
|
|
|
field.write(val, curr);
|
|
|
|
|
}
|
|
|
|
|
sel = cur.read();
|
|
|
|
|
}
|
|
|
|
|
TSelector_sheet s(cur, b.items(), caption, b.head(), efield);
|
|
|
|
|
s.select(sel);
|
|
|
|
|
|
|
|
|
|
const KEY k = s.run();
|
|
|
|
|
|
|
|
|
|
TConfig ini(_fileini, "Transaction");
|
|
|
|
|
|
|
|
|
|
TString_array list;
|
|
|
|
|
ini.list_paragraphs(list);
|
|
|
|
|
FOR_EACH_ARRAY_ROW(list, r, row) if (*row != "Transaction")
|
|
|
|
|
{
|
|
|
|
|
ini.set_paragraph(*row);
|
|
|
|
|
ini.remove_all();
|
|
|
|
|
}
|
|
|
|
|
ini.set_paragraph("Transaction");
|
|
|
|
|
switch (k)
|
|
|
|
|
{
|
|
|
|
|
case K_ENTER:
|
|
|
|
|
ini.set("Record", s.selected());
|
|
|
|
|
ini.set("Result", "OK");
|
|
|
|
|
ini.set("Error", "0");
|
|
|
|
|
save_cursor(cur, ini);
|
|
|
|
|
break;
|
|
|
|
|
case K_ESC:
|
|
|
|
|
case K_QUIT:
|
|
|
|
|
ini.set("Result", "Cancel");
|
|
|
|
|
ini.set("Error", -1);
|
|
|
|
|
break;
|
|
|
|
|
case K_INS:
|
|
|
|
|
run_transaction("Run");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
save_cursor_key(cur, ini);
|
Patch level : 2.0 490
Files correlati : ba1.exe
Ricompilazione Demo : [ ]
Commento :
AO20049
Utilizzando una schedina EUTRON una volta aperto l'installer di Campo non
vengono riportati automaticamente i moduli attivati su tale schedina.
AO20050
Una volta installato Campo con una schedina EUTRON e finita la conversione
(anche uscendo da Campo e riavviando il PC), per i moduli installati non
vengono abilitate le rispettive voci nei sottomenù (quindi ad es.
Contabilità Generale, Documenti di Vendita, ecc
)
ATTENZIONE: Ovvia conseguenza del AO20049
AO20051
Utilizzando una schedina HARDLOCK se vado su Installazione Moduli va
automaticamente su Attivazione Moduli e restituisce il messaggio
"Il contratto 2001 è stato attivato automaticamente", una volta dato
l'OK ritorna su Installazione Moduli e presenta l'elenco corretto dei
moduli da installare, solo che una volta lanciata l'installazione per ogni
modulo restituisce un altro messaggio "Per installare la versione 20020200
del modulo 'xx' occorre il contratto di assistenza per l'anno 2002"
nonostante la schedina in questione è stata abilitata all'assistenza 2003
(infatti a seguito di questo riporta sulla schedina l'assistenza 2001).
Non si riesce pertanto ad installare i moduli, questo è dovuto al fatto
che nella cartella di Campo viene riportato anche il file dninst.zip
sul quale probabilmente c'era il numero di schedina che ho usato per
fare la prova (HARDLOCK 05714).
AO20052
Per provare a risolvere il problema della segnalazione precedente (AO20051)
si è provato a cancellare il file dninst.zip dalla cartella di Campo,
solo che una volta avviato Campo viene restituito il messaggio
"Impossibile trovare il file dninst.zip" seguito da un errore fatale su BA1;
in tutte le prove successive però si è notato che il file dninst.zip
veniva rigenerato ogni volta.
AO20054
Provato a fare un'installazione in rete utilizzando come server il PC usato
per l'installazione Standard con schedina EUTRON, come per l'installazione
standard prendendo dal server i programmi non ha riportato selezionati i
moduli attivi su questa seconda schedina, il problema è pertanto uguale a
quello della segnalazione AO20049 e AO20050.
ATTENZIONE: Segnalazione intrinsecamente superflua.
Quando la chiavetta non viene riconosciuta come valida,
e' MOLTO probabile che lo risulti su tutti i computer (server e non).
AO20055
Ho provato l'installazione in rete con programmi e dati sul server,
una volta finita non si riesce ad entrare in Campo perché sembra che invece
di fare riferimento al Campo.ini che ha in locale fa riferimento al Campo.ini
sul server.
AO20056
Ho provato a fare un'installazione di una postazione con server di chiavi,
non appena arriva all'installazione del server di chiavi restituisce
il messaggio: "Errore fatale! .\Si è verificato un errore copiando e
decomprimendo il file \", quindi l'installazione va in errore.
ATTENZIONE: Eliminato ogni riferimento a Frontend.exe.
D'ora in poi usare il server Authoriz.exe
AO20057
Ho provato a fare un'installazione di una postazione con Master Server,
l'installazione prosegue normalmente (fatte eccezione per le segnalazioni
precedenti) ma non crea il file Lerch.exe sotto la cartella Servers di Campo,
quindi quando cerca di avviare il programma dall'esecuzione automatica non
trova il file.
git-svn-id: svn://10.65.10.50/trunk@11214 c028cbd2-c16b-5b4b-a496-9718f37d4682
2003-06-05 13:39:12 +00:00
|
|
|
|
run_transaction("Link");
|
2002-09-13 14:06:05 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ba8100(int argc, char* argv[])
|
|
|
|
|
{
|
|
|
|
|
TSelector_app app;
|
|
|
|
|
app.run(argc, argv, "Selector");
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|