Patch level :4.0 800
Files correlati : Ricompilazione Demo : [ ] Commento : 1) riportata la procedura di backup automatico in fase di conversione 2) aggiunta la trattazione del "Type" nel campo.ini al posto degli stupidi TestDatabase e TestPrograms (che comunque vengono interpretati) git-svn-id: svn://10.65.10.50/trunk@15670 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									ef24e5baa8
								
							
						
					
					
						commit
						d5a25be4b0
					
				@ -1196,14 +1196,18 @@ bool TMenu_application::test_programs()
 | 
			
		||||
{
 | 
			
		||||
  TToken_string dangerous;
 | 
			
		||||
  int update_needed = 0;
 | 
			
		||||
  bool test = false;
 | 
			
		||||
  bool is_client = false;
 | 
			
		||||
  //parentesi necessaria per richiudere subito il .ini!
 | 
			
		||||
  {
 | 
			
		||||
    TConfig prawin(CONFIG_INSTALL, "Main");
 | 
			
		||||
    test = prawin.get_bool("TestPrograms");
 | 
			
		||||
    const int type = prawin.get_int("Type");
 | 
			
		||||
    if (type == 3)
 | 
			
		||||
      is_client = true;
 | 
			
		||||
    else
 | 
			
		||||
      is_client = prawin.get_bool("TestPrograms");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (test)
 | 
			
		||||
  if (is_client)
 | 
			
		||||
  {
 | 
			
		||||
    TConfig install("install.ini", "Main");
 | 
			
		||||
    TFilename remote_name = install.get("DiskPath");
 | 
			
		||||
@ -1531,7 +1535,7 @@ HIDDEN bool study_handler(TMask_field& f, KEY k)
 | 
			
		||||
    TFilename path(f.get());
 | 
			
		||||
    path.add("com");
 | 
			
		||||
    path.add("dir.gen");
 | 
			
		||||
    if (!path.exist())
 | 
			
		||||
    if (!path.exist() || path.find(' ') >= 0)
 | 
			
		||||
      ok = f.error_box("%s %s", (const char*)f.get(), TR("non e' uno studio valido!"));
 | 
			
		||||
  } else
 | 
			
		||||
  if (k == K_F9)
 | 
			
		||||
@ -1554,10 +1558,13 @@ HIDDEN bool study_handler(TMask_field& f, KEY k)
 | 
			
		||||
    { 
 | 
			
		||||
      const char* f = xvt_slist_get(dirs, e, NULL);
 | 
			
		||||
      dirgen = f;
 | 
			
		||||
      if (dirgen.find(' ') < 0)
 | 
			
		||||
      {
 | 
			
		||||
        dirgen.add("com/dir.gen");
 | 
			
		||||
        if (dirgen.exist())
 | 
			
		||||
          sht.add(f);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    xvt_slist_destroy(dirs);
 | 
			
		||||
 | 
			
		||||
    sht.rows_array().TArray::sort(dir_sort); 
 | 
			
		||||
 | 
			
		||||
@ -321,8 +321,12 @@ bool TManutenzione_app::create() // initvar e arrmask
 | 
			
		||||
  _superprassi = user() == ::dongle().administrator();
 | 
			
		||||
  if (_superprassi)
 | 
			
		||||
  {
 | 
			
		||||
    TConfig ini(CONFIG_INSTALL, "Main");
 | 
			
		||||
    _superprassi = ini.get_bool("TestDatabase");
 | 
			
		||||
    TConfig campo_ini(CONFIG_INSTALL, "Main");
 | 
			
		||||
    const int type = campo_ini.get_int("Type");
 | 
			
		||||
    if (type == 1 || type == 2)
 | 
			
		||||
      _superprassi = true;
 | 
			
		||||
    else
 | 
			
		||||
      _superprassi = campo_ini.get_bool("TestDatabase");
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  if (argc() > 2 && sw == "-C")
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										108
									
								
								ba/ba1700.cpp
									
									
									
									
									
								
							
							
						
						
									
										108
									
								
								ba/ba1700.cpp
									
									
									
									
									
								
							@ -5,6 +5,7 @@
 | 
			
		||||
#include <execp.h>
 | 
			
		||||
#include <isamrpc.h>
 | 
			
		||||
#include <modaut.h>
 | 
			
		||||
#include <prefix.h>
 | 
			
		||||
#include <progind.h>
 | 
			
		||||
#include <sheet.h>
 | 
			
		||||
#include <utility.h>
 | 
			
		||||
@ -99,6 +100,7 @@ protected: // TSheet
 | 
			
		||||
  bool is_zip_file(const TFilename& n) const;
 | 
			
		||||
 | 
			
		||||
  void create_dirs(const char* path) const;
 | 
			
		||||
  bool copy_tree(const char* src_study, const char* dst_study) const;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  static bool path_handler(TMask_field& fld, KEY key);
 | 
			
		||||
@ -133,6 +135,8 @@ public:
 | 
			
		||||
  bool autoload();
 | 
			
		||||
  bool install(const TString& module, int patch);
 | 
			
		||||
 | 
			
		||||
  void backup() const;
 | 
			
		||||
  
 | 
			
		||||
  bool run_conversion() const 
 | 
			
		||||
  { return installed() && !sys_installed() && (_reboot_program & NEW_TRR) != 0; } 
 | 
			
		||||
 | 
			
		||||
@ -571,14 +575,15 @@ bool TInstaller_mask::can_install(const char* module, TInstall_ini& ini)
 | 
			
		||||
 | 
			
		||||
  const TString& version = ini.version(module);
 | 
			
		||||
  const word year = version2year(version);
 | 
			
		||||
  if (year < 2006)
 | 
			
		||||
  if (year < 2007)
 | 
			
		||||
    return error_box(FR("Il modulo '%s' non ha una versione valida."), module);
 | 
			
		||||
 | 
			
		||||
#ifndef _DEMO_
 | 
			
		||||
  if (year > dongle().year_assist())
 | 
			
		||||
  {
 | 
			
		||||
    /* Scommentare solo se ci si sente soli e si desidera ricevere telefonate in piu'
 | 
			
		||||
    warning_box(FR("Per installare la versione %s del modulo '%s'\noccorre il contratto di assistenza per l'anno %s."),
 | 
			
		||||
                (const char*)version, module, split_ass(year));
 | 
			
		||||
                (const char*)version, module, split_ass(year));*/
 | 
			
		||||
    if (!update_assistance_year())
 | 
			
		||||
      return false;
 | 
			
		||||
  }
 | 
			
		||||
@ -636,6 +641,8 @@ int TInstaller_mask::needs_reboot(const TFilename& file) const
 | 
			
		||||
  return underscore;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Controlla se un file puo' essere scompattato.
 | 
			
		||||
// Attenzione: dninst.zip e' un falso zip
 | 
			
		||||
bool TInstaller_mask::is_zip_file(const TFilename& n) const
 | 
			
		||||
{
 | 
			
		||||
	bool yes = xvt_str_compare_ignoring_case(n.ext(), "zip") == 0 && 
 | 
			
		||||
@ -726,12 +733,92 @@ bool TInstaller_mask::move_module(const TString& module, TInstall_ini& ini, bool
 | 
			
		||||
  return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TInstaller_mask::copy_tree(const char* src_study, const char* dst_study) const
 | 
			
		||||
{
 | 
			
		||||
  xvt_fsys_save_dir();
 | 
			
		||||
  TFilename mask(src_study); mask.add("*.");
 | 
			
		||||
  SLIST dlist = xvt_fsys_list_files(DIR_TYPE, mask, TRUE);
 | 
			
		||||
  xvt_fsys_restore_dir();
 | 
			
		||||
  TProgind pd(xvt_slist_count(dlist), TR("Copia cartelle"), true, true);
 | 
			
		||||
 | 
			
		||||
  TString msg; // Messaggio di progresso
 | 
			
		||||
 | 
			
		||||
  bool go_on = true;
 | 
			
		||||
  for (SLIST_ELT d = xvt_slist_get_first(dlist); d && go_on; d = xvt_slist_get_next(dlist, d))
 | 
			
		||||
  { 
 | 
			
		||||
    if (!pd.addstatus(1))
 | 
			
		||||
    {
 | 
			
		||||
      go_on = false;
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const TFilename dir = xvt_slist_get(dlist, d, NULL);
 | 
			
		||||
    
 | 
			
		||||
    TString name = dir.name(); name.lower();
 | 
			
		||||
    if (name == "cesp")
 | 
			
		||||
      continue;
 | 
			
		||||
 | 
			
		||||
    msg.cut(0) << TR("Copia di ") << name;
 | 
			
		||||
    pd.set_text(msg);
 | 
			
		||||
 
 | 
			
		||||
    mask = dir; mask.add("*.*");
 | 
			
		||||
    TString_array files; list_files(mask, files);
 | 
			
		||||
 | 
			
		||||
    TProgind pi(files.items(), "Copia file", true, true);
 | 
			
		||||
 | 
			
		||||
    TFilename dst;
 | 
			
		||||
    FOR_EACH_ARRAY_ROW(files, i, f)
 | 
			
		||||
    {
 | 
			
		||||
      if (!pi.addstatus(1))
 | 
			
		||||
      {
 | 
			
		||||
        go_on = false;
 | 
			
		||||
        break;
 | 
			
		||||
      }
 | 
			
		||||
      TFilename src(*f);
 | 
			
		||||
      TString16 ext(src.ext()); ext.lower();
 | 
			
		||||
      if (ext != "zip" && ext != "rar" && ext != "mdb" && ext != "inf") 
 | 
			
		||||
      {
 | 
			
		||||
        msg.cut(0) << TR("Copia di ") << src;
 | 
			
		||||
        pi.set_text(msg);
 | 
			
		||||
 | 
			
		||||
        dst = dst_study;
 | 
			
		||||
        dst.add(name);
 | 
			
		||||
        dst.add(src.name());
 | 
			
		||||
        create_dirs(dst);
 | 
			
		||||
        fcopy(src, dst);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  xvt_slist_destroy(dlist);
 | 
			
		||||
 | 
			
		||||
  return go_on;
 | 
			
		||||
}
 | 
			
		||||
	
 | 
			
		||||
void TInstaller_mask::backup() const
 | 
			
		||||
{ 
 | 
			
		||||
  TFilename src = firm2dir(-1);
 | 
			
		||||
  if (!isalnum(src.right(1)[0]))
 | 
			
		||||
    src.rtrim(1);
 | 
			
		||||
  TFilename dst(src); 
 | 
			
		||||
  dst << ' ' << TDate(TODAY).date2ansi(); // Lo spazio rende inutilizzabile lo studio
 | 
			
		||||
 | 
			
		||||
  TToken_string msg(256, '\n');
 | 
			
		||||
  msg.add(TR("Si consiglia creare una copia dello studio ")); msg << src.name(); 
 | 
			
		||||
  msg.add(TR("nella cartella ")); msg << dst; 
 | 
			
		||||
  msg.add(TR("L'operazione potrebbe richiedere alcuni minuti."));
 | 
			
		||||
  msg.add("");
 | 
			
		||||
  msg.add(TR("Si desidera effetture la copia?"));
 | 
			
		||||
  if (yesno_box(msg))
 | 
			
		||||
    copy_tree(src, dst);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
KEY TInstaller_mask::askdisk(TString & path, TFilename & cmdline, int d, int dischi, const char * modulo)
 | 
			
		||||
{
 | 
			
		||||
  TMask retry_mask(TR("Inserimento disco"),1,80,10);
 | 
			
		||||
 | 
			
		||||
  retry_mask.add_static((F_PATH==101 ? 102:101),0,
 | 
			
		||||
    format(FR("Inserire il disco %d di %d del modulo'%s' nell'unità"), d, dischi, modulo)
 | 
			
		||||
    format(FR("Inserire il disco %d di %d del modulo '%s' nell'unità"), d, dischi, modulo)
 | 
			
		||||
      ,2,2);
 | 
			
		||||
  retry_mask.add_static(F_PATH+3,0,TR("oppure indicare un percorso diverso"),2,3);
 | 
			
		||||
 | 
			
		||||
@ -1429,6 +1516,7 @@ protected:
 | 
			
		||||
 | 
			
		||||
  bool testdatabase() const; 
 | 
			
		||||
  bool testprograms() const;
 | 
			
		||||
  int testtype() const;
 | 
			
		||||
  void convert_archives();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -1445,6 +1533,11 @@ bool TInstaller::testprograms() const
 | 
			
		||||
  return  c == 'X' || c == 'Y';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int TInstaller::testtype() const
 | 
			
		||||
{
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TInstaller::test_assistance_year() const
 | 
			
		||||
{  
 | 
			
		||||
  // Per il momento lascia continuare: ci pensa poi la create
 | 
			
		||||
@ -1482,6 +1575,7 @@ void TInstaller::convert_archives()
 | 
			
		||||
    conv = yesno_box(TR("Si desidera convertire gli archivi ora?"));
 | 
			
		||||
  if (conv)
 | 
			
		||||
  {
 | 
			
		||||
    _m->backup();
 | 
			
		||||
    // Lancia conversione: ba1 -0 -C -uADMIN
 | 
			
		||||
    TExternal_app conversion("ba1 -0 -C");
 | 
			
		||||
    conversion.run();
 | 
			
		||||
@ -1491,7 +1585,7 @@ void TInstaller::convert_archives()
 | 
			
		||||
void TInstaller::main_loop()
 | 
			
		||||
{
 | 
			
		||||
  _m->run();
 | 
			
		||||
  if (_m->run_conversion() && testdatabase()) // Almeno 1 trr installato ?
 | 
			
		||||
  if (_m->run_conversion() && testdatabase()) // Almeno un trr installato ?
 | 
			
		||||
  {
 | 
			
		||||
    convert_archives();
 | 
			
		||||
  }
 | 
			
		||||
@ -1523,11 +1617,9 @@ bool TExtendedInstaller::create()
 | 
			
		||||
void TExtendedInstaller::main_loop()
 | 
			
		||||
{
 | 
			
		||||
  _m->run();
 | 
			
		||||
  if (_m->run_conversion() && testdatabase()) // Almeno 1 modulo installato ?
 | 
			
		||||
  if (_m->run_conversion() && testdatabase()) // Almeno un modulo installato ?
 | 
			
		||||
  {
 | 
			
		||||
    // Lancia conversione: ba1 -0 -C -uADMIN
 | 
			
		||||
    TExternal_app conversion("ba1 -0 -C");
 | 
			
		||||
    conversion.run();
 | 
			
		||||
    convert_archives();
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  const bool pending = _m->modules_pending();
 | 
			
		||||
 | 
			
		||||
@ -383,7 +383,11 @@ bool TInstallmodule_app::create()
 | 
			
		||||
    _m = NULL;
 | 
			
		||||
 | 
			
		||||
  TConfig praw(CONFIG_INSTALL, "Main");
 | 
			
		||||
  _test_database = praw.get("TestDatabase","Main",-1,"Y")  != "N";
 | 
			
		||||
  const int type = praw.get_int("Type");
 | 
			
		||||
  if (type == 1 || type == 2)
 | 
			
		||||
   _test_database = true;
 | 
			
		||||
  else
 | 
			
		||||
    _test_database = prawin.get_bool("TestDatabase");
 | 
			
		||||
 | 
			
		||||
  return TSkeleton_application::create();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user