Patch level : 10.0
Files correlati : ba1.exe Ricompilazione Demo : [ ] Commento : Migliorata gestione conversioni ed aggiornamenti git-svn-id: svn://10.65.10.50/trunk@17903 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									5bd40db53b
								
							
						
					
					
						commit
						aaae86ef5c
					
				
							
								
								
									
										110
									
								
								ba/ba1100.cpp
									
									
									
									
									
								
							
							
						
						
									
										110
									
								
								ba/ba1100.cpp
									
									
									
									
									
								
							| @ -12,10 +12,6 @@ | ||||
| #include <urldefid.h> | ||||
| 
 | ||||
| #include <user.h> | ||||
| #include <nditte.h> | ||||
| 
 | ||||
| #include <errno.h> | ||||
| #include <fcntl.h> | ||||
| 
 | ||||
| #ifdef WIN32 | ||||
| #include <io.h> | ||||
| @ -63,7 +59,7 @@ protected: | ||||
|   virtual void print(); | ||||
|   virtual void do_print(TPrinter & p, TRec_sheet & r); | ||||
|   const char* dumpfilename(const FileDes& dep) const; | ||||
|   void load_des(const int maxfidr = 0); | ||||
|   void load_des(); | ||||
|   void open_history(); | ||||
|   void put_history(const char* firm); | ||||
|   void close_history(); | ||||
| @ -74,7 +70,6 @@ protected: | ||||
|   void open_log(); | ||||
|   void write_log(const char* line, const int severity = 0); | ||||
|   void close_log(); | ||||
|    | ||||
| 
 | ||||
|   bool moveable_file(int file) const; | ||||
| public: | ||||
| @ -805,11 +800,9 @@ bool TManutenzione_app::recover(TSystemisamfile& f, int err) | ||||
| 
 | ||||
