445aa52cc7
git-svn-id: svn://10.65.10.50/branches/R_10_00@22619 c028cbd2-c16b-5b4b-a496-9718f37d4682
127 lines
2.8 KiB
C++
Executable File
127 lines
2.8 KiB
C++
Executable File
#include <comuni.h>
|
|
#include <config.h>
|
|
#include <execp.h>
|
|
#include <modaut.h>
|
|
#include <recarray.h>
|
|
#include <tabutil.h>
|
|
|
|
#include "bainstlib.h"
|
|
#include "bainst.h"
|
|
#include "bainst00.h"
|
|
|
|
class TInstall_BA : public TInstallmodule_app
|
|
{
|
|
private:
|
|
|
|
protected:
|
|
virtual int module_number() const { return 0; }
|
|
virtual bool install_com();
|
|
virtual bool post_installer();
|
|
virtual bool something_to_load() const;
|
|
|
|
bool comuni_to_load() const;
|
|
|
|
public:
|
|
virtual ~TInstall_BA () {}
|
|
};
|
|
|
|
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;
|
|
}
|
|
|
|
bool TInstall_BA::post_installer()
|
|
{
|
|
// configurazione provvisoria dei programmi gestori di tabelle
|
|
if (!test_database())
|
|
{
|
|
TConfig studio(CONFIG_STUDIO);
|
|
const char *confapp="EdApp";
|
|
const char *tabapp="TabPrg";
|
|
// magazzino
|
|
studio.set_paragraph("mg");
|
|
studio.set(tabapp,"mg0 -0");
|
|
studio.set(confapp,"mg0 -2 -1");
|
|
// distinta base
|
|
studio.set_paragraph("db");
|
|
studio.set(tabapp,"db0 -0");
|
|
studio.set(confapp,"");
|
|
// statistiche
|
|
studio.set_paragraph("sv");
|
|
studio.set(tabapp,"sv0 -0");
|
|
studio.set(confapp,"sv0 -3");
|
|
// provvigioni
|
|
studio.set_paragraph("pr");
|
|
studio.set(tabapp,"pr0 -4");
|
|
// MRP
|
|
studio.set_paragraph("mr");
|
|
studio.set(tabapp,"mr0 -0");
|
|
}
|
|
|
|
TConfig install ("install.ini");
|
|
install.for_each_paragraph(search_edit, NULL);
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
bool TInstall_BA::comuni_to_load() const
|
|
{
|
|
//controlla se il file con i comuni è da aggiornare
|
|
//guarda se esiste il codice M314 che è l'ultimo creato al 28/04/2011...
|
|
TLocalisamfile comuni(LF_COMUNI);
|
|
comuni.put(COM_COM, "M314");
|
|
//se il comune M314 non c'è -> il file dei comuni è da aggiornare
|
|
const int err = comuni.read();
|
|
return err != NOERR;
|
|
}
|
|
|
|
bool TInstall_BA::something_to_load() const
|
|
{
|
|
if (test_database())
|
|
{
|
|
if (comuni_to_load())
|
|
return true;
|
|
}
|
|
return TInstallmodule_app::something_to_load();
|
|
}
|
|
|
|
bool TInstall_BA::install_com()
|
|
{
|
|
//questo serve per caricare i files (e non le tabelle)
|
|
TStd_filename txtfile;
|
|
|
|
if (txtfile.check(true, "bacomuni.txt") && comuni_to_load())
|
|
{
|
|
TSystemisamfile comuni(LF_COMUNI);
|
|
comuni.load(txtfile);
|
|
}
|
|
|
|
return TInstallmodule_app::install_com();
|
|
}
|
|
|
|
int bainst00(int argc, char** argv)
|
|
{
|
|
TInstall_BA app;
|
|
app.run(argc, argv);
|
|
return 0;
|
|
} |