1999-04-06 15:34:39 +00:00
|
|
|
#include <config.h>
|
2002-12-20 16:15:03 +00:00
|
|
|
#include <execp.h>
|
|
|
|
#include <inst.h>
|
2000-10-03 13:45:12 +00:00
|
|
|
#include <tabutil.h>
|
1999-04-06 15:34:39 +00:00
|
|
|
#include "bainst.h"
|
2000-10-03 13:45:12 +00:00
|
|
|
#include "bainst00.h"
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
class TInstall_BA : public TInstallmodule_app
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
protected:
|
2000-10-03 13:45:12 +00:00
|
|
|
virtual bool modal() const {return TRUE;}
|
1999-04-06 15:34:39 +00:00
|
|
|
virtual int module_number() const {return 0;}
|
|
|
|
virtual bool install_firm() {return TRUE;} // no firm installation
|
2000-10-03 13:45:12 +00:00
|
|
|
virtual bool install_com();
|
|
|
|
virtual bool load_default_data() const ;
|
1999-04-06 15:34:39 +00:00
|
|
|
virtual bool post_installer();
|
2001-07-24 13:28:55 +00:00
|
|
|
virtual bool preload_mask();
|
|
|
|
virtual bool some_to_load();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~TInstall_BA () {}
|
|
|
|
};
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
HIDDEN int search_edit(TConfig& cfg, void*)
|
|
|
|
{
|
|
|
|
const TString16 module = cfg.get_paragraph().left(2);
|
|
|
|
TAssoc_array& var = cfg.list_variables();
|
|
|
|
bool dirty = FALSE;
|
|
|
|
FOR_EACH_ASSOC_STRING (var, obj, key, str)
|
|
|
|
{
|
|
|
|
const TFixed_string confr (key);
|
|
|
|
if (confr.compare("Edit_", 5, TRUE) == 0)
|
|
|
|
{
|
|
|
|
if (module.compare(str, 2, TRUE) != 0)
|
|
|
|
{
|
|
|
|
cfg.remove(key);
|
|
|
|
dirty = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dirty)
|
|
|
|
{
|
|
|
|
cfg.set_paragraph("");
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
bool TInstall_BA::post_installer()
|
|
|
|
{
|
|
|
|
// configurazione provvisoria dei programmi gestori di tabelle
|
|
|
|
if (!test_database())
|
|
|
|
{
|
|
|
|
TConfig prassis(CONFIG_STUDIO);
|
|
|
|
const char *confapp="EdApp";
|
|
|
|
const char *tabapp="TabPrg";
|
|
|
|
// magazzino
|
|
|
|
prassis.set_paragraph("mg");
|
|
|
|
prassis.set(tabapp,"mg0 -0");
|
|
|
|
prassis.set(confapp,"mg0 -2 -1");
|
|
|
|
// distinta base
|
|
|
|
prassis.set_paragraph("db");
|
|
|
|
prassis.set(tabapp,"db0 -0");
|
|
|
|
prassis.set(confapp,"");
|
|
|
|
// statistiche
|
|
|
|
prassis.set_paragraph("sv");
|
|
|
|
prassis.set(tabapp,"sv0 -0");
|
|
|
|
prassis.set(confapp,"sv0 -3");
|
|
|
|
// provvigioni
|
|
|
|
prassis.set_paragraph("pr");
|
|
|
|
prassis.set(tabapp,"pr0 -4");
|
|
|
|
// MRP
|
|
|
|
prassis.set_paragraph("mr");
|
|
|
|
prassis.set(tabapp,"mr0 -0");
|
|
|
|
}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
|
|
|
TConfig install ("install.ini");
|
|
|
|
install.for_each_paragraph(search_edit, NULL);
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2001-07-24 13:28:55 +00:00
|
|
|
|
|
|
|
bool TInstall_BA::some_to_load()
|
|
|
|
{
|
|
|
|
return _m->get_bool(F_TAB_CEE) || TInstallmodule_app::some_to_load();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TInstall_BA::preload_mask()
|
|
|
|
{
|
|
|
|
if (!test_database())
|
|
|
|
{
|
|
|
|
_m->set(F_TAB_CEE," ");
|
|
|
|
_m->disable(F_TAB_CEE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TTable sce("%SCE");
|
|
|
|
const bool empty = sce.first() != NOERR;
|
|
|
|
|
|
|
|
if (empty)
|
|
|
|
_m->set(F_TAB_CEE,"X");
|
|
|
|
}
|
|
|
|
return TInstallmodule_app::preload_mask();
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
2000-10-03 13:45:12 +00:00
|
|
|
bool TInstall_BA ::install_com()
|
|
|
|
{
|
|
|
|
bool ok=TRUE;
|
|
|
|
TStd_filename txtfile;
|
2001-07-24 13:28:55 +00:00
|
|
|
if (_m->get_bool(F_DEFAULTSDATA) && txtfile.check(TRUE,"lfiva.txt"))
|
|
|
|
{
|
|
|
|
TSystemisamfile tabcom(LF_TABCOM);
|
|
|
|
tabcom.load((const char *)txtfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_m->get_bool(F_TAB_CEE) && txtfile.check(TRUE,"batbsce.txt"))
|
2000-10-03 13:45:12 +00:00
|
|
|
{
|
|
|
|
TSystemisamfile tabcom(LF_TABCOM);
|
|
|
|
tabcom.load((const char *)txtfile);
|
|
|
|
}
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TInstall_BA ::load_default_data() const
|
|
|
|
{
|
|
|
|
TTable iva("%IVA");
|
|
|
|
const bool empty = iva.first() != NOERR;
|
|
|
|
|
|
|
|
return empty;
|
|
|
|
}
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
int bainst00(int argc, char** argv)
|
|
|
|
{
|
|
|
|
TInstall_BA app;
|
|
|
|
app.run(argc, argv);
|
|
|
|
return 0;
|
|
|
|
}
|