| void TManutenzione_app::repair_file(int i) | ||||
| {           | ||||
|   TDir d;  | ||||
|   TString s(_MAX_PATH); | ||||
|    | ||||
|   d.get(i, _nolock, _nordir, _sysdirop); | ||||
|    | ||||
|   TDir d(i);  | ||||
|   if (d.eod() == 0) | ||||
|   { | ||||
|     TFilename n(d.filename()); | ||||
| @ -1215,29 +1208,38 @@ void TManutenzione_app::convert_dir() | ||||
| 		s << atol (pref) << ".\n"; | ||||
| 	} | ||||
| 
 | ||||
|   TProgind p(update_items ? update_items : 1, s, false, true); | ||||
|   p.setstatus(1); | ||||
| 
 | ||||
|   TProgind p(update_items ? update_items : 1, s, is_power_station()); | ||||
|   for (int i = LF_USER; i <= update_items; i++) | ||||
|   { | ||||
|     const TTrec & rs = (const TTrec &) _recs[i]; | ||||
|     const TDir & ds = (const TDir &) _dirs[i]; | ||||
|     if (!p.addstatus(1)) | ||||
|       break; | ||||
| 
 | ||||
|     const TTrec& rs = (const TTrec&)_recs[i]; // Nuovo tracciato record
 | ||||
|     const TDir& ds = (const TDir&)_dirs[i]; | ||||
|     const long flags = ds.flags(); | ||||
| 
 | ||||
|     if (ds.len() > 0) | ||||
|     { | ||||
|       if (flags >= 0L && flags < 10000L) | ||||
|       { | ||||
|         TSystemisamfile f(i); | ||||
| 				TString msg = s; msg << prefix().get_filename(i); | ||||
|         d.get(i, _nolock, _nordir, _sysdirop); | ||||
| 
 | ||||
| 				TString msg = s; msg << d.filename(); | ||||
| 				p.set_text(msg); | ||||
| 
 | ||||
|         const int module = abs((int)ds.flags()); | ||||
|         TSystemisamfile f(i); | ||||
|         int err = f.is_valid(true);  | ||||
|         if (err == -60 || err == -64) | ||||
|         switch (err) | ||||
|         { | ||||
|         case -64: | ||||
|         case -60:      | ||||
| 					err = NOERR; // verif.
 | ||||
|           break; | ||||
|         default: | ||||
|           break; | ||||
|         } | ||||
| 
 | ||||
|         d.get(i, _nolock, _nordir, _sysdirop); | ||||
|         if (i > LF_USER && err != NOERR && ((is_com && d.is_com()) || (!is_com && d.is_firm()))) | ||||
|         {        | ||||
|           if (err == _istrcerr || err == _isbadtrc) | ||||
| @ -1250,7 +1252,6 @@ void TManutenzione_app::convert_dir() | ||||
|           { | ||||
|             //si decide di proseguire anche se il file non può essere aperto ne tiene traccia nel log (nel caso di utonti..
 | ||||
|             //..è sempre così, perchè go_on è sempre true)
 | ||||
|             TString msg; | ||||
|             msg.format(TR("Il file %d non può essere aperto. Errore %d"), i, err); | ||||
|             write_log(msg, 2); | ||||
|             continue; | ||||
| @ -1316,8 +1317,6 @@ void TManutenzione_app::convert_dir() | ||||
|       d.put(i, _nordir, _sysdirop); | ||||
|       r.put(i); | ||||
|     }	//else di if(ds.len()>0...
 | ||||
|     p.addstatus(1); | ||||
| 
 | ||||
|   }	//for (int  i = 2; i <= update_items...
 | ||||
| 
 | ||||
|   d.get(LF_DIR, _nolock, _nordir, _sysdirop); | ||||
| @ -1326,7 +1325,7 @@ void TManutenzione_app::convert_dir() | ||||
|   put_history(pref); | ||||
| } | ||||
| 
 | ||||
| void TManutenzione_app::load_des(const int maxfdir) | ||||
| void TManutenzione_app::load_des() | ||||
| { | ||||
|   TWait_cursor waiter; | ||||
|   const TString pref(prefix().name()); | ||||
| @ -1405,11 +1404,13 @@ void TManutenzione_app::load_des(const int maxfdir) | ||||
|   items = (int) d.eod(); | ||||
|   TString80 s; | ||||
| 
 | ||||
|   if (standard) s = TR("Caricamento descrizioni archivi standard"); | ||||
|   if (standard)  | ||||
|     s = TR("Caricamento descrizioni archivi standard"); | ||||
|   else | ||||
|   { | ||||
|     if (prefix().is_com()) s << TR("Caricamento descrizioni archivi comuni"); | ||||
|     else s << TR("Caricamento descrizioni archivi della ditta ") << atol (pref); | ||||
| 
 | ||||
|   } | ||||
|   TProgind p(items ? items : 1, s, false, true); | ||||
| 
 | ||||
|   p.setstatus(1); | ||||
| @ -1435,8 +1436,7 @@ void TManutenzione_app::load_des(const int maxfdir) | ||||
|                             | ||||
|           if (!fexist(descfname)) | ||||
|           {                            | ||||
|             FILE * fd = fopen(descfname, "w"); | ||||
|              | ||||
|             FILE* fd = fopen(descfname, "w");     | ||||
|             if (fd != NULL) | ||||
|               fclose(fd); | ||||
|           } | ||||
| @ -1512,51 +1512,39 @@ void TManutenzione_app::update() | ||||
| 
 | ||||
|   do_events(); | ||||
| 
 | ||||
|   TDir d; | ||||
|   d.get(LF_DIR,_nolock, _nordir, _sysdirop); | ||||
|   const int maxfdir = d.items(); | ||||
|   prefix().set(""); | ||||
|   load_des(maxfdir); | ||||
|   load_des(); | ||||
|   prefix().set_codditta(0L); | ||||
|    | ||||
|   open_log(); | ||||
|   write_log(TR("Conversione Dati comuni"));          | ||||
|   write_log("");         | ||||
|    | ||||
| 
 | ||||
|   TPointer_array ditte; // Evita di aprire LF_NDITTE
 | ||||
|   const int nditte = prefix().firms(ditte); | ||||
|   TProgind p(nditte+1, TR("Conversione archivi ditte."), is_power_station()); | ||||
| 
 | ||||
|   p.addstatus(1); | ||||
|   update_dir(); | ||||
|   convert_dir(); | ||||
| 
 | ||||
|   TSystemisamfile ditte(LF_NDITTE); | ||||
|   ditte.open(); | ||||
| 
 | ||||
|   const int nditte = ditte.items(); | ||||
|   if (nditte) | ||||
|    | ||||
|   for (int i = 0; i < nditte; i++) | ||||
|   { | ||||
|     TProgind p(nditte, TR("Conversione archivi ditte."), false, true); | ||||
|     TString mxs; | ||||
|     for (int err = ditte.first(); err == NOERR; err = ditte.next()) | ||||
|     if (!p.addstatus(1)) | ||||
|       break; | ||||
|     const long codditta = ditte.get_long(i); | ||||
|     TString mxs; mxs << TR("Conversione Ditta") << ' ' << codditta; | ||||
|     p.set_text(mxs); | ||||
|     if (codditta > _history_firm && prefix().exist(codditta) && set_firm(codditta)) | ||||
|     { | ||||
|       const TRecnotype rec = ditte.recno(); | ||||
|       const long codditta = ditte.get_long(NDT_CODDITTA); | ||||
|       mxs.cut(0) << TR("Conversione Ditta") << ' ' << codditta << ' ' << ditte.get(NDT_RAGSOC); | ||||
|       if (!p.addstatus(1)) | ||||
|         break; | ||||
|       p.set_text(mxs); | ||||
|       if (codditta > _history_firm && prefix().exist(codditta)) | ||||
|       { | ||||
|         ditte.close(); | ||||
|         set_firm(codditta); | ||||
|         write_log("");         | ||||
|         write_log(mxs);  | ||||
|         write_log("");         | ||||
|         update_dir(); | ||||
|         convert_dir(); | ||||
|         ditte.open(); | ||||
|       } | ||||
|       ditte.readat(rec); | ||||
|       write_log("");         | ||||
|       write_log(mxs);  | ||||
|       write_log("");         | ||||
|       update_dir(); | ||||
|       convert_dir(); | ||||
|     } | ||||
|     ditte.close(); | ||||
|   } | ||||
| 
 | ||||
|   //chiude il log di conversione           
 | ||||
|   close_log(); | ||||
|    | ||||
| @ -1588,8 +1576,8 @@ void TManutenzione_app::update() | ||||
| void TManutenzione_app::main_loop() | ||||
| { | ||||
|   TToken_string riga; | ||||
|   long  riga_selezionata; | ||||
|   bool  done = false; | ||||
|   long riga_selezionata; | ||||
|   bool done = false; | ||||
| 
 | ||||
|   _browse->rebuild(); | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										320
									
								
								ba/ba1300.cpp
									
									
									
									
									
								
							
							
						
						
									
										320
									
								
								ba/ba1300.cpp
									
									
									
									
									
								
							| @ -5,64 +5,85 @@ | ||||
| #include <prefix.h> | ||||
| #include <progind.h> | ||||
| #include <sheet.h> | ||||
| #include <statbar.h> | ||||
| #include <urldefid.h> | ||||
| #include <utility.h> | ||||
| 
 | ||||
| #include "ba1.h" | ||||
| 
 | ||||
| class TPackFiles_application:public TSkeleton_application | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // TSel_sheet
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| class TSel_sheet : public TArray_sheet | ||||
| { | ||||
|   TArray_sheet   * _selsheet; | ||||
|   long           _firm; | ||||
| public: | ||||
|   TSel_sheet(); | ||||
| }; | ||||
| 
 | ||||
| TSel_sheet::TSel_sheet()  | ||||
|           : TArray_sheet(-1, -1, -4, -4, TR("Selezione files"), | ||||
|                          HR("@1|N.@5|Nome@20|EOD@7|EOX@7|Lunghezza|Descrizione@43|Flags@7"), 0x8) | ||||
| { | ||||
|   if (is_power_station()) | ||||
|     add_button(DLG_EDIT, PR("Salva TXT"), K_SAVE, BMP_ARCHIVE); | ||||
|   add_button(-1, "", 0, 1); // Separatore
 | ||||
|   add_button(DLG_INFO, TR("Info"), K_F2, BMP_INFO); | ||||
|   add_button(DLG_HELP, TR("Help"), K_F1, BMP_HELP); | ||||
|   xvt_toolbar_set_last_tool(toolbar(), DLG_QUIT); | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // TPackFiles_application
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| class TPackFiles_application : public TSkeleton_application | ||||
| { | ||||
|   TSel_sheet* _selsheet; | ||||
|   long _firm; | ||||
| 
 | ||||
| protected: | ||||
|   virtual void main_loop(); | ||||
|   virtual bool create () ; | ||||
|   virtual bool destroy(); | ||||
|   virtual bool extended_firm() const { return TRUE; } | ||||
|   void build_sheet(); | ||||
|   void search_blanks(TSystemisamfile & f); | ||||
|   virtual bool extended_firm() const { return true; } | ||||
| 
 | ||||
| public: | ||||
|   void build_sheet(); | ||||
|   void search_blanks(TSystemisamfile& f); | ||||
|   void pack_all(); | ||||
|   void save_all(); | ||||
| 
 | ||||
|   TPackFiles_application() : _selsheet(NULL), _firm(0) {} | ||||
|   ~TPackFiles_application() {}; | ||||
| }; | ||||
| 
 | ||||
| bool TPackFiles_application::create() // initvar e arrmask
 | ||||
| 
 | ||||
| { | ||||
|   _firm = get_firm(); | ||||
|   if (!set_firm()) | ||||
|     return FALSE; | ||||
|   const bool is_prassi = user() == ::dongle().administrator(); | ||||
|   _selsheet  = new TArray_sheet(-1, -1, -4, -4, TR("Selezione files"), | ||||
|                              is_prassi ?  | ||||
|                              HR("@1|N.@5|Nome@20|EOD@7|EOX@7|Lung.  |Descrizione@43|Flags@7") : | ||||
|                              HR("N.@5|Nome@20|EOD@7|EOX@7|Lung.  |Descrizione@43|Flags@7"), | ||||
|                              is_prassi ? 0 : 0x10); | ||||
|     return false; | ||||
|   _selsheet = new TSel_sheet; | ||||
|   return TSkeleton_application::create(); | ||||
| } | ||||
| 
 | ||||
| bool TPackFiles_application::destroy() | ||||
| 
 | ||||
| { | ||||
|   if (_firm) set_firm(_firm); | ||||
|   if (_selsheet != NULL) delete  _selsheet; | ||||
|   if (_selsheet != NULL) delete _selsheet; | ||||
|   return TSkeleton_application::destroy() ; | ||||
| } | ||||
| 
 | ||||
| void TPackFiles_application::build_sheet() | ||||
| { | ||||
|   _selsheet->destroy(); | ||||
|   TDir cdir; | ||||
|   cdir.get(LF_DIR,_nolock,_nordir,_sysdirop); | ||||
|   const bool is_prassi = user() == ::dongle().administrator(); | ||||
|   TDir cdir(LF_DIR); | ||||
|   const int nitems = (int)cdir.eod(); | ||||
|   for (int i = 0; i < nitems; i++) // fill sheet
 | ||||
|   TToken_string riga; | ||||
|   for (int i = LF_USER; i <= nitems; i++) // fill sheet
 | ||||
|   { | ||||
|     TToken_string riga(128); | ||||
|     cdir.get(i+1,_nolock,_nordir,_sysdirop); | ||||
|     if (is_prassi) | ||||
|       riga.add(""); | ||||
|     riga.add(i+1); | ||||
|     cdir.get(i, _nolock, _nordir, _sysdirop); | ||||
|     riga = " "; | ||||
|     riga.add(i); | ||||
|     riga.add(cdir.name()); | ||||
|     riga.add(cdir.eod()); | ||||
|     riga.add(cdir.eox()); | ||||
| @ -75,23 +96,142 @@ void TPackFiles_application::build_sheet() | ||||
| 
 | ||||
| void TPackFiles_application::search_blanks(TSystemisamfile& f) | ||||
| { | ||||
|   // Scorre il file corrente per record cancellando eventuali record vuoti/blank
 | ||||
|                  | ||||
|   f.open(_excllock, TRUE); | ||||
|   const long records = f.items(); | ||||
|   TString k; | ||||
|    | ||||
|   for (long i = 0; f.status() == NOERR && i < records; i++) | ||||
|   // Scorre il file corrente per record cancellando eventuali record vuoti/blank          
 | ||||
|   if (f.open(_excllock, true)) | ||||
|   { | ||||
|     f.readat(i + 1); // Legge per numero di record, evitando falli di indice...
 | ||||
|     k = f.curr().key(); // Chiave 1; non puo' essere vuota (anche perche' no si puo' scrivere un record vuoto)
 | ||||
|     if (f.curr().empty() || k.trim().empty()) // Teoricamente ce ne sarebbe uno solo...
 | ||||
|     {                                         // ma se l'indice e' rovinato possono esserci piu' records vuoti
 | ||||
|       f.curr().discard();                     // che vanno cmq eliminati; le pack() successive completano l'opera.
 | ||||
|       f.rewriteat(i + 1); | ||||
|     const long records = f.items(); | ||||
|     TString k; | ||||
|     TRectype& curr = f.curr(); | ||||
|     for (long i = 0; f.status() == NOERR && i < records; i++) | ||||
|     { | ||||
|       f.readat(i + 1); // Legge per numero di record, evitando falli di indice...
 | ||||
|       k = curr.key();  // Chiave 1; non puo' essere vuota (anche perche' no si puo' scrivere un record vuoto)
 | ||||
|       if (curr.empty() || k.blank()) // Teoricamente ce ne sarebbe uno solo...
 | ||||
|       {                              // ma se l'indice e' rovinato possono esserci piu' records vuoti
 | ||||
|         curr.discard();              // che vanno cmq eliminati; le pack() successive completano l'opera.
 | ||||
|         f.rewriteat(i + 1); | ||||
|       } | ||||
|     } | ||||
|     f.close(); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void TPackFiles_application::pack_all() | ||||
| { | ||||
|   TProgind p(_selsheet->checked(), TR("Compattazione in corso..."), true, true); | ||||
|   FOR_EACH_CHECKED_ROW(*_selsheet, k, row) | ||||
|   {  | ||||
|     if (!p.addstatus(1)) | ||||
|       break; | ||||
|     const int i = row->get_int(1); | ||||
|     TDir d(i);      | ||||
|     if (d.len() == 0) | ||||
|       continue;    // Skip files with flags over 10000
 | ||||
|     const TString pref(prefix().name()); | ||||
|     prefix().set(""); | ||||
|     const TDir ds(i); | ||||
|     prefix().set(pref); | ||||
|     const long flags = ds.flags(); | ||||
|     if (flags >= 10000L) | ||||
|       continue;    // Skip files with flags over 10000
 | ||||
|      | ||||
|     TFilename f_name = d.filename(); | ||||
|     f_name.ext("dbf"); | ||||
|     p.set_text(f_name); | ||||
|     bool retry   = FALSE; | ||||
|     const bool present = f_name.exist(); | ||||
|     int status = NOERR; | ||||
|     TSystemisamfile f(i); | ||||
|     do | ||||
|     { | ||||
|       status = NOERR; | ||||
|       if (present && flags < 10000L) // Se il file c'e' prova a compattarlo
 | ||||
|       {  | ||||
|         search_blanks(f); | ||||
|         if (f.packfile() == NOERR) | ||||
|           f.packindex(); | ||||
|         status = f.status(); | ||||
|         if (status == -60) // Se ritorna -60 allora il file e' aperto da qualcuno
 | ||||
|           retry = yesno_box(FR("Il file %s non puo' essere compattato perche' aperto da altre applicazioni. Riprovare?"),(const char*) f_name); | ||||
|       }  | ||||
|     } while  (retry); // Ci riprovo !
 | ||||
|      | ||||
|     if (!present || status == -60) | ||||
|     { | ||||
|   //              if (!present && d.len() > 0 && has_module(module,CHK_DONGLE))// Se il file non esiste lo costruisce
 | ||||
|   //                f.build(0L);
 | ||||
|        | ||||
|       continue; // Se il file non esiste e non si ha il modulo abilitato evita inutili controlli
 | ||||
|     }           // Se le pack() hanno ritornato -60 ma il file esiste, allora prosegue con il prossimo
 | ||||
|     if (status != NOERR &&  | ||||
|       yesno_box(FR("Rilevato l'errore %d cercando di compattare il file %s. Si desidera scaricarlo e ricaricarlo?"),status,(const char*)f_name)) | ||||
|     { | ||||
|       // Dump the file, Zap it and Reload it.
 | ||||
|       TFilename d_name; d_name.temp("fdump"); | ||||
|       if (f.dump(d_name,0) == NOERR) // Dump
 | ||||
|       { | ||||
|         // Zap
 | ||||
|         d.get(i,_nolock, _nordir,_sysdirop);                | ||||
|         bool is_com = d.is_com(); | ||||
|         d.get(i,_nolock, is_com ? _comdir : _nordir); | ||||
|         d.set_eod(0); | ||||
|         d.put(i, is_com ? _comdir : _nordir); | ||||
|         if (f.pack() == NOERR) | ||||
|           if (f.load(d_name) == NOERR) // Reload
 | ||||
|             d_name.fremove(); | ||||
|           else | ||||
|             error_box(FR("Impossibile ricaricare %s. Errore %d"),(const char*) d_name, f.status()); | ||||
|         else | ||||
|           error_box(FR("Impossibile azzerare %s. Errore %d"),(const char*) f_name, f.status()); | ||||
|       } | ||||
|         else | ||||
|           error_box(FR("Impossibile scaricare %s. Errore %d"),(const char*) d_name, f.status()); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void TPackFiles_application::save_all() | ||||
| { | ||||
|   TFilename cartella; cartella.tempdir(); | ||||
|   TString8 firm; firm.format("%05ldA", get_firm()); | ||||
|   cartella.add(firm); | ||||
|   if (!cartella.exist()) | ||||
|     xvt_fsys_mkdir(cartella); | ||||
|    | ||||
|   DIRECTORY dir; xvt_fsys_convert_str_to_dir(cartella, &dir); | ||||
|   xvt_fsys_save_dir(); | ||||
|   xvt_fsys_set_dir(&dir); | ||||
|   const int ret = xvt_dm_post_dir_sel(&dir); | ||||
|   xvt_fsys_restore_dir(); | ||||
| 
 | ||||
|   if (ret == FL_OK) | ||||
|   { | ||||
|     xvt_fsys_convert_dir_to_str(&dir, cartella.get_buffer(), cartella.size()); | ||||
|     if (!cartella.ends_with(firm)) | ||||
|       cartella.add(firm); | ||||
|     xvt_fsys_mkdir(cartella); | ||||
| 
 | ||||
|     TProgind p(_selsheet->checked(), TR("Salvataggio in corso..."), true, true); | ||||
|     FOR_EACH_CHECKED_ROW(*_selsheet, k, row) | ||||
|     {  | ||||
|       if (!p.addstatus(1)) | ||||
|         break; | ||||
|       const TIsam_handle logic = row->get_int(1); | ||||
|       const TDir d(logic); | ||||
|       if (d.len() > 0) | ||||
|       { | ||||
|         TSystemisamfile f(logic); | ||||
|         if (f.is_valid(false) == NOERR) | ||||
|         { | ||||
|           TFilename fname = cartella; | ||||
|           TString16 name; row->get(2, name); name.ltrim(1); | ||||
|           fname.add(name); | ||||
|           fname.ext("txt"); | ||||
|           f.dump(fname); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   f.close(); | ||||
| } | ||||
|                  | ||||
| void TPackFiles_application::main_loop() | ||||
| @ -103,94 +243,18 @@ void TPackFiles_application::main_loop() | ||||
|     tasto = _selsheet->run(); | ||||
|     switch(tasto) | ||||
|     { | ||||
|       case K_ENTER:   | ||||
|         if (_selsheet->checked()>0) | ||||
|         { | ||||
|           int status; | ||||
|           const long items = _selsheet->items(); | ||||
|           bool retry,present; | ||||
|           TFilename f_name,d_name; | ||||
|           TString cmd; | ||||
|           TDir d; | ||||
|           TDir ds; | ||||
|           TProgind p(items, TR("Compattazione in corso..."), TRUE, TRUE ); | ||||
|           for (long i = 2; i<=items; i++) // Skip LF_DIR
 | ||||
|           {  | ||||
|             p.setstatus(i); | ||||
|             if (p.iscancelled()) | ||||
|               break; | ||||
|             if (!_selsheet->checked(i-1)) | ||||
|               continue; | ||||
|             d.get(i);      | ||||
|             if (d.len() == 0) | ||||
|               continue;    // Skip files with flags over 10000
 | ||||
|             const TString pref(prefix().name()); | ||||
|             prefix().set(""); | ||||
|             ds.get(i); | ||||
|             prefix().set(pref); | ||||
|             const long flags = ds.flags(); | ||||
| //            const int module = abs((int)flags); non piu usato verificare
 | ||||
|             if (flags >= 10000L) | ||||
|               continue;    // Skip files with flags over 10000
 | ||||
|             TSystemisamfile f(i); | ||||
|              | ||||
|             f_name = d.name(); | ||||
|             f_name.ext("dbf"); | ||||
|             retry   = FALSE; | ||||
|             present = f_name.exist(); | ||||
|             do | ||||
|             { | ||||
|               status = NOERR; | ||||
|               if (present && flags < 10000L) // Se il file c'e' prova a compattarlo
 | ||||
|               {  | ||||
|                 search_blanks(f); | ||||
|                 if (f.packfile() == NOERR) | ||||
|                   f.packindex(); | ||||
|                 status = f.status(); | ||||
|                 if (status == -60) // Se ritorna -60 allora il file e' aperto da qualcuno
 | ||||
|                   retry = yesno_box(FR("Il file %s non puo' essere compattato perche' aperto da altre applicazioni. Riprovare?"),(const char*) f_name); | ||||
|               }  | ||||
|             } while  (retry); // Ci riprovo !
 | ||||
|              | ||||
|             if (!present || status == -60) | ||||
|             { | ||||
| //              if (!present && d.len() > 0 && has_module(module,CHK_DONGLE))// Se il file non esiste lo costruisce
 | ||||
| //                f.build(0L);
 | ||||
|                | ||||
|               continue; // Se il file non esiste e non si ha il modulo abilitato evita inutili controlli
 | ||||
|             }           // Se le pack() hanno ritornato -60 ma il file esiste, allora prosegue con il prossimo
 | ||||
|             if (status != NOERR &&  | ||||
|               yesno_box(FR("Rilevato l'errore %d cercando di compattare il file %s. Si desidera scaricarlo e ricaricarlo?"),status,(const char*)f_name)) | ||||
|             { | ||||
|               // Dump the file, Zap it and Reload it.
 | ||||
|               d_name = ""; | ||||
|               d_name.temp("fdump"); | ||||
|               if (f.dump(d_name,0) == NOERR) // Dump
 | ||||
|               { | ||||
|                 // Zap
 | ||||
|                 d.get(i,_nolock, _nordir,_sysdirop);                | ||||
|                 bool is_com = d.is_com(); | ||||
|                 d.get(i,_nolock, is_com ? _comdir : _nordir); | ||||
|                 d.set_eod(0); | ||||
|                 d.put(i, is_com ? _comdir : _nordir); | ||||
|                 if (f.pack() == NOERR) | ||||
|                   if (f.load(d_name) == NOERR) // Reload
 | ||||
|                     remove_file(d_name); | ||||
|                   else | ||||
|                     error_box(FR("Impossibile ricaricare %s. Errore %d"),(const char*) d_name, f.status()); | ||||
|                 else | ||||
|                   error_box(FR("Impossibile azzerare %s. Errore %d"),(const char*) f_name, f.status()); | ||||
|               } | ||||
|                 else | ||||
|                   error_box(FR("Impossibile scaricare %s. Errore %d"),(const char*) d_name, f.status()); | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|         else | ||||
|           warning_box(TR("Nessun file selezionato")); | ||||
|         break; | ||||
|       default: | ||||
|         break; | ||||
|     case K_ENTER: | ||||
|       if (_selsheet->one_checked()) | ||||
|         pack_all(); | ||||
|       else | ||||
|         warning_box(TR("Nessun file selezionato")); | ||||
|       break; | ||||
|     case K_SAVE: | ||||
|       if (_selsheet->one_checked()) | ||||
|         save_all(); | ||||
|       break; | ||||
|     default: | ||||
|       break; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -458,7 +458,7 @@ bool TInstaller_mask::autoload() | ||||
|     for (int i = modules.last(); i >= 0; i--) | ||||
|     { | ||||
|       TString& str = modules.row(i); | ||||
|       if (str.match("??????A.INI") || str.match("??????a.ini")) | ||||
|       if (str.match("??????A.INI", true)) | ||||
|       { | ||||
|         TFilename remote = http_path; | ||||
|         remote << str; | ||||
|  | ||||
| @ -74,7 +74,7 @@ bool TFile_selector::on_field_event(TOperable_field& o, TField_event e, long jol | ||||
|       } | ||||
| 
 | ||||
|       TLocalisamfile f(nfile); | ||||
|       const RecDes& rd = *f.curr().rec_des(); | ||||
|       const RecDes& rd = f.curr().rec_des(); | ||||
|       TToken_string codes, items; | ||||
|       for (i = 1; i <= rd.NKeys; i++) | ||||
|       { | ||||
| @ -93,7 +93,7 @@ bool TFile_selector::on_field_event(TOperable_field& o, TField_event e, long jol | ||||
|       if (nfile >= LF_USER && nkey > 0) | ||||
|       { | ||||
|         TLocalisamfile f(nfile); | ||||
|         const RecDes& rd = *f.curr().rec_des(); | ||||
|         const RecDes& rd = f.curr().rec_des(); | ||||
|         const KeyDes& kd = rd.Ky[nkey-1]; | ||||
|         TToken_string str("", '+'); | ||||
|         for (int i = 0; i < kd.NkFields; i++) | ||||
| @ -436,8 +436,7 @@ TRecord_selector::TRecord_selector(const TFile_selector& fm) : TAutomask("ba7300 | ||||
|   _relation = new TRelation(logicnum); | ||||
|   _cursor = new TCursor(_relation, "", nkey+1); | ||||
|    | ||||
|   const RecDes& rd = *_relation->curr().rec_des();    | ||||
|    | ||||
|   const RecDes& rd = _relation->curr().rec_des();    | ||||
|   const KeyDes& kd = rd.Ky[nkey]; | ||||
|    | ||||
|   int i; | ||||
| @ -508,7 +507,7 @@ void TMail_flood_app::fill_key(const TRectype& curr, TConfig& ini) const | ||||
|   ini.set_paragraph(para); | ||||
|   ini.remove_all(); | ||||
|    | ||||
|   const RecDes& rd = *curr.rec_des();    | ||||
|   const RecDes& rd = curr.rec_des();    | ||||
|   const KeyDes& kd = rd.Ky[0]; | ||||
|   for (int i = 0; i < kd.NkFields; i++) | ||||
|   { | ||||
| @ -570,7 +569,7 @@ void TMail_flood_app::fill_rows(const TRectype& parent, int logicnum, TConfig& i | ||||
|    | ||||
|   TString16 numfield; | ||||
|    | ||||
|   const RecDes& rd = *rec.rec_des();    | ||||
|   const RecDes& rd = rec.rec_des();    | ||||
|   const KeyDes& kd = rd.Ky[0]; | ||||
|   for (int i = 0; i < kd.NkFields; i++) | ||||
|   { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user