2020-04-21 18:53:15 +02:00
|
|
|
#include "f90.h"
|
2020-05-14 23:38:30 +02:00
|
|
|
|
|
|
|
#include <Windows.h>
|
|
|
|
#include <vector>
|
|
|
|
#include <set>
|
|
|
|
#include <map>
|
|
|
|
|
2020-04-21 18:53:15 +02:00
|
|
|
#include "applicat.h"
|
|
|
|
#include "automask.h"
|
2020-04-22 18:38:55 +02:00
|
|
|
#include "f90300a.h"
|
|
|
|
#include "urldefid.h"
|
|
|
|
#include "utility.h"
|
2020-05-14 23:38:30 +02:00
|
|
|
#include "f90300b.h"
|
|
|
|
#include "mov.h"
|
|
|
|
#include "isam.h"
|
|
|
|
#include "f9cart.h"
|
2020-05-18 11:00:06 +02:00
|
|
|
#include "f9lib01.h"
|
2020-04-22 18:38:55 +02:00
|
|
|
|
2020-05-14 23:38:30 +02:00
|
|
|
#define TABMOD_CARTDIR "S0"
|
2020-04-22 18:38:55 +02:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2020-05-14 23:38:30 +02:00
|
|
|
// TImport_msk
|
2020-04-22 18:38:55 +02:00
|
|
|
|
2020-05-14 23:38:30 +02:00
|
|
|
class TImport_msk : public TMask
|
2020-04-22 18:38:55 +02:00
|
|
|
{
|
|
|
|
friend class TGestione_doc_cartacei_f9_msk;
|
|
|
|
|
2020-05-14 23:38:30 +02:00
|
|
|
static bool ok_handler(TMask_field& field, KEY key)
|
|
|
|
{
|
|
|
|
field.mask().send_key(K_ENTER, DLG_OK);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-04-22 18:38:55 +02:00
|
|
|
public:
|
2020-05-14 23:38:30 +02:00
|
|
|
TImport_msk() : TMask("f90300b") { }
|
2020-04-22 18:38:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-21 18:53:15 +02:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// TGestione_doc_cartacei_f9_msk
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class TGestione_doc_cartacei_f9_msk : public TAutomask
|
|
|
|
{
|
2020-05-14 23:38:30 +02:00
|
|
|
struct doc_cart_t
|
|
|
|
{
|
|
|
|
TString filename;
|
|
|
|
TString loaddate;
|
|
|
|
TString numreg;
|
|
|
|
TString user;
|
|
|
|
};
|
2020-05-18 11:00:06 +02:00
|
|
|
const TString& _addr_cart; // Indirizzo cartella doc. cartacei F9
|
2020-05-14 23:38:30 +02:00
|
|
|
std::unique_ptr<std::set<TString>> _extensions; // todo: controllare che con TString funzioni l'ordinamento, quindi la find
|
|
|
|
std::unique_ptr<TImport_msk> _import_msk;
|
|
|
|
std::map<TString, doc_cart_t> _list_file;
|
2020-04-22 18:38:55 +02:00
|
|
|
|
2020-04-21 18:53:15 +02:00
|
|
|
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
2020-04-22 18:38:55 +02:00
|
|
|
|
2020-05-18 11:00:06 +02:00
|
|
|
void check_addr_cart() const;
|
2020-05-14 23:38:30 +02:00
|
|
|
static void check_deleted();
|
|
|
|
bool check_file_exist(const TString& file) const;
|
|
|
|
void delete_file();
|
2020-05-18 11:00:06 +02:00
|
|
|
bool doc_already_exists(const TFilename& file, _Out_ TString& numreg) const;
|
2020-05-14 23:38:30 +02:00
|
|
|
void fill();
|
|
|
|
static TToken_string& get_valid_extensions();
|
|
|
|
void load_extensions();
|
|
|
|
bool load_file(const TFilename& file, const TString& numreg);
|
|
|
|
void open_config_win() const;
|
|
|
|
void open_import_win();
|
2020-05-18 11:00:06 +02:00
|
|
|
static void remove_file_from_f9cart(const std::set<TString>& files);
|
2020-05-14 23:38:30 +02:00
|
|
|
bool verify_extension(const TFilename& file);
|
2020-04-22 18:38:55 +02:00
|
|
|
|
2020-04-21 18:53:15 +02:00
|
|
|
public:
|
2020-05-14 23:38:30 +02:00
|
|
|
TGestione_doc_cartacei_f9_msk();
|
2020-04-21 18:53:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
bool TGestione_doc_cartacei_f9_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
{
|
|
|
|
if(e == se_query_add || e == se_query_del || e == se_query_modify)
|
|
|
|
return false;
|
|
|
|
|
2020-05-14 23:38:30 +02:00
|
|
|
switch (o.dlg())
|
|
|
|
{
|
|
|
|
case B_IMPORT:
|
|
|
|
if (e == fe_button)
|
|
|
|
open_import_win();
|
|
|
|
break;
|
|
|
|
case B_DELETE:
|
|
|
|
if (e == fe_button)
|
|
|
|
delete_file();
|
|
|
|
break;
|
|
|
|
case B_CONFIG:
|
|
|
|
if (e == fe_button)
|
|
|
|
open_config_win();
|
|
|
|
default: break;
|
|
|
|
}
|
2020-04-22 18:38:55 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-05-18 11:00:06 +02:00
|
|
|
void TGestione_doc_cartacei_f9_msk::check_addr_cart() const
|
|
|
|
{
|
|
|
|
const TFilename f(_addr_cart);
|
|
|
|
if (f.full() && !f.exist())
|
|
|
|
{
|
|
|
|
warning_box("Cartella documenti cartacei non trovata.\nSalvare nuovamente le impostazioni.");
|
|
|
|
open_config_win();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 23:38:30 +02:00
|
|
|
void TGestione_doc_cartacei_f9_msk::check_deleted()
|
|
|
|
{
|
|
|
|
// Controllo che non ci siano file nella cartella eliminati da piu' di un mese, altrimenti li elimino
|
|
|
|
TString_array result;
|
2020-05-18 11:00:06 +02:00
|
|
|
TFilename s; s << TFilename(F9CONF.get_addr_cart()).slash_terminate() << "eliminati\\";
|
|
|
|
if (s.exist())
|
2020-05-14 23:38:30 +02:00
|
|
|
{
|
2020-05-18 11:00:06 +02:00
|
|
|
list_files(s, result);
|
|
|
|
FOR_EACH_ARRAY_ITEM(result, nr, file)
|
2020-05-14 23:38:30 +02:00
|
|
|
{
|
2020-05-18 11:00:06 +02:00
|
|
|
const char* deletedfile = *(TString*)(file);
|
|
|
|
HANDLE h_file = CreateFile(deletedfile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
|
|
FILETIME last_access_time;
|
|
|
|
SYSTEMTIME time;
|
|
|
|
bool flag = false;
|
|
|
|
if (h_file != INVALID_HANDLE_VALUE)
|
2020-05-14 23:38:30 +02:00
|
|
|
{
|
2020-05-18 11:00:06 +02:00
|
|
|
if (GetFileTime(h_file, NULL, &last_access_time, NULL))
|
2020-05-14 23:38:30 +02:00
|
|
|
{
|
2020-05-18 11:00:06 +02:00
|
|
|
FileTimeToSystemTime(&last_access_time, &time);
|
|
|
|
TDate today = TDate(TODAY);
|
|
|
|
if (time.wMonth < (unsigned short)today.month() - 1 ||
|
|
|
|
time.wMonth == (unsigned short)today.month() - 1 && time.wDay <= (unsigned short)today.day())
|
|
|
|
{
|
|
|
|
flag = true;
|
|
|
|
CloseHandle(h_file);
|
|
|
|
DeleteFile(deletedfile);
|
|
|
|
}
|
2020-05-14 23:38:30 +02:00
|
|
|
}
|
|
|
|
}
|
2020-05-18 11:00:06 +02:00
|
|
|
if (!flag)
|
|
|
|
CloseHandle(h_file);
|
2020-05-14 23:38:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TGestione_doc_cartacei_f9_msk::check_file_exist(const TString& file) const
|
|
|
|
{
|
|
|
|
TFilename path(_addr_cart);
|
|
|
|
path.slash_terminate() << file;
|
|
|
|
return path.exist();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TGestione_doc_cartacei_f9_msk::delete_file()
|
|
|
|
{
|
|
|
|
TSheet_field& sf = sfield(S_IMPORTED);
|
|
|
|
FOR_EACH_SHEET_ROW(sf, nr, row)
|
|
|
|
{
|
|
|
|
if (row->starts_with("X"))
|
|
|
|
{
|
|
|
|
TLocalisamfile f9cart(LF_F9CART);
|
|
|
|
f9cart.setkey(2);
|
|
|
|
const char* filename = row->get(cid2index(F_FILENAME));
|
|
|
|
const char* numreg = row->get(cid2index(104));
|
|
|
|
f9cart.put(F9C_FILENAME, filename);
|
|
|
|
f9cart.put(F9C_NUMREG, numreg);
|
|
|
|
f9cart.read();
|
2020-05-18 11:00:06 +02:00
|
|
|
TFilename filecart(F9CONF.get_addr_cart());
|
|
|
|
filecart.slash_terminate();
|
|
|
|
TFilename deleted(filecart);
|
|
|
|
filecart << filename;
|
|
|
|
deleted << "eliminati" << SLASH;
|
2020-05-14 23:38:30 +02:00
|
|
|
if (!deleted.exist())
|
|
|
|
make_dir(deleted);
|
|
|
|
deleted << filename;
|
|
|
|
if (deleted.exist())
|
|
|
|
DeleteFile(deleted);
|
|
|
|
if (!MoveFile(filecart, deleted))
|
|
|
|
warning_box(TString("Attenzione:") << " non e' stato possibile rimuovere questo file: " << filecart);
|
|
|
|
else
|
|
|
|
f9cart.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fill();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TGestione_doc_cartacei_f9_msk::doc_already_exists(const TFilename& file, TString& numreg) const
|
|
|
|
{
|
|
|
|
const auto it = _list_file.find(file);
|
|
|
|
if (it != _list_file.end())
|
|
|
|
{
|
|
|
|
numreg = it->second.numreg;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
numreg = "";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-04-22 18:38:55 +02:00
|
|
|
void TGestione_doc_cartacei_f9_msk::fill()
|
|
|
|
{
|
2020-05-14 23:38:30 +02:00
|
|
|
TLocalisamfile files(LF_F9CART);
|
|
|
|
TLocalisamfile mov(LF_MOV);
|
|
|
|
TSheet_field& sf = sfield(S_IMPORTED);
|
|
|
|
sf.hide();
|
|
|
|
sf.destroy();
|
|
|
|
_list_file.clear();
|
2020-05-18 11:00:06 +02:00
|
|
|
std::set<TString> file_err;
|
2020-05-14 23:38:30 +02:00
|
|
|
if(files.first() == NOERR)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
const TString& namefile = files.get(F9C_FILENAME);
|
2020-05-18 11:00:06 +02:00
|
|
|
bool not_exist = false;
|
|
|
|
if((not_exist = !check_file_exist(namefile)))
|
|
|
|
file_err.insert(namefile);
|
2020-05-14 23:38:30 +02:00
|
|
|
const TString& numreg = files.get(F9C_NUMREG);
|
|
|
|
TString datamov, caus, numdoc, nprot, descrmov;
|
|
|
|
mov.zero();
|
|
|
|
mov.put(MOV_NUMREG, numreg);
|
|
|
|
if(mov.read() == NOERR)
|
|
|
|
{
|
|
|
|
datamov = mov.get(MOV_DATAREG);
|
|
|
|
caus = mov.get(MOV_CODCAUS);
|
|
|
|
numdoc = mov.get(MOV_NUMDOCEXT);
|
|
|
|
if(numdoc.empty()) numdoc = mov.get(MOV_NUMDOC);
|
2020-05-18 11:00:06 +02:00
|
|
|
nprot << mov.get(MOV_REG) << "/" << mov.get(MOV_PROTIVA);
|
2020-05-14 23:38:30 +02:00
|
|
|
descrmov = mov.get(MOV_DESCR);
|
|
|
|
}
|
|
|
|
TToken_string& r = sf.row(-1);
|
2020-05-18 11:00:06 +02:00
|
|
|
r.add(" ", 0); // F_SEL
|
|
|
|
r.add(namefile); // F_FILENAME
|
|
|
|
r.add(files.get(F9C_LOADDATE)); // F_DATACARIC
|
|
|
|
r.add(numreg); // F_NUMREG
|
|
|
|
r.add(datamov); // F_DATAMOV
|
|
|
|
r.add(caus); // F_CAUS
|
|
|
|
r.add(numdoc); // F_NUMDOC
|
|
|
|
r.add(nprot); // F_NPROTOCOL
|
|
|
|
r.add(descrmov); // F_DESCRMOV
|
|
|
|
r.add(not_exist ? "IL FILE NON E' PRESENTE IN ARCHIVIO." : ""); // F_INFO
|
2020-05-14 23:38:30 +02:00
|
|
|
|
|
|
|
_list_file.insert({ namefile, { namefile, files.get(F9C_LOADDATE), numreg, files.get(F9C_USER) } });
|
|
|
|
} while (files.next() == NOERR);
|
|
|
|
sf.force_update();
|
|
|
|
}
|
|
|
|
sf.show();
|
2020-05-18 11:00:06 +02:00
|
|
|
if(!file_err.empty())
|
|
|
|
{
|
|
|
|
int count = 0;
|
|
|
|
const bool m = (int)file_err.size() == 1;
|
|
|
|
const char p = m ? 'o' : 'i';
|
|
|
|
TString msg; msg << (int)file_err.size() << " file non " << (m ? "e'" : "sono") << " stat" << p <<
|
|
|
|
" trovat" << p << ".\nSi prega di rimuoverl" << p << " dall'elenco\n\nFile non trovat" << p << ":";
|
2020-05-14 23:38:30 +02:00
|
|
|
|
2020-05-18 11:00:06 +02:00
|
|
|
for(auto it = file_err.begin(); it != file_err.end(); ++it)
|
|
|
|
{
|
|
|
|
if (count++ == 10)
|
|
|
|
{
|
|
|
|
msg << "\n" << "...";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
msg << "\n" << *it << " [Num. Reg.: " << _list_file.find(*it)->second.numreg << "]";
|
|
|
|
}
|
|
|
|
#ifndef DBG
|
|
|
|
const bool del = warning_box(msg);
|
|
|
|
#else
|
|
|
|
if (yesno_box(msg))
|
|
|
|
{
|
|
|
|
remove_file_from_f9cart(file_err);
|
|
|
|
fill();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2020-04-22 18:38:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TToken_string& TGestione_doc_cartacei_f9_msk::get_valid_extensions()
|
|
|
|
{
|
2020-05-18 11:00:06 +02:00
|
|
|
static TToken_string ext(F9CONF.get_estensioni(), ',');
|
2020-04-22 18:38:55 +02:00
|
|
|
if (ext.items() == 0)
|
2020-04-21 18:53:15 +02:00
|
|
|
{
|
2020-04-22 18:38:55 +02:00
|
|
|
ext = ".pdf, .doc, .docx, .xls, .xlsx, .jpg, .jpeg, .png";
|
2020-05-18 11:00:06 +02:00
|
|
|
F9CONF.set_estensioni(ext);
|
2020-04-21 18:53:15 +02:00
|
|
|
}
|
2020-04-22 18:38:55 +02:00
|
|
|
ext.replace(" ", "");
|
|
|
|
return ext;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TGestione_doc_cartacei_f9_msk::load_extensions()
|
|
|
|
{
|
|
|
|
if (_extensions == nullptr)
|
|
|
|
{
|
2020-05-14 23:38:30 +02:00
|
|
|
_extensions = std::make_unique<std::set<TString>>();
|
2020-04-22 18:38:55 +02:00
|
|
|
TToken_string& ext = get_valid_extensions();
|
|
|
|
for (int i = 0; i < ext.items(); ++i)
|
|
|
|
{
|
|
|
|
TString e = ext.get(i);
|
|
|
|
if (!e.empty())
|
|
|
|
{
|
|
|
|
if (e.starts_with("."))
|
|
|
|
e.ltrim(1);
|
2020-05-14 23:38:30 +02:00
|
|
|
_extensions->insert(e);
|
2020-04-22 18:38:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 23:38:30 +02:00
|
|
|
bool TGestione_doc_cartacei_f9_msk::load_file(const TFilename& file, const TString& numreg)
|
2020-04-22 18:38:55 +02:00
|
|
|
{
|
2020-05-14 23:38:30 +02:00
|
|
|
TString numreg_old;
|
|
|
|
if(doc_already_exists(file, numreg_old))
|
|
|
|
{
|
|
|
|
error_box(TString("Attenzione:") << "esiste gia' un documento con questo nome associato al num. di registrazione " << numreg_old);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
TLocalisamfile f9cart(LF_F9CART);
|
|
|
|
f9cart.put(F9C_FILENAME, file.name());
|
|
|
|
f9cart.put(F9C_LOADDATE, TDate(TODAY));
|
|
|
|
f9cart.put(F9C_NUMREG, numreg);
|
|
|
|
#ifdef DBG
|
|
|
|
const TString n_user = user();
|
|
|
|
if (n_user.empty())
|
|
|
|
message_box("Attenzione nome utente vuoto!");
|
|
|
|
f9cart.put(F9C_USER, n_user);
|
|
|
|
#else
|
|
|
|
f9cart.put(F9C_USER, user());
|
|
|
|
#endif
|
2020-05-18 11:00:06 +02:00
|
|
|
TFilename fdestin = F9CONF.get_addr_cart();
|
2020-05-14 23:38:30 +02:00
|
|
|
const TString filename = file.name();
|
|
|
|
fdestin << filename;
|
|
|
|
const bool ok = CopyFile(file, fdestin, true);
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
if(fdestin.exist())
|
|
|
|
warning_box("Errore nel copiare il file nella cartella di destinazione.\nEsiste gia' un file con questo nome.");
|
|
|
|
else
|
|
|
|
warning_box("Errore nel copiare il file nella cartella di destinazione. Ritentare.");
|
|
|
|
f9cart.zero();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
f9cart.write();
|
|
|
|
f9cart.rewrite();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TGestione_doc_cartacei_f9_msk::open_config_win() const
|
|
|
|
{
|
|
|
|
static std::unique_ptr<TMask> msk;
|
|
|
|
if(msk == nullptr)
|
|
|
|
{
|
|
|
|
msk = std::make_unique<TMask>("Configurazione", 1, 78, 14);
|
|
|
|
msk->add_button_tool(DLG_OK, "Conferma", TOOL_OK);
|
|
|
|
msk->add_button_tool(DLG_NULL, "", 0);
|
|
|
|
msk->add_button_tool(DLG_QUIT, "Esci", TOOL_QUIT);
|
|
|
|
|
|
|
|
msk->add_groupbox(DLG_NULL, 0, "", 1, 0, 76, 4, "");
|
|
|
|
msk->add_static (DLG_NULL, 0, "@BInserire estensioni file riconosciute, separate da virgola.", 2, 1);
|
|
|
|
msk->add_string (101, 0, "Estensioni:", 2, 2, 255, "", 60);
|
|
|
|
msk->add_groupbox(DLG_NULL, 0, "@BCartella documenti cartacei", 1, 4, 76, 4);
|
|
|
|
msk->add_static (DLG_NULL, 0, "@BInserire nome cartella, all'interno della area dati della ditta", 2, 5);
|
|
|
|
msk->add_string (102, 0, "", 2, 6, 64, "", 30);
|
|
|
|
|
2020-05-18 11:00:06 +02:00
|
|
|
msk->set(101, F9CONF.get_estensioni());
|
|
|
|
TString s = F9CONF.get_addr_cart();
|
2020-05-14 23:38:30 +02:00
|
|
|
s.rtrim(1);
|
|
|
|
s.ltrim(s.rfind('\\') + 1);
|
|
|
|
msk->set(102, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
if (msk->run() != K_ENTER)
|
|
|
|
{
|
|
|
|
if (msk->get(102).empty())
|
|
|
|
{
|
|
|
|
warning_box("Si prega di inserire il nome della cartella per i documenti cartacei.");
|
|
|
|
continue;
|
|
|
|
}
|
2020-05-18 11:00:06 +02:00
|
|
|
break;
|
2020-05-14 23:38:30 +02:00
|
|
|
}
|
2020-05-18 11:00:06 +02:00
|
|
|
F9CONF.set_estensioni(msk->get(101));
|
2020-05-14 23:38:30 +02:00
|
|
|
TString dir = msk->get(102);
|
|
|
|
if (dir.empty())
|
|
|
|
{
|
|
|
|
if(yesno_box("Nome cartella vuoto.\nCreare cartella con nome 'Cartacei_F9'?"))
|
|
|
|
msk->set(102, dir = "Cartacei_F9");
|
|
|
|
else continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
TFilename path(prefix().get_studio());
|
|
|
|
path.slash_terminate() << dir;
|
|
|
|
path.slash_terminate();
|
|
|
|
if (!path.exist())
|
|
|
|
{
|
|
|
|
if (dir == "Cartacei_F9" || yesno_box("Il percorso indicato e' inesistente.\nCreare la cartella con questo nome?"))
|
|
|
|
{
|
|
|
|
if (!make_dir(path))
|
|
|
|
{
|
|
|
|
warning_box("Impossibile creare il percorso specificato.");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else continue;
|
|
|
|
}
|
2020-05-18 11:00:06 +02:00
|
|
|
F9CONF.set_addr_cart(path);
|
2020-05-14 23:38:30 +02:00
|
|
|
break;
|
|
|
|
}
|
2020-04-22 18:38:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TGestione_doc_cartacei_f9_msk::open_import_win()
|
|
|
|
{
|
|
|
|
if(_import_msk == nullptr)
|
|
|
|
_import_msk = make_unique<TImport_msk>();
|
|
|
|
while(_import_msk->run() == K_ENTER)
|
|
|
|
{
|
2020-05-14 23:38:30 +02:00
|
|
|
const TString& file = _import_msk->get(F_IMPADDRESS);
|
|
|
|
const TString& numreg = _import_msk->get(F_IMPNUMREG);
|
|
|
|
if (!file.empty())
|
2020-04-22 18:38:55 +02:00
|
|
|
{
|
|
|
|
TFilename f(file);
|
|
|
|
if (verify_extension(f))
|
2020-05-14 23:38:30 +02:00
|
|
|
{
|
|
|
|
if (load_file(f, numreg))
|
|
|
|
message_box("File caricato.");
|
|
|
|
}
|
2020-04-22 18:38:55 +02:00
|
|
|
else
|
|
|
|
warning_box("Questo file e' in un formato non accettato.");
|
|
|
|
}
|
|
|
|
}
|
2020-05-14 23:38:30 +02:00
|
|
|
fill();
|
2020-04-22 18:38:55 +02:00
|
|
|
}
|
|
|
|
|
2020-05-18 11:00:06 +02:00
|
|
|
void TGestione_doc_cartacei_f9_msk::remove_file_from_f9cart(const std::set<TString>& files)
|
|
|
|
{
|
|
|
|
TLocalisamfile f9cart(LF_F9CART);
|
|
|
|
for(auto it = files.begin(); it != files.end(); ++it)
|
|
|
|
{
|
|
|
|
f9cart.zero();
|
|
|
|
f9cart.put(F9C_FILENAME, *it);
|
|
|
|
f9cart.read();
|
|
|
|
f9cart.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-22 18:38:55 +02:00
|
|
|
bool TGestione_doc_cartacei_f9_msk::verify_extension(const TFilename& file)
|
|
|
|
{
|
|
|
|
load_extensions();
|
|
|
|
return _extensions->find(file.ext()) != _extensions->end();
|
2020-04-21 18:53:15 +02:00
|
|
|
}
|
|
|
|
|
2020-05-18 11:00:06 +02:00
|
|
|
TGestione_doc_cartacei_f9_msk::TGestione_doc_cartacei_f9_msk(): TAutomask("f90300a"), _addr_cart(F9CONF.get_addr_cart())
|
2020-05-14 23:38:30 +02:00
|
|
|
{
|
|
|
|
if (_addr_cart.empty())
|
|
|
|
{
|
|
|
|
message_box("Inserire nome cartella documenti cartacei.");
|
|
|
|
open_config_win();
|
|
|
|
}
|
2020-05-18 11:00:06 +02:00
|
|
|
else
|
|
|
|
check_addr_cart();
|
2020-05-14 23:38:30 +02:00
|
|
|
check_deleted();
|
|
|
|
fill();
|
|
|
|
}
|
2020-04-22 18:38:55 +02:00
|
|
|
|
|
|
|
|
2020-05-18 11:00:06 +02:00
|
|
|
|
|
|
|
|
2020-04-21 18:53:15 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// TGestione_doc_cartacei_f9_app
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class TGestione_doc_cartacei_f9_app : public TSkeleton_application
|
|
|
|
{
|
2020-04-22 18:38:55 +02:00
|
|
|
void main_loop() override
|
|
|
|
{
|
|
|
|
TGestione_doc_cartacei_f9_msk msk;
|
|
|
|
while (msk.run() == K_ENTER)
|
|
|
|
{ }
|
|
|
|
}
|
2020-04-21 18:53:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int f90300(const int argc, char* argv[])
|
|
|
|
{
|
|
|
|
TGestione_doc_cartacei_f9_app app;
|
|
|
|
app.run(argc, argv, "Gestione documenti cartacei");
|
|
|
|
return 0;
|
|
|
|
}
|